summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorMartin Willi2015-06-01 13:43:57 +0200
committerHerbert Xu2015-06-04 09:04:50 +0200
commit3590ebf2b4c40aa4b663c4f2b9dfeb0a1e0b8f32 (patch)
tree8a15272cb024651d24779bef34c43774ca619bfe /crypto/testmgr.c
parentcrypto: chacha20 - Add a generic ChaCha20 stream cipher implementation (diff)
downloadkernel-qcow2-linux-3590ebf2b4c40aa4b663c4f2b9dfeb0a1e0b8f32.tar.gz
kernel-qcow2-linux-3590ebf2b4c40aa4b663c4f2b9dfeb0a1e0b8f32.tar.xz
kernel-qcow2-linux-3590ebf2b4c40aa4b663c4f2b9dfeb0a1e0b8f32.zip
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>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 717d6f2d8b0f..abd09c2489fa 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2308,6 +2308,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,
.suite = {