From 1217d30bae196be186bcffb3d4331b6dcc0d6d4c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 14 Sep 2014 13:09:15 -0700 Subject: [PATCH] More chacha20 tests --- test/default/chacha20.c | 13 +++++++++++++ test/default/chacha20.exp | 3 +++ 2 files changed, 16 insertions(+) diff --git a/test/default/chacha20.c b/test/default/chacha20.c index 1dfcb56a..f32f45ca 100644 --- a/test/default/chacha20.c +++ b/test/default/chacha20.c @@ -33,6 +33,19 @@ static void tv(void) sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out); printf("[%s]\n", out_hex); } while (++i < (sizeof tests) / (sizeof tests[0])); + + memset(out, 0x42, sizeof out); + 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); + + crypto_stream_chacha20_xor_ic(out, out, sizeof out, nonce, 0U, key); + sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out); + printf("[%s]\n", out_hex); + + crypto_stream_chacha20_xor_ic(out, out, sizeof out, nonce, 1U, key); + sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out); + printf("[%s]\n", out_hex); }; int main(void) diff --git a/test/default/chacha20.exp b/test/default/chacha20.exp index 6ba341d7..38c0adc8 100644 --- a/test/default/chacha20.exp +++ b/test/default/chacha20.exp @@ -3,3 +3,6 @@ [de9cba7bf3d69ef5e786dc63973f653a0b49e015adbff7134fcb7df137821031e85a050278a7084527214f73efc7fa5b5277062eb7a0433e445f41e3] [ef3fdfd6c61578fbf5cf35bd3dd33b8009631634d21e42ac33960bd138e50d32111e4caf237ee53ca8ad6426194a88545ddc497a0b466e7d6bbdb004] [f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c] +[b5dae3cbb3d7a42bc0521db92649f5373d15dfe15440bed1ae43ee14ba18818376e616393179040372008b06420b552b4791fc1ba85e11b31b54571e] +[424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242] +[7a42c9d864fe77d65c6606553ec89c24cb9cd7640bc49b1acbb922aa046b8bffd818895e835afc147cfbf1e6e630ba6c4be5a53a0b69146cb5514cca]