hmac_process.c 739 B

1234567891011121314151617181920212223242526272829
  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. * Tom St Denis, [email protected], http://libtomcrypt.org
  10. */
  11. /* Submited by Dobes Vandermeer ([email protected]) */
  12. #include "mycrypt.h"
  13. #ifdef HMAC
  14. int hmac_process(hmac_state *hmac, const unsigned char *buf, unsigned long len)
  15. {
  16. int err;
  17. _ARGCHK(hmac != NULL);
  18. _ARGCHK(buf != NULL);
  19. if ((err = hash_is_valid(hmac->hash)) != CRYPT_OK) {
  20. return err;
  21. }
  22. return hash_descriptor[hmac->hash].process(&hmac->md, buf, len);
  23. }
  24. #endif