crypto_auth_hmacsha512.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef crypto_auth_hmacsha512_H
  2. #define crypto_auth_hmacsha512_H
  3. #include <stddef.h>
  4. #include "crypto_hash_sha512.h"
  5. #include "export.h"
  6. #ifdef __cplusplus
  7. # ifdef __GNUC__
  8. # pragma GCC diagnostic ignored "-Wlong-long"
  9. # endif
  10. extern "C" {
  11. #endif
  12. #define crypto_auth_hmacsha512_BYTES 64U
  13. SODIUM_EXPORT
  14. size_t crypto_auth_hmacsha512_bytes(void);
  15. #define crypto_auth_hmacsha512_KEYBYTES 32U
  16. SODIUM_EXPORT
  17. size_t crypto_auth_hmacsha512_keybytes(void);
  18. SODIUM_EXPORT
  19. int crypto_auth_hmacsha512(unsigned char *out,
  20. const unsigned char *in,
  21. unsigned long long inlen,
  22. const unsigned char *k) __attribute__ ((nonnull(1, 4)));
  23. SODIUM_EXPORT
  24. int crypto_auth_hmacsha512_verify(const unsigned char *h,
  25. const unsigned char *in,
  26. unsigned long long inlen,
  27. const unsigned char *k)
  28. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
  29. /* ------------------------------------------------------------------------- */
  30. typedef struct crypto_auth_hmacsha512_state {
  31. crypto_hash_sha512_state ictx;
  32. crypto_hash_sha512_state octx;
  33. } crypto_auth_hmacsha512_state;
  34. SODIUM_EXPORT
  35. size_t crypto_auth_hmacsha512_statebytes(void);
  36. SODIUM_EXPORT
  37. int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
  38. const unsigned char *key,
  39. size_t keylen) __attribute__ ((nonnull));
  40. SODIUM_EXPORT
  41. int crypto_auth_hmacsha512_update(crypto_auth_hmacsha512_state *state,
  42. const unsigned char *in,
  43. unsigned long long inlen) __attribute__ ((nonnull(1)));
  44. SODIUM_EXPORT
  45. int crypto_auth_hmacsha512_final(crypto_auth_hmacsha512_state *state,
  46. unsigned char *out) __attribute__ ((nonnull));
  47. SODIUM_EXPORT
  48. void crypto_auth_hmacsha512_keygen(unsigned char k[crypto_auth_hmacsha512_KEYBYTES])
  49. __attribute__ ((nonnull));
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif