mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 02:25:14 -07:00
Add statebytes for crypto_hmac_*
This commit is contained in:
parent
d0e9b8f69c
commit
5db61c617b
@ -9,3 +9,8 @@ size_t
|
||||
crypto_auth_hmacsha256_keybytes(void) {
|
||||
return crypto_auth_hmacsha256_KEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_auth_hmacsha256_statebytes(void) {
|
||||
return sizeof(crypto_auth_hmacsha256_state);
|
||||
}
|
||||
|
@ -9,3 +9,8 @@ size_t
|
||||
crypto_auth_hmacsha512_keybytes(void) {
|
||||
return crypto_auth_hmacsha512_KEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_auth_hmacsha512_statebytes(void) {
|
||||
return sizeof(crypto_auth_hmacsha512_state);
|
||||
}
|
||||
|
@ -9,3 +9,8 @@ size_t
|
||||
crypto_auth_hmacsha512256_keybytes(void) {
|
||||
return crypto_auth_hmacsha512256_KEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_auth_hmacsha512256_statebytes(void) {
|
||||
return sizeof(crypto_auth_hmacsha512256_state);
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ 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
|
||||
|
@ -16,6 +16,8 @@ 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
|
||||
|
@ -12,7 +12,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct crypto_auth_hmacsha512_state crypto_auth_hmacsha512256_state;
|
||||
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
|
||||
|
@ -17,6 +17,8 @@ int main(void)
|
||||
crypto_auth_hmacsha512_state st;
|
||||
int i;
|
||||
|
||||
assert(crypto_auth_hmacsha512_statebytes() ==
|
||||
sizeof(crypto_auth_hmacsha512_state));
|
||||
crypto_auth(a, c, sizeof c - 1U, key);
|
||||
for (i = 0; i < sizeof a; ++i) {
|
||||
printf(",0x%02x", (unsigned int)a[i]);
|
||||
@ -55,6 +57,10 @@ int main(void)
|
||||
assert(crypto_auth_hmacsha512_keybytes() > 0U);
|
||||
assert(crypto_auth_hmacsha512256_bytes() == crypto_auth_bytes());
|
||||
assert(crypto_auth_hmacsha512256_keybytes() == crypto_auth_keybytes());
|
||||
assert(crypto_auth_hmacsha256_statebytes() ==
|
||||
sizeof(crypto_auth_hmacsha256_state));
|
||||
assert(crypto_auth_hmacsha512_statebytes() ==
|
||||
sizeof(crypto_auth_hmacsha512_state));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user