mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
5b18bcb0ac
commit
3a61cd34a9
@ -571,23 +571,25 @@ static void *thread_pki_rsa_generate_key(void *threadid)
|
|||||||
session = ssh_new();
|
session = ssh_new();
|
||||||
assert_non_null(session);
|
assert_non_null(session);
|
||||||
|
|
||||||
rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 1024, &key);
|
if (!ssh_fips_mode()) {
|
||||||
assert_ssh_return_code(session, rc);
|
rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 1024, &key);
|
||||||
assert_non_null(key);
|
assert_ssh_return_code(session, rc);
|
||||||
|
assert_non_null(key);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
||||||
assert_int_equal(rc, SSH_OK);
|
assert_int_equal(rc, SSH_OK);
|
||||||
assert_non_null(pubkey);
|
assert_non_null(pubkey);
|
||||||
|
|
||||||
sign = pki_do_sign(key, RSA_HASH, 20, SSH_DIGEST_SHA256);
|
sign = pki_do_sign(key, RSA_HASH, 20, SSH_DIGEST_SHA256);
|
||||||
assert_non_null(sign);
|
assert_non_null(sign);
|
||||||
|
|
||||||
rc = pki_signature_verify(session, sign, pubkey, RSA_HASH, 20);
|
rc = pki_signature_verify(session, sign, pubkey, RSA_HASH, 20);
|
||||||
assert_ssh_return_code(session, rc);
|
assert_ssh_return_code(session, rc);
|
||||||
|
|
||||||
ssh_signature_free(sign);
|
ssh_signature_free(sign);
|
||||||
SSH_KEY_FREE(key);
|
SSH_KEY_FREE(key);
|
||||||
SSH_KEY_FREE(pubkey);
|
SSH_KEY_FREE(pubkey);
|
||||||
|
}
|
||||||
|
|
||||||
rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 2048, &key);
|
rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 2048, &key);
|
||||||
assert_ssh_return_code(session, rc);
|
assert_ssh_return_code(session, rc);
|
||||||
|
Reference in New Issue
Block a user