mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Let crypto_generichash_statebytes() return a size rounded to the alignment
Add similar check in the aead_aes256gcm test.
This commit is contained in:
@@ -46,7 +46,7 @@ crypto_generichash_primitive(void)
|
||||
size_t
|
||||
crypto_generichash_statebytes(void)
|
||||
{
|
||||
return sizeof(crypto_generichash_state);
|
||||
return (sizeof(crypto_generichash_state) + (size_t) 63U) & ~(size_t) 63U;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -3177,7 +3177,7 @@ main(void)
|
||||
assert(crypto_aead_aes256gcm_nsecbytes() == crypto_aead_aes256gcm_NSECBYTES);
|
||||
assert(crypto_aead_aes256gcm_npubbytes() == crypto_aead_aes256gcm_NPUBBYTES);
|
||||
assert(crypto_aead_aes256gcm_abytes() == crypto_aead_aes256gcm_ABYTES);
|
||||
assert(crypto_aead_aes256gcm_statebytes() > (size_t) 0U);
|
||||
assert(crypto_aead_aes256gcm_statebytes() >= sizeof(crypto_aead_aes256gcm_state));
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ int main(void)
|
||||
k[crypto_generichash_KEYBYTES_MAX];
|
||||
size_t h, i, j;
|
||||
|
||||
assert(crypto_generichash_statebytes() == sizeof st);
|
||||
assert(crypto_generichash_statebytes() >= sizeof st);
|
||||
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
|
||||
k[h] = h;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user