Additional salsa20 tests

This commit is contained in:
Frank Denis 2019-03-21 01:15:13 +01:00
parent 2e2de69de3
commit cb5f937ca7

View File

@ -53,6 +53,31 @@ main(void)
sodium_bin2hex(hex, 192 * 2 + 1, output, 192);
printf("%s\n", hex);
assert(memcmp(output, output + 64, 64) != 0);
assert(memcmp(output, output + 128, 64) != 0);
assert(memcmp(output + 64, output + 128, 64) != 0);
memset(output + 192, 0, 64);
crypto_stream_xsalsa20_xor_ic(output, output, 64, nonce,
0ULL, firstkey);
assert(memcmp(output + 192, output, 64) != 0);
assert(memcmp(output + 192, output + 64, 64) != 0);
assert(memcmp(output + 192, output + 128, 64) != 0);
memset(output + 192, 1, 64);
crypto_stream_xsalsa20_xor_ic(output, output, 64, nonce,
0ULL, firstkey);
assert(memcmp(output + 192, output, 64) != 0);
assert(memcmp(output + 192, output + 64, 64) != 0);
assert(memcmp(output + 192, output + 128, 64) != 0);
memset(output, 0, 64);
crypto_stream_xsalsa20_xor_ic(output, output, 128, nonce,
1ULL << 32, firstkey);
assert(memcmp(output, output + 192, 64) != 0);
assert(memcmp(output, output + 128, 64) != 0);
assert(memcmp(output, output + 64, 64) != 0);
assert(crypto_stream_keybytes() > 0U);
assert(crypto_stream_noncebytes() > 0U);
assert(crypto_stream_messagebytes_max() > 0U);