cbc_done.c 840 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* LibTomCrypt, modular cryptographic library -- Tom St Denis
  2. *
  3. * LibTomCrypt is a library that provides various cryptographic
  4. * algorithms in a highly modular and flexible manner.
  5. *
  6. * The library is free for all purposes without any express
  7. * guarantee it works.
  8. */
  9. #include "tomcrypt_private.h"
  10. /**
  11. @file cbc_done.c
  12. CBC implementation, finish chain, Tom St Denis
  13. */
  14. #ifdef LTC_CBC_MODE
  15. /** Terminate the chain
  16. @param cbc The CBC chain to terminate
  17. @return CRYPT_OK on success
  18. */
  19. int cbc_done(symmetric_CBC *cbc)
  20. {
  21. int err;
  22. LTC_ARGCHK(cbc != NULL);
  23. if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) {
  24. return err;
  25. }
  26. cipher_descriptor[cbc->cipher].done(&cbc->key);
  27. return CRYPT_OK;
  28. }
  29. #endif
  30. /* ref: $Format:%D$ */
  31. /* git commit: $Format:%H$ */
  32. /* commit time: $Format:%ai$ */