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