summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-01-19 01:48:00 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2019-01-25 05:41:52 -0500
commit231baecdef7a906579925ccf1bd45aa734f32320 (patch)
treed445c32fbb19c327331c8cc3d254d72a96ffa919 /crypto/testmgr.c
parent37ebffff65b2321a9b51ae928851330154358f1d (diff)
crypto: clarify name of WEAK_KEY request flag
CRYPTO_TFM_REQ_WEAK_KEY confuses newcomers to the crypto API because it sounds like it is requesting a weak key. Actually, it is requesting that weak keys be forbidden (for algorithms that have the notion of "weak keys"; currently only DES and XTS do). Also it is only one letter away from CRYPTO_TFM_RES_WEAK_KEY, with which it can be easily confused. (This in fact happened in the UX500 driver, though just in some debugging messages.) Therefore, make the intent clear by renaming it to CRYPTO_TFM_REQ_FORBID_WEAK_KEYS. 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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index e4f3f5f688e7..4ac3d22256c3 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -706,7 +706,8 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
706 706
707 crypto_aead_clear_flags(tfm, ~0); 707 crypto_aead_clear_flags(tfm, ~0);
708 if (template[i].wk) 708 if (template[i].wk)
709 crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); 709 crypto_aead_set_flags(tfm,
710 CRYPTO_TFM_REQ_FORBID_WEAK_KEYS);
710 711
711 if (template[i].klen > MAX_KEYLEN) { 712 if (template[i].klen > MAX_KEYLEN) {
712 pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n", 713 pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n",
@@ -820,7 +821,8 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
820 821
821 crypto_aead_clear_flags(tfm, ~0); 822 crypto_aead_clear_flags(tfm, ~0);
822 if (template[i].wk) 823 if (template[i].wk)
823 crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); 824 crypto_aead_set_flags(tfm,
825 CRYPTO_TFM_REQ_FORBID_WEAK_KEYS);
824 if (template[i].klen > MAX_KEYLEN) { 826 if (template[i].klen > MAX_KEYLEN) {
825 pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n", 827 pr_err("alg: aead%s: setkey failed on test %d for %s: key size %d > %d\n",
826 d, j, algo, template[i].klen, MAX_KEYLEN); 828 d, j, algo, template[i].klen, MAX_KEYLEN);
@@ -1078,7 +1080,7 @@ static int test_cipher(struct crypto_cipher *tfm, int enc,
1078 1080
1079 crypto_cipher_clear_flags(tfm, ~0); 1081 crypto_cipher_clear_flags(tfm, ~0);
1080 if (template[i].wk) 1082 if (template[i].wk)
1081 crypto_cipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); 1083 crypto_cipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS);
1082 1084
1083 ret = crypto_cipher_setkey(tfm, template[i].key, 1085 ret = crypto_cipher_setkey(tfm, template[i].key,
1084 template[i].klen); 1086 template[i].klen);
@@ -1194,8 +1196,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
1194 1196
1195 crypto_skcipher_clear_flags(tfm, ~0); 1197 crypto_skcipher_clear_flags(tfm, ~0);
1196 if (template[i].wk) 1198 if (template[i].wk)
1197 crypto_skcipher_set_flags(tfm, 1199 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS);
1198 CRYPTO_TFM_REQ_WEAK_KEY);
1199 1200
1200 ret = crypto_skcipher_setkey(tfm, template[i].key, 1201 ret = crypto_skcipher_setkey(tfm, template[i].key,
1201 template[i].klen); 1202 template[i].klen);
@@ -1265,8 +1266,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
1265 j++; 1266 j++;
1266 crypto_skcipher_clear_flags(tfm, ~0); 1267 crypto_skcipher_clear_flags(tfm, ~0);
1267 if (template[i].wk) 1268 if (template[i].wk)
1268 crypto_skcipher_set_flags(tfm, 1269 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS);
1269 CRYPTO_TFM_REQ_WEAK_KEY);
1270 1270
1271 ret = crypto_skcipher_setkey(tfm, template[i].key, 1271 ret = crypto_skcipher_setkey(tfm, template[i].key,
1272 template[i].klen); 1272 template[i].klen);