From 3590ebf2b4c40aa4b663c4f2b9dfeb0a1e0b8f32 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 1 Jun 2015 13:43:57 +0200 Subject: crypto: testmgr - Add ChaCha20 test vectors from RFC7539 We explicitly set the Initial block Counter by prepending it to the nonce in Little Endian. The same test vector is used for both encryption and decryption, ChaCha20 is a cipher XORing a keystream. Signed-off-by: Martin Willi Acked-by: Steffen Klassert Signed-off-by: Herbert Xu --- crypto/testmgr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crypto/testmgr.c') diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 717d6f2d8b0f..abd09c2489fa 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2307,6 +2307,21 @@ static const struct alg_test_desc alg_test_descs[] = { } } } + }, { + .alg = "chacha20", + .test = alg_test_skcipher, + .suite = { + .cipher = { + .enc = { + .vecs = chacha20_enc_tv_template, + .count = CHACHA20_ENC_TEST_VECTORS + }, + .dec = { + .vecs = chacha20_enc_tv_template, + .count = CHACHA20_ENC_TEST_VECTORS + }, + } + } }, { .alg = "cmac(aes)", .test = alg_test_hash, -- cgit