EVP_PKEY_METH_NEW(3ossl)
๐ the EVP_PKEY_METHOD core gossip ๐
okay bestie, welcome to the EVP_PKEY_METH_NEW(3ossl) manual page. it is literally about manipulating the EVP_PKEY_METHOD structure, and the whole squad is here. no cap. ๐
๐ธ NAME ๐ธ
the whole cast is huge and every single one is invited:
- lifecycle + registry icons:
EVP_PKEY_meth_new,EVP_PKEY_meth_free,EVP_PKEY_meth_copy,EVP_PKEY_meth_find,EVP_PKEY_meth_add0,EVP_PKEY_meth_remove - the type itself:
EVP_PKEY_METHOD - setters, because yes:
EVP_PKEY_meth_set_init,EVP_PKEY_meth_set_copy,EVP_PKEY_meth_set_cleanup,EVP_PKEY_meth_set_paramgen,EVP_PKEY_meth_set_keygen,EVP_PKEY_meth_set_sign,EVP_PKEY_meth_set_verify,EVP_PKEY_meth_set_verify_recover,EVP_PKEY_meth_set_signctx,EVP_PKEY_meth_set_verifyctx,EVP_PKEY_meth_set_encrypt,EVP_PKEY_meth_set_decrypt,EVP_PKEY_meth_set_derive,EVP_PKEY_meth_set_ctrl,EVP_PKEY_meth_set_digestsign,EVP_PKEY_meth_set_digestverify,EVP_PKEY_meth_set_check,EVP_PKEY_meth_set_public_check,EVP_PKEY_meth_set_param_check,EVP_PKEY_meth_set_digest_custom - getters, matching energy:
EVP_PKEY_meth_get_init,EVP_PKEY_meth_get_copy,EVP_PKEY_meth_get_cleanup,EVP_PKEY_meth_get_paramgen,EVP_PKEY_meth_get_keygen,EVP_PKEY_meth_get_sign,EVP_PKEY_meth_get_verify,EVP_PKEY_meth_get_verify_recover,EVP_PKEY_meth_get_signctx,EVP_PKEY_meth_get_verifyctx,EVP_PKEY_meth_get_encrypt,EVP_PKEY_meth_get_decrypt,EVP_PKEY_meth_get_derive,EVP_PKEY_meth_get_ctrl,EVP_PKEY_meth_get_digestsign,EVP_PKEY_meth_get_digestverify,EVP_PKEY_meth_get_check,EVP_PKEY_meth_get_public_check,EVP_PKEY_meth_get_param_check,EVP_PKEY_meth_get_digest_custom
โจ SYNOPSIS โจ
first, the include, obviously:
#include <openssl/evp.h>
โ ๏ธ huge heads up: The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by definingOPENSSL_API_COMPATwith a suitable version value, seeopenssl_user_macros(7):
the type is this icon right here:
typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
lifecycle + registry functions:
EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);
and now the setters, all of them, because we are not skipping a single one:
void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
int (*init) (EVP_PKEY_CTX *ctx));
void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
int (*copy) (EVP_PKEY_CTX *dst,
const EVP_PKEY_CTX *src));
void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
void (*cleanup) (EVP_PKEY_CTX *ctx));
void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
int (*paramgen_init) (EVP_PKEY_CTX *ctx),
int (*paramgen) (EVP_PKEY_CTX *ctx,
EVP_PKEY *pkey));
void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
int (*keygen_init) (EVP_PKEY_CTX *ctx),
int (*keygen) (EVP_PKEY_CTX *ctx,
EVP_PKEY *pkey));
void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
int (*sign_init) (EVP_PKEY_CTX *ctx),
int (*sign) (EVP_PKEY_CTX *ctx,
unsigned char *sig, size_t *siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
int (*verify_init) (EVP_PKEY_CTX *ctx),
int (*verify) (EVP_PKEY_CTX *ctx,
const unsigned char *sig,
size_t siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
int (*verify_recover_init) (EVP_PKEY_CTX
*ctx),
int (*verify_recover) (EVP_PKEY_CTX
*ctx,
unsigned char
*sig,
size_t *siglen,
const unsigned
char *tbs,
size_t tbslen));
void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
int (*signctx_init) (EVP_PKEY_CTX *ctx,
EVP_MD_CTX *mctx),
int (*signctx) (EVP_PKEY_CTX *ctx,
unsigned char *sig,
size_t *siglen,
EVP_MD_CTX *mctx));
void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
EVP_MD_CTX *mctx),
int (*verifyctx) (EVP_PKEY_CTX *ctx,
const unsigned char *sig,
int siglen,
EVP_MD_CTX *mctx));
void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
int (*encrypt_init) (EVP_PKEY_CTX *ctx),
int (*encryptfn) (EVP_PKEY_CTX *ctx,
unsigned char *out,
size_t *outlen,
const unsigned char *in,
size_t inlen));
void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
int (*decrypt_init) (EVP_PKEY_CTX *ctx),
int (*decrypt) (EVP_PKEY_CTX *ctx,
unsigned char *out,
size_t *outlen,
const unsigned char *in,
size_t inlen));
void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
int (*derive_init) (EVP_PKEY_CTX *ctx),
int (*derive) (EVP_PKEY_CTX *ctx,
unsigned char *key,
size_t *keylen));
void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
void *p2),
int (*ctrl_str) (EVP_PKEY_CTX *ctx,
const char *type,
const char *value));
void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth,
int (*digestsign) (EVP_MD_CTX *ctx,
unsigned char *sig,
size_t *siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth,
int (*digestverify) (EVP_MD_CTX *ctx,
const unsigned char *sig,
size_t siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth,
int (*check) (EVP_PKEY *pkey));
void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth,
int (*check) (EVP_PKEY *pkey));
void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth,
int (*check) (EVP_PKEY *pkey));
void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth,
int (*digest_custom) (EVP_PKEY_CTX *ctx,
EVP_MD_CTX *mctx));
void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth,
int (**pinit) (EVP_PKEY_CTX *ctx));
void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth,
int (**pcopy) (EVP_PKEY_CTX *dst,
EVP_PKEY_CTX *src));
void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth,
void (**pcleanup) (EVP_PKEY_CTX *ctx));
void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth,
int (**pparamgen_init) (EVP_PKEY_CTX *ctx),
int (**pparamgen) (EVP_PKEY_CTX *ctx,
EVP_PKEY *pkey));
void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth,
int (**pkeygen_init) (EVP_PKEY_CTX *ctx),
int (**pkeygen) (EVP_PKEY_CTX *ctx,
EVP_PKEY *pkey));
void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth,
int (**psign_init) (EVP_PKEY_CTX *ctx),
int (**psign) (EVP_PKEY_CTX *ctx,
unsigned char *sig, size_t *siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth,
int (**pverify_init) (EVP_PKEY_CTX *ctx),
int (**pverify) (EVP_PKEY_CTX *ctx,
const unsigned char *sig,
size_t siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth,
int (**pverify_recover_init) (EVP_PKEY_CTX
*ctx),
int (**pverify_recover) (EVP_PKEY_CTX
*ctx,
unsigned char
*sig,
size_t *siglen,
const unsigned
char *tbs,
size_t tbslen));
void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth,
int (**psignctx_init) (EVP_PKEY_CTX *ctx,
EVP_MD_CTX *mctx),
int (**psignctx) (EVP_PKEY_CTX *ctx,
unsigned char *sig,
size_t *siglen,
EVP_MD_CTX *mctx));
void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth,
int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,
EVP_MD_CTX *mctx),
int (**pverifyctx) (EVP_PKEY_CTX *ctx,
const unsigned char *sig,
int siglen,
EVP_MD_CTX *mctx));
void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth,
int (**pencrypt_init) (EVP_PKEY_CTX *ctx),
int (**pencryptfn) (EVP_PKEY_CTX *ctx,
unsigned char *out,
size_t *outlen,
const unsigned char *in,
size_t inlen));
void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth,
int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
int (**pdecrypt) (EVP_PKEY_CTX *ctx,
unsigned char *out,
size_t *outlen,
const unsigned char *in,
size_t inlen));
void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth,
int (**pderive_init) (EVP_PKEY_CTX *ctx),
int (**pderive) (EVP_PKEY_CTX *ctx,
unsigned char *key,
size_t *keylen));
void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth,
int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
void *p2),
int (**pctrl_str) (EVP_PKEY_CTX *ctx,
const char *type,
const char *value));
void EVP_PKEY_meth_get_digestsign(const EVP_PKEY_METHOD *pmeth,
int (**digestsign) (EVP_MD_CTX *ctx,
unsigned char *sig,
size_t *siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_get_digestverify(const EVP_PKEY_METHOD *pmeth,
int (**digestverify) (EVP_MD_CTX *ctx,
const unsigned char *sig,
size_t siglen,
const unsigned char *tbs,
size_t tbslen));
void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth,
int (**pcheck) (EVP_PKEY *pkey));
void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth,
int (**pcheck) (EVP_PKEY *pkey));
void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth,
int (**pcheck) (EVP_PKEY *pkey));
void EVP_PKEY_meth_get_digest_custom(const EVP_PKEY_METHOD *pmeth,
int (**pdigest_custom) (EVP_PKEY_CTX *ctx,
EVP_MD_CTX *mctx));
okay okay breathe bestie ๐ฎโ๐จ that was a lot of prototypes and we ate every single one. notice the pattern tho? every one of these is an EVP_PKEY_meth_get_ function, and every single one takes a const EVP_PKEY_METHOD *pmeth first and then a pointer-to-a-function-pointer (or two, for the pairs) as an out-param. the names literally spell out what slot you're grabbing the pointer for, iykyk ๐
let's just vibe-check the families so nothing feels random:
EVP_PKEY_meth_get_init,EVP_PKEY_meth_get_copy,EVP_PKEY_meth_get_cleanupโ the setup / dupe / teardown trio ๐ (andpcleanupis avoidreturn, everyone else over here isint)EVP_PKEY_meth_get_paramgenandEVP_PKEY_meth_get_keygenโ each hands you back two pointers: the*_initone and the actual worker one ๐ฆEVP_PKEY_meth_get_sign,EVP_PKEY_meth_get_verify,EVP_PKEY_meth_get_verify_recoverโ the classic sign/verify gang, all takingconst unsigned char *tbsandsize_t tbslen, andpverifytakessize_t siglenwhilepverifyctxdown below takes a plainint siglen(yes really, look at it ๐)EVP_PKEY_meth_get_signctxandEVP_PKEY_meth_get_verifyctxโ same energy but they drag anEVP_MD_CTX *mctxalong for the rideEVP_PKEY_meth_get_encryptandEVP_PKEY_meth_get_decryptโunsigned char *out,size_t *outlen,const unsigned char *in,size_t inlen. notepencryptfnhas thefnsuffix while its init ispencrypt_init, don't ask me why, that's just her name ๐คทโโ๏ธEVP_PKEY_meth_get_deriveโ gives youpderive_initandpderive, working overunsigned char *key/size_t *keylenEVP_PKEY_meth_get_ctrlโ the weird one, two flavours:pctrl(theint type, int p1, void *p2classic) andpctrl_str(theconst char *type, const char *valueversion). main character energy honestly ๐ฅEVP_PKEY_meth_get_digestsignandEVP_PKEY_meth_get_digestverifyโ note these take anEVP_MD_CTX *ctxfirst instead of anEVP_PKEY_CTX *, and there's no_initpointer pair here, just the one ๐ซถEVP_PKEY_meth_get_check,EVP_PKEY_meth_get_public_check,EVP_PKEY_meth_get_param_checkโ three lil checkers, allint (**pcheck) (EVP_PKEY *pkey), and yes the parameter is literally calledpcheckin all three so keep your eyes open ๐EVP_PKEY_meth_get_digest_customโ last but not least,int (**pdigest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
and that's the entire synopsis, fr fr โ nothing skipped, nothing merged, every prototype exactly where she belongs โจ next up we get into what all this actually means, and bestie it's a journey ๐
๐ DESCRIPTION ๐
okay so real talk first, bestie: all of the functions described on this page are deprecated ๐ญ. Like, every single one. Applications should instead use the OSSL_PROVIDER APIs. I know, I know โ we're still gonna learn it because the lore matters ๐.
EVP_PKEY_METHOD is a structure that holds a set of methods for a specific public key cryptographic algorithm. Those methods are usually used to do different jobs, like generating a key, signing or verifying, encrypting or decrypting, etc. It's giving "one struct, many talents" โจ.
There are two places where the EVP_PKEY_METHOD objects are stored: one is a built-in static array representing the standard methods for different algorithms, and the other one is a stack of user-defined application-specific methods, which can be manipulated by using EVP_PKEY_meth_add0(3). Two homes, same vibe ๐ .
The EVP_PKEY_METHOD objects are usually referenced by EVP_PKEY_CTX objects. iykyk ๐ซถ.
๐ง Methods ๐ง
The methods are the underlying implementations of a particular public key algorithm present by the EVP_PKEY_CTX object.
int (*init) (EVP_PKEY_CTX *ctx);
int (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);
void (*cleanup) (EVP_PKEY_CTX *ctx);
The init() method is called to initialize algorithm-specific data when a new EVP_PKEY_CTX is created. As opposed to init(), the cleanup() method is called when an EVP_PKEY_CTX is freed. The copy() method is called when an EVP_PKEY_CTX is being duplicated. Refer to EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_new_id(3), EVP_PKEY_CTX_free(3) and EVP_PKEY_CTX_dup(3) ๐.
int (*paramgen_init) (EVP_PKEY_CTX *ctx);
int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
The paramgen_init() and paramgen() methods deal with key parameter generation. They are called by EVP_PKEY_paramgen_init(3) and EVP_PKEY_paramgen(3) to handle the parameter generation process. parameter generation girlies rise ๐ธ.
int (*keygen_init) (EVP_PKEY_CTX *ctx);
int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
The keygen_init() and keygen() methods are used to generate the actual key for the specified algorithm. They are called by EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3). actual key generation, not just talking about it ๐ฅ.
int (*sign_init) (EVP_PKEY_CTX *ctx);
int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
const unsigned char *tbs, size_t tbslen);
The sign_init() and sign() methods are used to generate the signature of a piece of data using a private key. They are called by EVP_PKEY_sign_init(3) and EVP_PKEY_sign(3) โจ.
int (*verify_init) (EVP_PKEY_CTX *ctx);
int (*verify) (EVP_PKEY_CTX *ctx,
const unsigned char *sig, size_t siglen,
const unsigned char *tbs, size_t tbslen);
The verify_init() and verify() methods are used to verify whether a signature is valid. They are called by EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3). vibe check but for signatures ๐
.
int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
int (*verify_recover) (EVP_PKEY_CTX *ctx,
unsigned char *rout, size_t *routlen,
const unsigned char *sig, size_t siglen);
The verify_recover_init() and verify_recover() methods are used to verify a signature and then recover the digest from the signature (for instance, a signature that was generated by RSA signing algorithm). They are called by EVP_PKEY_verify_recover_init(3) and EVP_PKEY_verify_recover(3). verify and recover? multitasking icon behavior ๐.
int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
EVP_MD_CTX *mctx);
The signctx_init() and signctx() methods are used to sign a digest present by a EVP_MD_CTX object. They are called by the EVP_DigestSign functions. See EVP_DigestSignInit(3) for details ๐ฆ.
int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
EVP_MD_CTX *mctx);
The verifyctx_init() and verifyctx() methods are used to verify a signature against the data in a EVP_MD_CTX object. They are called by the various EVP_DigestVerify functions. See EVP_DigestVerifyInit(3) for details ๐.
int (*encrypt_init) (EVP_PKEY_CTX *ctx);
int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen);
The encrypt_init() and encrypt() methods are used to encrypt a piece of data. They are called by EVP_PKEY_encrypt_init(3) and EVP_PKEY_encrypt(3) ๐.
int (*decrypt_init) (EVP_PKEY_CTX *ctx);
int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen);
The decrypt_init() and decrypt() methods are used to decrypt a piece of data. They are called by EVP_PKEY_decrypt_init(3) and EVP_PKEY_decrypt(3) ๐.
int (*derive_init) (EVP_PKEY_CTX *ctx);
int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
The derive_init() and derive() methods are used to derive the shared secret from a public key algorithm (for instance, the DH algorithm). They are called by EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3). shared secret? we love a collaborative moment ๐ค.
int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
The ctrl() and ctrl_str() methods are used to adjust algorithm-specific settings. See EVP_PKEY_CTX_ctrl(3) and related functions for details ๐๏ธ.
int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
const unsigned char *tbs, size_t tbslen);
int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
size_t siglen, const unsigned char *tbs,
size_t tbslen);
The digestsign() and digestverify() methods are used to generate or verify a signature in a one-shot mode. They could be called by EVP_DigestSign(3) and EVP_DigestVerify(3) โญ.
int (*check) (EVP_PKEY *pkey);
int (*public_check) (EVP_PKEY *pkey);
int (*param_check) (EVP_PKEY *pkey);
The check(), public_check() and param_check() methods are used to validate a key-pair, the public component and parameters respectively for a given pkey. They could be called by EVP_PKEY_check(3), EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) respectively ๐.
int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
The digest_custom() method is used to generate customized digest content before the real message is passed to functions like EVP_DigestSignUpdate(3) or EVP_DigestVerifyInit(3). This is usually required by some public key signature algorithms like SM2 which requires a hashed prefix to the message to be signed. The digest_custom() function will be called by EVP_DigestSignInit(3) and EVP_DigestVerifyInit(3) ๐ง.
๐ Functions ๐
EVP_PKEY_meth_new() creates and returns a new EVP_PKEY_METHOD object, and associates the given id and flags. The following flags are supported:
EVP_PKEY_FLAG_AUTOARGLENEVP_PKEY_FLAG_SIGCTX_CUSTOM
If an EVP_PKEY_METHOD is set with the EVP_PKEY_FLAG_AUTOARGLEN flag, the maximum size of the output buffer will be automatically calculated or checked in corresponding EVP methods by the EVP framework. Thus the implementations of these methods don't need to care about handling the case of returning output buffer size by themselves. For details on the output buffer size, refer to EVP_PKEY_sign(3) ๐.
The EVP_PKEY_FLAG_SIGCTX_CUSTOM is used to indicate the signctx() method of an EVP_PKEY_METHOD is always called by the EVP framework while doing a digest signing operation by calling EVP_DigestSignFinal(3) ๐ซก.
EVP_PKEY_meth_free() frees an existing EVP_PKEY_METHOD pointed by pmeth. If the argument is NULL, nothing is done. polite cleanup behavior, we stan ๐งน.
EVP_PKEY_meth_copy() copies an EVP_PKEY_METHOD object from src to dst ๐ฏ.
EVP_PKEY_meth_find() finds an EVP_PKEY_METHOD object with the id. This function first searches through the user-defined method objects and then the built-in objects. user-defined first, built-in second โ order matters bestie ๐.
EVP_PKEY_meth_add0() adds pmeth to the user defined stack of methods โ.
EVP_PKEY_meth_remove() removes an EVP_PKEY_METHOD object added by EVP_PKEY_meth_add0() โ.
The EVP_PKEY_meth_set functions set the corresponding fields of EVP_PKEY_METHOD structure with the arguments passed ๐ ๏ธ.
The EVP_PKEY_meth_get functions get the corresponding fields of EVP_PKEY_METHOD structure to the arguments provided ๐ค.
โจ RETURN VALUES โจ
EVP_PKEY_meth_new()returns a pointer to a newEVP_PKEY_METHODobject or returnsNULLon error ๐ญ.EVP_PKEY_meth_free()andEVP_PKEY_meth_copy()do not return values.EVP_PKEY_meth_find()returns a pointer to the foundEVP_PKEY_METHODobject or returnsNULLif not found ๐.EVP_PKEY_meth_add0()returns1if method is added successfully or0if an error occurred.EVP_PKEY_meth_remove()returns1if method is removed successfully or0if an error occurred.- All
EVP_PKEY_meth_setandEVP_PKEY_meth_getfunctions have no return values. For the 'get' functions, function pointers are returned by arguments ๐.
๐ฆ HISTORY ๐ฆ
All of these functions were deprecated in OpenSSL 3.0. yeah, the whole crew ๐ญ.
The signature of the copy functional argument of EVP_PKEY_meth_set_copy() has changed in OpenSSL 3.0 so its src parameter is now constified. glow-up but make it const โจ.
๐ COPYRIGHT ๐
Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
xoxo, bestie ๐ this page is EVP_PKEY_METH_NEW(3ossl), from the OpenSSL 3.5.6 source drop, dated 2026-04-07. go be iconic with your provider APIs now ๐๐ฆ๐ธ
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms