Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Aug 15, 2024
1 parent 3d47485 commit f88c7c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions crypto/fipsmodule/evp/evp.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,15 @@ int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **out_md) {
void *EVP_PKEY_get0(const EVP_PKEY *pkey) {
SET_DIT_AUTO_DISABLE;
GUARD_PTR(pkey);
if (pkey->type == EVP_PKEY_NONE) {
return NULL;
switch (pkey->type) {
case EVP_PKEY_RSA:
case EVP_PKEY_RSA_PSS:
case EVP_PKEY_DSA:
case EVP_PKEY_EC:
return pkey->pkey.ptr;
default:
return NULL;
}
return pkey->pkey.ptr;
}

void OpenSSL_add_all_algorithms(void) {}
Expand Down
10 changes: 7 additions & 3 deletions include/openssl/evp.h
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,9 @@ OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_kem_new_raw_key(int nid,
// to the secret key in |key|.
OPENSSL_EXPORT int EVP_PKEY_kem_check_key(EVP_PKEY *key);

// EVP_PKEY_get0_KEM_KEY returns a non-owning pointer to the contained KEM_KEY.
OPENSSL_EXPORT KEM_KEY *EVP_PKEY_get0_KEM_KEY(const EVP_PKEY *pkey);

// Deprecated functions.

// EVP_PKEY_RSA2 was historically an alternate form for RSA public keys (OID
Expand Down Expand Up @@ -1144,12 +1147,13 @@ OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *engine,

// Deprecated functions

// EVP_PKEY_get0 returns the consumed key. The type of value returned differs
// depending on the type of the |EVP_PKEY|.
// EVP_PKEY_get0 returns the consumed key. The type of value returned will be
// one of the following, depending on the type of the |EVP_PKEY|:
// |RSA|, |DSA| or |EC_KEY|.
//
// This function is provided only for compatibility with OpenSSL.
// Prefer the use the typed |EVP_PKEY_get0_*| functions instead.
OPENSSL_EXPORT OPENSSL_DEPRECATED void *EVP_PKEY_get0(const EVP_PKEY *pkey);
OPENSSL_EXPORT OPENSSL_DEPRECATED void *EVP_PKEY_get0(EVP_PKEY *pkey);

// General No-op Functions [Deprecated].

Expand Down

0 comments on commit f88c7c8

Please sign in to comment.