Let crypto_generichash_statebytes() return a size rounded to the alignment

Add similar check in the aead_aes256gcm test.
This commit is contained in:
Frank Denis 2015-10-18 00:16:05 +02:00
parent 1c98a61a2e
commit eeb31af578
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;