Skip to content

Commit

Permalink
crypto: testmgr - check skcipher min_keysize
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
ebiggers authored and herbertx committed Dec 11, 2019
1 parent eb455db commit fd60f72
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crypto/testmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fd60f72

Please sign in to comment.