summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2016-08-25 09:15:01 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-31 11:21:25 -0400
commit10faa8c0d6c3b22466f97713a9533824a2ea1c57 (patch)
tree3e6c48146665b6397a434d142cf1d2014d7fee68 /crypto/testmgr.c
parent93ba73fed31d0ec96489fedaeef1a1c402f9c8e4 (diff)
crypto: FIPS - allow tests to be disabled in FIPS mode
In FIPS mode, additional restrictions may apply. If these restrictions are violated, the kernel will panic(). This patch allows test vectors for symmetric ciphers to be marked as to be skipped in FIPS mode. Together with the patch, the XTS test vectors where the AES key is identical to the tweak key is disabled in FIPS mode. This test vector violates the FIPS requirement that both keys must be different. Reported-by: Tapas Sarangi <TSarangi@trustwave.com> Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index c2a8bd38ef1f..0b01c3d062e2 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1008,6 +1008,9 @@ static int test_cipher(struct crypto_cipher *tfm, int enc,
1008 if (template[i].np) 1008 if (template[i].np)
1009 continue; 1009 continue;
1010 1010
1011 if (fips_enabled && template[i].fips_skip)
1012 continue;
1013
1011 j++; 1014 j++;
1012 1015
1013 ret = -EINVAL; 1016 ret = -EINVAL;
@@ -1112,6 +1115,9 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
1112 if (template[i].np && !template[i].also_non_np) 1115 if (template[i].np && !template[i].also_non_np)
1113 continue; 1116 continue;
1114 1117
1118 if (fips_enabled && template[i].fips_skip)
1119 continue;
1120
1115 if (template[i].iv) 1121 if (template[i].iv)
1116 memcpy(iv, template[i].iv, ivsize); 1122 memcpy(iv, template[i].iv, ivsize);
1117 else 1123 else
@@ -1198,6 +1204,9 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
1198 if (!template[i].np) 1204 if (!template[i].np)
1199 continue; 1205 continue;
1200 1206
1207 if (fips_enabled && template[i].fips_skip)
1208 continue;
1209
1201 if (template[i].iv) 1210 if (template[i].iv)
1202 memcpy(iv, template[i].iv, ivsize); 1211 memcpy(iv, template[i].iv, ivsize);
1203 else 1212 else