mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Test chacha20 with length == 0
This commit is contained in:
@@ -101,7 +101,7 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, unsigned long long bytes
|
||||
unsigned long long i;
|
||||
|
||||
if (!bytes) {
|
||||
return;
|
||||
return; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
j0 = x->input[0];
|
||||
j1 = x->input[1];
|
||||
|
||||
@@ -35,6 +35,10 @@ static void tv(void)
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
|
||||
memset(out, 0x42, sizeof out);
|
||||
|
||||
assert(crypto_stream_chacha20_xor(out, out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_xor_ic(out, out, 0U, nonce, 1U, key) == 0);
|
||||
|
||||
crypto_stream_chacha20_xor(out, out, sizeof out, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
Reference in New Issue
Block a user