diff --git a/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c b/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c index 7c7d1a59..8cce2510 100644 --- a/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +++ b/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c @@ -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]; diff --git a/test/default/chacha20.c b/test/default/chacha20.c index f32f45ca..484c9283 100644 --- a/test/default/chacha20.c +++ b/test/default/chacha20.c @@ -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);