diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index f8171986f02f24aaccf4fe88b26c8784a560183d..b5f0293fc082f01d2cfe4b55644ad441d45d1a35 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -400,3 +400,20 @@ void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, { ameth->pkey_param_check = pkey_param_check; } + +void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key) (EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)) +{ + ameth->set_priv_key = set_priv_key; +} + +void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key) (EVP_PKEY *pk, + const unsigned char *pub, + size_t len)) +{ + ameth->set_pub_key = set_pub_key; +} diff --git a/doc/man3/EVP_PKEY_ASN1_METHOD.pod b/doc/man3/EVP_PKEY_ASN1_METHOD.pod index cb03b473aaeef1037a0a14d2521b54abc531f8d9..9b635c480ef6c108f8f297c29deae2cf06cffdc5 100644 --- a/doc/man3/EVP_PKEY_ASN1_METHOD.pod +++ b/doc/man3/EVP_PKEY_ASN1_METHOD.pod @@ -19,6 +19,8 @@ EVP_PKEY_asn1_set_check, EVP_PKEY_asn1_set_public_check, EVP_PKEY_asn1_set_param_check, EVP_PKEY_asn1_set_security_bits, +EVP_PKEY_asn1_set_set_priv_key, +EVP_PKEY_asn1_set_set_pub_key, EVP_PKEY_get0_asn1 - manipulating and registering EVP_PKEY_ASN1_METHOD structure @@ -112,6 +114,17 @@ EVP_PKEY_get0_asn1 int (*pkey_security_bits) (const EVP_PKEY *pk)); + void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key) (EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)); + + void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key) (EVP_PKEY *pk, + const unsigned char *pub, + size_t len)); + const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); =head1 DESCRIPTION @@ -327,6 +340,14 @@ They MUST return 0 for an invalid key, or 1 for a valid key. They are called by L, L and L respectively. + int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len); + int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len); + +The set_priv_key() and set_pub_key() methods are used to set the raw private and +public key data for an EVP_PKEY. They MUST return 0 on error, or 1 on success. +They are called by L, and +L respectively. + =head2 Functions EVP_PKEY_asn1_new() creates and returns a new B @@ -368,8 +389,9 @@ EVP_PKEY_asn1_set_public(), EVP_PKEY_asn1_set_private(), EVP_PKEY_asn1_set_param(), EVP_PKEY_asn1_set_free(), EVP_PKEY_asn1_set_ctrl(), EVP_PKEY_asn1_set_item(), EVP_PKEY_asn1_set_siginf(), EVP_PKEY_asn1_set_check(), -EVP_PKEY_asn1_set_public_check(), EVP_PKEY_asn1_set_param_check() and -EVP_PKEY_asn1_set_security_bits() set the diverse methods of the given +EVP_PKEY_asn1_set_public_check(), EVP_PKEY_asn1_set_param_check(), +EVP_PKEY_asn1_set_security_bits(), EVP_PKEY_asn1_set_set_priv_key() and +EVP_PKEY_asn1_set_set_pub_key() set the diverse methods of the given B object. EVP_PKEY_get0_asn1() finds the B associated diff --git a/include/openssl/evp.h b/include/openssl/evp.h index e8d46286d00eca50173e9f982d005157652c9749..055f2b7df369f9fc5fde92afc16d5ae0e9285746 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -1230,6 +1230,16 @@ void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, int (*pkey_param_check) (const EVP_PKEY *pk)); +void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key) (EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)); +void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key) (EVP_PKEY *pk, + const unsigned char *pub, + size_t len)); + void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, int (*pkey_security_bits) (const EVP_PKEY *pk)); diff --git a/util/libcrypto.num b/util/libcrypto.num index b74ed2bec249ea44059486f36a8faf343371a6d4..1c6efc7fb6199d1c8decb5143ed0a831a17dbe19 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -4525,3 +4525,5 @@ RAND_DRBG_set_reseed_defaults 4466 1_1_1 EXIST::FUNCTION: EVP_PKEY_new_private_key 4467 1_1_1 EXIST::FUNCTION: EVP_PKEY_new_public_key 4468 1_1_1 EXIST::FUNCTION: EVP_PKEY_new_CMAC_key 4469 1_1_1 EXIST::FUNCTION: +EVP_PKEY_asn1_set_set_priv_key 4470 1_1_1 EXIST::FUNCTION: +EVP_PKEY_asn1_set_set_pub_key 4471 1_1_1 EXIST::FUNCTION: