Skip to content

Commit

Permalink
Avoid calling RSA_check_key after key generation since it's redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhosv committed Apr 4, 2024
1 parent d52c398 commit 8ca5819
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion csrc/keyutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ class raii_cipher_ctx {

const EVP_MD* digestFromJstring(raii_env& env, jstring digestName);

// The generated RSA structure will own n and d.
// The generated RSA structure will own n and d. The generated private key has blinding disabled since for blinding, one
// needs the public exponent.
RSA* RSA_new_private_key_no_e(BIGNUM* n, BIGNUM* d);

}
Expand Down
4 changes: 0 additions & 4 deletions csrc/rsa_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ JNIEXPORT jlong JNICALL Java_com_amazon_corretto_crypto_provider_RsaGen_generate
if (RSA_generate_key_ex(r, bits, bne, NULL) != 1) {
throw_openssl("Unable to generate key");
}

if (checkConsistency && RSA_check_key(r) != 1) {
throw_openssl("Key failed consistency check");
}
}

EVP_PKEY_auto result = EVP_PKEY_auto::from(EVP_PKEY_new());
Expand Down

0 comments on commit 8ca5819

Please sign in to comment.