From: Eric Biggers Date: Sun, 1 Dec 2019 21:53:27 +0000 (-0800) Subject: crypto: testmgr - check skcipher min_keysize X-Git-Tag: v5.6-rc1~152^2~185 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd60f727876467a89ac42c873e20b38d9a408062;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Herbert Xu --- diff --git a/crypto/testmgr.c b/crypto/testmgr.c index a8940415512fb..3d7c1c1529cf5 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,