Suggest crypto_generichash_statebytes() instead of sizeof()

This commit is contained in:
Frank Denis 2015-01-23 22:54:13 +01:00
parent b5deb4d070
commit d0e9b8f69c

View File

@ -73,8 +73,8 @@ int sodium_munlock(void * const addr, const size_t len);
* either 357 or 361 bytes. For this reason, when using sodium_malloc() to * either 357 or 361 bytes. For this reason, when using sodium_malloc() to
* allocate a crypto_generichash_state structure, padding must be added in * allocate a crypto_generichash_state structure, padding must be added in
* order to ensure proper alignment: * order to ensure proper alignment:
* state = sodium_malloc((sizeof(crypto_generichash_state) * state = sodium_malloc((crypto_generichash_statebytes() + (size_t) 63U)
* + (size_t) 63U) & ~(size_t) 63U); * & ~(size_t) 63U);
*/ */
SODIUM_EXPORT SODIUM_EXPORT