From f740cb59680f8db107258c43e7b26fa8695725b5 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 5 Apr 2015 20:13:18 +0200 Subject: [PATCH] Better separation between crypto_auth[_verify] and the NIST-like API. --- .../include/sodium/crypto_auth_hmacsha256.h | 16 +++++++++------- .../include/sodium/crypto_auth_hmacsha512.h | 16 +++++++++------- .../include/sodium/crypto_auth_hmacsha512256.h | 10 ++++++---- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/libsodium/include/sodium/crypto_auth_hmacsha256.h b/src/libsodium/include/sodium/crypto_auth_hmacsha256.h index 87471634..b74e1d7b 100644 --- a/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +++ b/src/libsodium/include/sodium/crypto_auth_hmacsha256.h @@ -12,13 +12,6 @@ extern "C" { #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 SODIUM_EXPORT size_t crypto_auth_hmacsha256_bytes(void); @@ -39,6 +32,15 @@ int crypto_auth_hmacsha256_verify(const unsigned char *h, unsigned long long inlen, 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 int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state, const unsigned char *key, diff --git a/src/libsodium/include/sodium/crypto_auth_hmacsha512.h b/src/libsodium/include/sodium/crypto_auth_hmacsha512.h index f67261c7..ff36b9a6 100644 --- a/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +++ b/src/libsodium/include/sodium/crypto_auth_hmacsha512.h @@ -12,13 +12,6 @@ extern "C" { #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 SODIUM_EXPORT size_t crypto_auth_hmacsha512_bytes(void); @@ -39,6 +32,15 @@ int crypto_auth_hmacsha512_verify(const unsigned char *h, unsigned long long inlen, 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 int crypto_auth_hmacsha512_init(crypto_auth_hmacsha512_state *state, const unsigned char *key, diff --git a/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h b/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h index 729bcdde..da05e387 100644 --- a/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +++ b/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h @@ -12,10 +12,6 @@ extern "C" { #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 SODIUM_EXPORT size_t crypto_auth_hmacsha512256_bytes(void); @@ -34,6 +30,12 @@ int crypto_auth_hmacsha512256_verify(const unsigned char *h, unsigned long long inlen, const unsigned char *k); +/* ------------------------------------------------------------------------- */ + +typedef crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state; +SODIUM_EXPORT +size_t crypto_auth_hmacsha512256_statebytes(void); + SODIUM_EXPORT int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state *state, const unsigned char *key,