diff options
author | Eric Biggers <ebiggers@google.com> | 2019-12-01 13:53:27 -0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-12-11 16:37:01 +0800 |
commit | fd60f727876467a89ac42c873e20b38d9a408062 (patch) | |
tree | 0ae82d9067168502f35f0ae9228ff38d827b9ab8 /crypto/testmgr.c | |
parent | eb455dbd02cb1074b37872ffca30a81cb2a18eaa (diff) | |
download | linux-fd60f727876467a89ac42c873e20b38d9a408062.tar.gz linux-fd60f727876467a89ac42c873e20b38d9a408062.tar.bz2 linux-fd60f727876467a89ac42c873e20b38d9a408062.zip |
crypto: testmgr - check skcipher min_keysize
When checking two implementations of the same skcipher algorithm for
consistency, require that the minimum key size be the same, not just the
maximum key size. There's no good reason to allow different minimum key
sizes.
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.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index a8940415512f..3d7c1c1529cf 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2764,6 +2764,15 @@ static int test_skcipher_vs_generic_impl(const char *driver, /* Check the algorithm properties for consistency. */ + if (crypto_skcipher_min_keysize(tfm) != + crypto_skcipher_min_keysize(generic_tfm)) { + pr_err("alg: skcipher: min keysize for %s (%u) doesn't match generic impl (%u)\n", + driver, crypto_skcipher_min_keysize(tfm), + crypto_skcipher_min_keysize(generic_tfm)); + err = -EINVAL; + goto out; + } + if (maxkeysize != crypto_skcipher_max_keysize(generic_tfm)) { pr_err("alg: skcipher: max keysize for %s (%u) doesn't match generic impl (%u)\n", driver, maxkeysize, |