Better separation between crypto_auth[_verify] and the NIST-like API.

This commit is contained in:
Frank Denis 2015-04-05 20:13:18 +02:00
parent f379ab8766
commit f740cb5968
3 changed files with 24 additions and 18 deletions

View File

@ -12,13 +12,6 @@
extern "C" { extern "C" {
#endif #endif
typedef struct crypto_auth_hmacsha256_state {
crypto_hash_sha256_state ictx;
crypto_hash_sha256_state octx;
} crypto_auth_hmacsha256_state;
SODIUM_EXPORT
size_t crypto_auth_hmacsha256_statebytes(void);
#define crypto_auth_hmacsha256_BYTES 32U #define crypto_auth_hmacsha256_BYTES 32U
SODIUM_EXPORT SODIUM_EXPORT
size_t crypto_auth_hmacsha256_bytes(void); size_t crypto_auth_hmacsha256_bytes(void);
@ -39,6 +32,15 @@ int crypto_auth_hmacsha256_verify(const unsigned char *h,
unsigned long long inlen, unsigned long long inlen,
const unsigned char *k); const unsigned char *k);
/* ------------------------------------------------------------------------- */
typedef struct crypto_auth_hmacsha256_state {
crypto_hash_sha256_state ictx;
crypto_hash_sha256_state octx;
} crypto_auth_hmacsha256_state;
SODIUM_EXPORT
size_t crypto_auth_hmacsha256_statebytes(void);
SODIUM_EXPORT SODIUM_EXPORT
int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state, int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
const unsigned char *key, const unsigned char *key,

View File

@ -12,13 +12,6 @@
extern "C" { extern "C" {
#endif #endif
typedef struct crypto_auth_hmacsha512_state {
crypto_hash_sha512_state ictx;
crypto_hash_sha512_state octx;
} crypto_auth_hmacsha512_state;
SODIUM_EXPORT
size_t crypto_auth_hmacsha512_statebytes(void);
#define crypto_auth_hmacsha512_BYTES 64U #define crypto_auth_hmacsha512_BYTES 64U
SODIUM_EXPORT SODIUM_EXPORT
size_t crypto_auth_hmacsha512_bytes(void); size_t crypto_auth_hmacsha512_bytes(void);
@ -39,6 +32,15 @@ int crypto_auth_hmacsha512_verify(const unsigned char *h,
unsigned long long inlen, unsigned long long inlen,
const unsigned char *k); const unsigned char *k);
/* ------------------------------------------------------------------------- */
typedef struct crypto_auth_hmacsha512_state {
crypto_hash_sha512_state ictx;
crypto_hash_sha512_state octx;
} crypto_auth_hmacsha512_state;
SODIUM_EXPORT
size_t crypto_auth_hmacsha512_statebytes(void);
SODIUM_EXPORT SODIUM_EXPORT
int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state, int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state,
const unsigned char *key, const unsigned char *key,

View File

@ -12,10 +12,6 @@
extern "C" { extern "C" {
#endif #endif
typedef crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state;
SODIUM_EXPORT
size_t crypto_auth_hmacsha512256_statebytes(void);
#define crypto_auth_hmacsha512256_BYTES 32U #define crypto_auth_hmacsha512256_BYTES 32U
SODIUM_EXPORT SODIUM_EXPORT
size_t crypto_auth_hmacsha512256_bytes(void); size_t crypto_auth_hmacsha512256_bytes(void);
@ -34,6 +30,12 @@ int crypto_auth_hmacsha512256_verify(const unsigned char *h,
unsigned long long inlen, unsigned long long inlen,
const unsigned char *k); const unsigned char *k);
/* ------------------------------------------------------------------------- */
typedef crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state;
SODIUM_EXPORT
size_t crypto_auth_hmacsha512256_statebytes(void);
SODIUM_EXPORT SODIUM_EXPORT
int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state, int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state,
const unsigned char *key, const unsigned char *key,