Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RSA.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,11 +1296,12 @@ check_key(p_rsa)
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_pkey(NULL, p_rsa->rsa, NULL);
CHECK_OPEN_SSL(pctx);
RETVAL = (EVP_PKEY_private_check(pctx) == 1);
RETVAL = (EVP_PKEY_check(pctx) == 1);
EVP_PKEY_CTX_free(pctx);
#else
RETVAL = (RSA_check_key(p_rsa->rsa) == 1);
#endif
if (!RETVAL) ERR_clear_error();
OUTPUT:
RETVAL

Expand Down
2 changes: 1 addition & 1 deletion t/check_param.t
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ my ( $n, $e, $d, $p, $q ) = $rsa->get_key_parameters();
}

# 5. check_key() returns exactly 1, not just truthy
# OpenSSL's RSA_check_key/EVP_PKEY_private_check can return -1 on error,
# OpenSSL's RSA_check_key/EVP_PKEY_check can return -1 on error,
# which is truthy in Perl. The XS code must normalize to 0/1.
{
cmp_ok( $rsa->check_key(), '==', 1,
Expand Down
Loading