Casts
This commit is contained in:
parent
218dac349a
commit
e44614505b
@ -35,8 +35,8 @@ mm_generichash(void)
|
|||||||
randombytes_buf(m, mlen);
|
randombytes_buf(m, mlen);
|
||||||
|
|
||||||
crypto_generichash_init(&st, k, klen, hlen);
|
crypto_generichash_init(&st, k, klen, hlen);
|
||||||
l1 = randombytes_uniform(mlen);
|
l1 = randombytes_uniform((uint32_t) mlen);
|
||||||
l2 = randombytes_uniform(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);
|
||||||
@ -75,8 +75,8 @@ mm_onetimeauth(void)
|
|||||||
randombytes_buf(m, mlen);
|
randombytes_buf(m, mlen);
|
||||||
|
|
||||||
crypto_onetimeauth_init(&st, k);
|
crypto_onetimeauth_init(&st, k);
|
||||||
l1 = randombytes_uniform(mlen);
|
l1 = randombytes_uniform((uint32_t) mlen);
|
||||||
l2 = randombytes_uniform(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);
|
||||||
@ -115,8 +115,8 @@ mm_hmacsha256(void)
|
|||||||
randombytes_buf(m, mlen);
|
randombytes_buf(m, mlen);
|
||||||
|
|
||||||
crypto_auth_hmacsha256_init(&st, k, crypto_auth_hmacsha256_KEYBYTES);
|
crypto_auth_hmacsha256_init(&st, k, crypto_auth_hmacsha256_KEYBYTES);
|
||||||
l1 = randombytes_uniform(mlen);
|
l1 = randombytes_uniform((uint32_t) mlen);
|
||||||
l2 = randombytes_uniform(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);
|
||||||
@ -155,8 +155,8 @@ mm_hmacsha512(void)
|
|||||||
randombytes_buf(m, mlen);
|
randombytes_buf(m, mlen);
|
||||||
|
|
||||||
crypto_auth_hmacsha512_init(&st, k, crypto_auth_hmacsha512_KEYBYTES);
|
crypto_auth_hmacsha512_init(&st, k, crypto_auth_hmacsha512_KEYBYTES);
|
||||||
l1 = randombytes_uniform(mlen);
|
l1 = randombytes_uniform((uint32_t) mlen);
|
||||||
l2 = randombytes_uniform(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);
|
||||||
|
@ -244,7 +244,7 @@ tv_secretbox_xchacha20poly1305(void)
|
|||||||
assert(crypto_secretbox_xchacha20poly1305_easy(out2, m, m_len, nonce, key) == 0);
|
assert(crypto_secretbox_xchacha20poly1305_easy(out2, m, m_len, nonce, key) == 0);
|
||||||
assert(memcmp(out, out2,
|
assert(memcmp(out, out2,
|
||||||
crypto_secretbox_xchacha20poly1305_MACBYTES + m_len) == 0);
|
crypto_secretbox_xchacha20poly1305_MACBYTES + m_len) == 0);
|
||||||
n = randombytes_uniform(crypto_secretbox_xchacha20poly1305_MACBYTES + m_len);
|
n = randombytes_uniform(crypto_secretbox_xchacha20poly1305_MACBYTES + (uint32_t) m_len);
|
||||||
assert(crypto_secretbox_xchacha20poly1305_open_easy
|
assert(crypto_secretbox_xchacha20poly1305_open_easy
|
||||||
(out2, out2, crypto_secretbox_xchacha20poly1305_MACBYTES - 1,
|
(out2, out2, crypto_secretbox_xchacha20poly1305_MACBYTES - 1,
|
||||||
nonce, key) == -1);
|
nonce, key) == -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user