summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2017-06-12 17:27:51 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-19 23:21:29 -0400
commit1207107c7168f779643c91e30f8d6c2f8a4afd4d (patch)
tree8c5816000a6f42bc78c93dd6637c47bdab29bf89 /crypto/testmgr.c
parentc4a29891161b7fd8666263b78918f051f8703424 (diff)
crypto: testmgr - add testvector for pkcs1pad(rsa)
The PKCS#1 RSA implementation is provided with a self test with RSA 2048 and SHA-256. This self test implicitly covers other RSA keys and other hashes. Also, this self test implies that the pkcs1pad(rsa) is FIPS 140-2 compliant. 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.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 127a0f545ec2..32087a7acbfb 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2222,8 +2222,11 @@ static int test_akcipher_one(struct crypto_akcipher *tfm,
2222 akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, 2222 akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
2223 tcrypt_complete, &result); 2223 tcrypt_complete, &result);
2224 2224
2225 /* Run RSA encrypt - c = m^e mod n;*/ 2225 err = wait_async_op(&result, vecs->siggen_sigver_test ?
2226 err = wait_async_op(&result, crypto_akcipher_encrypt(req)); 2226 /* Run asymmetric signature generation */
2227 crypto_akcipher_sign(req) :
2228 /* Run asymmetric encrypt */
2229 crypto_akcipher_encrypt(req));
2227 if (err) { 2230 if (err) {
2228 pr_err("alg: akcipher: encrypt test failed. err %d\n", err); 2231 pr_err("alg: akcipher: encrypt test failed. err %d\n", err);
2229 goto free_all; 2232 goto free_all;
@@ -2261,8 +2264,11 @@ static int test_akcipher_one(struct crypto_akcipher *tfm,
2261 init_completion(&result.completion); 2264 init_completion(&result.completion);
2262 akcipher_request_set_crypt(req, &src, &dst, vecs->c_size, out_len_max); 2265 akcipher_request_set_crypt(req, &src, &dst, vecs->c_size, out_len_max);
2263 2266
2264 /* Run RSA decrypt - m = c^d mod n;*/ 2267 err = wait_async_op(&result, vecs->siggen_sigver_test ?
2265 err = wait_async_op(&result, crypto_akcipher_decrypt(req)); 2268 /* Run asymmetric signature verification */
2269 crypto_akcipher_verify(req) :
2270 /* Run asymmetric decrypt */
2271 crypto_akcipher_decrypt(req));
2266 if (err) { 2272 if (err) {
2267 pr_err("alg: akcipher: decrypt test failed. err %d\n", err); 2273 pr_err("alg: akcipher: decrypt test failed. err %d\n", err);
2268 goto free_all; 2274 goto free_all;
@@ -3309,6 +3315,25 @@ static const struct alg_test_desc alg_test_descs[] = {
3309 } 3315 }
3310 } 3316 }
3311 }, { 3317 }, {
3318 .alg = "pkcs1pad(rsa,sha224)",
3319 .test = alg_test_null,
3320 .fips_allowed = 1,
3321 }, {
3322 .alg = "pkcs1pad(rsa,sha256)",
3323 .test = alg_test_akcipher,
3324 .fips_allowed = 1,
3325 .suite = {
3326 .akcipher = __VECS(pkcs1pad_rsa_tv_template)
3327 }
3328 }, {
3329 .alg = "pkcs1pad(rsa,sha384)",
3330 .test = alg_test_null,
3331 .fips_allowed = 1,
3332 }, {
3333 .alg = "pkcs1pad(rsa,sha512)",
3334 .test = alg_test_null,
3335 .fips_allowed = 1,
3336 }, {
3312 .alg = "poly1305", 3337 .alg = "poly1305",
3313 .test = alg_test_hash, 3338 .test = alg_test_hash,
3314 .suite = { 3339 .suite = {