This commit is contained in:
Frank Denis 2017-12-01 17:29:29 +01:00
parent dbaa94fe27
commit 947cf4ada5

View File

@ -36,7 +36,7 @@ mm_generichash(void)
crypto_generichash_init(&st, k, klen, hlen); crypto_generichash_init(&st, k, klen, hlen);
l1 = randombytes_uniform((uint32_t) mlen); 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);
crypto_generichash_update(&st, m + l1, l2); crypto_generichash_update(&st, m + l1, l2);
crypto_generichash_update(&st, m + l1 + l2, mlen - l1 - l2); crypto_generichash_update(&st, m + l1 + l2, mlen - l1 - l2);
@ -76,7 +76,7 @@ mm_onetimeauth(void)
crypto_onetimeauth_init(&st, k); crypto_onetimeauth_init(&st, k);
l1 = randombytes_uniform((uint32_t) mlen); 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);
crypto_onetimeauth_update(&st, m + l1, l2); crypto_onetimeauth_update(&st, m + l1, l2);
crypto_onetimeauth_update(&st, m + l1 + l2, mlen - 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); crypto_auth_hmacsha256_init(&st, k, crypto_auth_hmacsha256_KEYBYTES);
l1 = randombytes_uniform((uint32_t) mlen); 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);
crypto_auth_hmacsha256_update(&st, m + l1, l2); crypto_auth_hmacsha256_update(&st, m + l1, l2);
crypto_auth_hmacsha256_update(&st, m + l1 + l2, mlen - 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); crypto_auth_hmacsha512_init(&st, k, crypto_auth_hmacsha512_KEYBYTES);
l1 = randombytes_uniform((uint32_t) mlen); 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);
crypto_auth_hmacsha512_update(&st, m + l1, l2); crypto_auth_hmacsha512_update(&st, m + l1, l2);
crypto_auth_hmacsha512_update(&st, m + l1 + l2, mlen - l1 - l2); crypto_auth_hmacsha512_update(&st, m + l1 + l2, mlen - l1 - l2);