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 <martin@strongswan.org>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Martin Willi
2015-06-01 13:43:57 +02:00
committed by Herbert Xu
parent c08d0e6473
commit 3590ebf2b4
2 changed files with 192 additions and 0 deletions

View File

@@ -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,