diff options
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r-- | crypto/testmgr.c | 6 |
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); |