aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorBoris BREZILLON <boris.brezillon@free-electrons.com>2015-06-16 05:46:46 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-10-15 09:05:01 -0400
commit8a826a34a52eef9ea1cb93f49ada358fa7b0bb32 (patch)
tree8b9050ea6aecbadc5010c1be476480223142c097 /crypto/testmgr.c
parentd6ba06b8b9a947a8385769f458611d3c97410226 (diff)
crypto: testmgr - test IV value after a cipher operation
The crypto drivers are supposed to update the IV passed to the crypto request before calling the completion callback. Test for the IV value before considering the test as successful. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 25032b0fd9ed..2037983c6405 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1034,12 +1034,22 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
1034 1034
1035 q = data; 1035 q = data;
1036 if (memcmp(q, template[i].result, template[i].rlen)) { 1036 if (memcmp(q, template[i].result, template[i].rlen)) {
1037 pr_err("alg: skcipher%s: Test %d failed on %s for %s\n", 1037 pr_err("alg: skcipher%s: Test %d failed (invalid result) on %s for %s\n",
1038 d, j, e, algo); 1038 d, j, e, algo);
1039 hexdump(q, template[i].rlen); 1039 hexdump(q, template[i].rlen);
1040 ret = -EINVAL; 1040 ret = -EINVAL;
1041 goto out; 1041 goto out;
1042 } 1042 }
1043
1044 if (template[i].iv_out &&
1045 memcmp(iv, template[i].iv_out,
1046 crypto_skcipher_ivsize(tfm))) {
1047 pr_err("alg: skcipher%s: Test %d failed (invalid output IV) on %s for %s\n",
1048 d, j, e, algo);
1049 hexdump(iv, crypto_skcipher_ivsize(tfm));
1050 ret = -EINVAL;
1051 goto out;
1052 }
1043 } 1053 }
1044 1054
1045 j = 0; 1055 j = 0;