Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DEPRECATED RSA_pkey_ctx_ctrl #1575

Merged
merged 3 commits into from
May 3, 2024
Merged
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
11 changes: 11 additions & 0 deletions crypto/fipsmodule/rsa/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,17 @@ void RSA_blinding_off_temp_for_accp_compatibility(RSA *rsa) {
}
}

int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2) {
if (ctx != NULL && ctx->pmeth != NULL) {
if (ctx->pmeth->pkey_id == EVP_PKEY_RSA ||
ctx->pmeth->pkey_id == EVP_PKEY_RSA_PSS) {
return EVP_PKEY_CTX_ctrl(ctx, -1, optype, cmd, p1, p2);
}
return -1;
}
return 0;
}

// ------------- KEY CHECKING FUNCTIONS ----------------
//
// Performs several checks on the public component of the given RSA key.
Expand Down
10 changes: 10 additions & 0 deletions include/openssl/rsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,16 @@ OPENSSL_EXPORT int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
// a private exponent having blinding disabled.
OPENSSL_EXPORT OPENSSL_DEPRECATED void RSA_blinding_off_temp_for_accp_compatibility(RSA *rsa);

// RSA_pkey_ctx_ctrl is a vestigial OpenSSL function that has been obsoleted by
// the EVP interface. External callers should not use this. Internal callers
// should use |EVP_PKEY_CTX_ctrl| instead.
//
// This function directly calls |EVP_PKEY_CTX_ctrl| with some guards around the
// key's type. The key type must either be RSA or RSA-PSS, otherwise -1 is
// returned.
OPENSSL_EXPORT OPENSSL_DEPRECATED int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd,
int p1, void *p2);

// RSA_generate_key behaves like |RSA_generate_key_ex|, which is what you
// should use instead. It returns NULL on error, or a newly-allocated |RSA| on
// success. This function is provided for compatibility only. The |callback|
Expand Down
Loading