summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-02-14 03:03:51 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2019-02-21 23:47:27 -0500
commit8efd972ef96a3f77ded9a838005d49efa9a96243 (patch)
tree0279da489d21a11db4895e5f630918054243de2d /crypto/testmgr.c
parentc9e1d48a1122ef1d0f753cbbe6e9a309214b5430 (diff)
crypto: testmgr - support checking skcipher output IV
Allow skcipher test vectors to declare the value the IV buffer should be updated to at the end of the encryption or decryption operation. (This check actually used to be supported in testmgr, but it was never used and therefore got removed except for the AES-Keywrap special case. But it will be used by CBC and CTR now, so re-add it.) Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index d582a2758feb..8386038d67c7 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1542,7 +1542,9 @@ static int test_skcipher_vec_cfg(const char *driver, int enc,
1542 if (ivsize) { 1542 if (ivsize) {
1543 if (WARN_ON(ivsize > MAX_IVLEN)) 1543 if (WARN_ON(ivsize > MAX_IVLEN))
1544 return -EINVAL; 1544 return -EINVAL;
1545 if (vec->iv && !(vec->generates_iv && enc)) 1545 if (vec->generates_iv && !enc)
1546 memcpy(iv, vec->iv_out, ivsize);
1547 else if (vec->iv)
1546 memcpy(iv, vec->iv, ivsize); 1548 memcpy(iv, vec->iv, ivsize);
1547 else 1549 else
1548 memset(iv, 0, ivsize); 1550 memset(iv, 0, ivsize);
@@ -1635,7 +1637,7 @@ static int test_skcipher_vec_cfg(const char *driver, int enc,
1635 } 1637 }
1636 1638
1637 /* If applicable, check that the algorithm generated the correct IV */ 1639 /* If applicable, check that the algorithm generated the correct IV */
1638 if (vec->generates_iv && enc && memcmp(iv, vec->iv, ivsize) != 0) { 1640 if (vec->iv_out && memcmp(iv, vec->iv_out, ivsize) != 0) {
1639 pr_err("alg: skcipher: %s %s test failed (wrong output IV) on test vector %u, cfg=\"%s\"\n", 1641 pr_err("alg: skcipher: %s %s test failed (wrong output IV) on test vector %u, cfg=\"%s\"\n",
1640 driver, op, vec_num, cfg->name); 1642 driver, op, vec_num, cfg->name);
1641 hexdump(iv, ivsize); 1643 hexdump(iv, ivsize);