summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2019-07-30 18:22:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-08-06 16:57:19 +0200
commit3a61cd34a90d758262d63ecb01a0cc65d0abe90e (patch)
tree8b704d07c4509dfeee4d94b3a0cbdcb65fe82d94
parent5b18bcb0ac39c3c366dd769e893af381ddb5deb2 (diff)
downloadlibssh-3a61cd34a90d758262d63ecb01a0cc65d0abe90e.tar.gz
libssh-3a61cd34a90d758262d63ecb01a0cc65d0abe90e.tar.xz
libssh-3a61cd34a90d758262d63ecb01a0cc65d0abe90e.zip
tests: Skip testing 1024 bits key generation in FIPS mode
In torture_threads_pki_rsa, skip the test which generates 1024 bits RSA key pair when in FIPS mode. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--tests/unittests/torture_threads_pki_rsa.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/unittests/torture_threads_pki_rsa.c b/tests/unittests/torture_threads_pki_rsa.c
index 5a841ee9..03d526cd 100644
--- a/tests/unittests/torture_threads_pki_rsa.c
+++ b/tests/unittests/torture_threads_pki_rsa.c
@@ -571,23 +571,25 @@ static void *thread_pki_rsa_generate_key(void *threadid)
session = ssh_new();
assert_non_null(session);
- rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 1024, &key);
- assert_ssh_return_code(session, rc);
- assert_non_null(key);
+ if (!ssh_fips_mode()) {
+ rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 1024, &key);
+ assert_ssh_return_code(session, rc);
+ assert_non_null(key);
- rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
- assert_int_equal(rc, SSH_OK);
- assert_non_null(pubkey);
+ rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
+ assert_int_equal(rc, SSH_OK);
+ assert_non_null(pubkey);
- sign = pki_do_sign(key, RSA_HASH, 20, SSH_DIGEST_SHA256);
- assert_non_null(sign);
+ sign = pki_do_sign(key, RSA_HASH, 20, SSH_DIGEST_SHA256);
+ assert_non_null(sign);
- rc = pki_signature_verify(session, sign, pubkey, RSA_HASH, 20);
- assert_ssh_return_code(session, rc);
+ rc = pki_signature_verify(session, sign, pubkey, RSA_HASH, 20);
+ assert_ssh_return_code(session, rc);
- ssh_signature_free(sign);
- SSH_KEY_FREE(key);
- SSH_KEY_FREE(pubkey);
+ ssh_signature_free(sign);
+ SSH_KEY_FREE(key);
+ SSH_KEY_FREE(pubkey);
+ }
rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 2048, &key);
assert_ssh_return_code(session, rc);