Skip to content

Commit

Permalink
EVP_PKEY_get0 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Aug 7, 2024
1 parent 5fd0f08 commit 05ee1d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions crypto/ecdh_extra/ecdh_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ static void RunWycheproofTest(FileTest *t) {
}
EC_KEY *peer_ec = EVP_PKEY_get0_EC_KEY(peer_evp.get());
ASSERT_TRUE(peer_ec);
ASSERT_EQ(peer_ec, EVP_PKEY_get0(peer_evp.get()));

bssl::UniquePtr<EC_KEY> key(EC_KEY_new());
ASSERT_TRUE(key);
Expand Down
1 change: 1 addition & 0 deletions crypto/evp_extra/evp_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ static void RunWycheproofVerifyTest(const char *path) {
if (EVP_PKEY_id(key.get()) == EVP_PKEY_DSA) {
// DSA is deprecated and is not usable via EVP.
DSA *dsa = EVP_PKEY_get0_DSA(key.get());
ASSERT_EQ(dsa, EVP_PKEY_get0(key.get()));
uint8_t digest[EVP_MAX_MD_SIZE];
unsigned digest_len;
ASSERT_TRUE(
Expand Down
11 changes: 5 additions & 6 deletions crypto/fipsmodule/evp/evp.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,11 @@ int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **out_md) {
}

void *EVP_PKEY_get0(const EVP_PKEY *pkey) {
// Node references, but never calls this function, so for now we return NULL.
// If other projects require complete support, call |EVP_PKEY_get0_RSA|, etc.,
// rather than reading |pkey->pkey.ptr| directly. This avoids problems if our
// internal representation does not match the type the caller expects from
// OpenSSL.
return NULL;
GUARD_PTR(pkey);
if (pkey->type == EVP_PKEY_NONE) {
return NULL;
}
return pkey->pkey.ptr;
}

void OpenSSL_add_all_algorithms(void) {}
Expand Down

0 comments on commit 05ee1d6

Please sign in to comment.