1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 10:05:05 -07:00
This commit is contained in:
Frank Denis 2017-12-01 17:29:29 +01:00
parent cc92e26a6b
commit 229dac07ee

View File

@ -36,7 +36,7 @@ mm_generichash(void)
crypto_generichash_init(&st, k, klen, hlen);
l1 = randombytes_uniform((uint32_t) mlen);
l2 = randombytes_uniform((uint32_t) mlen - l1);
l2 = randombytes_uniform((uint32_t) (mlen - l1));
crypto_generichash_update(&st, m, l1);
crypto_generichash_update(&st, m + l1, l2);
crypto_generichash_update(&st, m + l1 + l2, mlen - l1 - l2);
@ -76,7 +76,7 @@ mm_onetimeauth(void)
crypto_onetimeauth_init(&st, k);
l1 = randombytes_uniform((uint32_t) mlen);
l2 = randombytes_uniform((uint32_t) mlen - l1);
l2 = randombytes_uniform((uint32_t) (mlen - l1));
crypto_onetimeauth_update(&st, m, l1);
crypto_onetimeauth_update(&st, m + l1, l2);
crypto_onetimeauth_update(&st, m + l1 + l2, mlen - l1 - l2);
@ -116,7 +116,7 @@ mm_hmacsha256(void)
crypto_auth_hmacsha256_init(&st, k, crypto_auth_hmacsha256_KEYBYTES);
l1 = randombytes_uniform((uint32_t) mlen);
l2 = randombytes_uniform((uint32_t) mlen - l1);
l2 = randombytes_uniform((uint32_t) (mlen - l1));
crypto_auth_hmacsha256_update(&st, m, l1);
crypto_auth_hmacsha256_update(&st, m + l1, l2);
crypto_auth_hmacsha256_update(&st, m + l1 + l2, mlen - l1 - l2);
@ -156,7 +156,7 @@ mm_hmacsha512(void)
crypto_auth_hmacsha512_init(&st, k, crypto_auth_hmacsha512_KEYBYTES);
l1 = randombytes_uniform((uint32_t) mlen);
l2 = randombytes_uniform((uint32_t) mlen - l1);
l2 = randombytes_uniform((uint32_t) (mlen - l1));
crypto_auth_hmacsha512_update(&st, m, l1);
crypto_auth_hmacsha512_update(&st, m + l1, l2);
crypto_auth_hmacsha512_update(&st, m + l1 + l2, mlen - l1 - l2);