EC_KEY_METHOD_NEW(3)
β¨ NAME β¨
Okay bestie, welcome to the EC_KEY_METHOD_NEW(3) page β it's giving custom EC_KEY implementations energy, periodt. The whole squad here is: EC_KEY_METHOD_new, EC_KEY_METHOD_free, EC_KEY_METHOD_set_init, EC_KEY_METHOD_get_init, EC_KEY_METHOD_set_sign, EC_KEY_METHOD_get_sign, EC_KEY_METHOD_set_verify, EC_KEY_METHOD_get_verify, EC_KEY_METHOD_set_keygen, EC_KEY_METHOD_get_keygen, EC_KEY_METHOD_set_compute_key, EC_KEY_METHOD_get_compute_key, EC_KEY_OpenSSL, EC_KEY_set_default_method, EC_KEY_get_default_method, EC_KEY_new_method, EC_KEY_set_method, and EC_KEY_get_method.
πΈ SYNOPSIS πΈ
Here's the exact signature situation, no cap:
#include <openssl/ec.h>
EC_KEY_METHOD *
EC_KEY_METHOD_new(const EC_KEY_METHOD *meth);
void
EC_KEY_METHOD_free(EC_KEY_METHOD *meth);
void
EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, int (*init)(EC_KEY *key),
void (*finish)(EC_KEY *key),
int (*copy)(EC_KEY *dest, const EC_KEY *src),
int (*set_group)(EC_KEY *key, const EC_GROUP *grp),
int (*set_private)(EC_KEY *key, const BIGNUM *priv_key),
int (*set_public)(EC_KEY *key, const EC_POINT *pub_key));
void
EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth,
int (**pinit)(EC_KEY *key), void (**pfinish)(EC_KEY *key),
int (**pcopy)(EC_KEY *dest, const EC_KEY *src),
int (**pset_group)(EC_KEY *key, const EC_GROUP *grp),
int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key),
int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key));
void
EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth,
int (*sign)(int type, const unsigned char *dgst, int dgstlen, unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey),
int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp),
ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, int dgstlen, const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey));
void
EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth,
int (**psign)(int type, const unsigned char *dgst, int dgstlen, unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey),
int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp),
ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, int dgstlen, const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey));
void
EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth,
int (*verify)(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
int (*verify_sig)(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, EC_KEY *eckey));
void
EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth,
int (**pverify)(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int sig_len, EC_KEY *eckey),
int (**pverify_sig)(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, EC_KEY *eckey));
void
EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth,
int (*keygen)(EC_KEY *key));
void
EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth,
int (**pkeygen)(EC_KEY *key));
void
EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth,
int (*ckey)(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen)));
void
EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth,
int (**pck)(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, void *(*KDF) (const void *in, size_t inlen, void *out, size_t *outlen)));
const EC_KEY_METHOD *
EC_KEY_OpenSSL(void);
void
EC_KEY_set_default_method(const EC_KEY_METHOD *meth);
const EC_KEY_METHOD *
EC_KEY_get_default_method(void);
EC_KEY *
EC_KEY_new_method(ENGINE *engine);
int
EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth);
const EC_KEY_METHOD *
EC_KEY_get_method(const EC_KEY *key);
π DESCRIPTION π
An EC_KEY_METHOD object holds function pointers used for EC_KEY operations. It's basically the main character that decides how the EC stuff gets done.
EC_KEY_METHOD_new() creates a shallow copy of meth, or an empty EC_KEY_METHOD object if meth is NULL. EC_KEY_METHOD_free() frees meth. If meth is NULL or the return value of EC_KEY_OpenSSL(), no action occurs β literally nothing happens, slay.
EC_KEY_METHOD_set_init() and EC_KEY_METHOD_get_init() set and retrieve optional callback functions called at these spots:
initβ at the end ofEC_KEY_new_method()andEC_KEY_set_method()finishβ at the beginning ofEC_KEY_free(3),EC_KEY_copy(3), andEC_KEY_set_method()copyβ at the end ofEC_KEY_copy(3)set_groupβ at the end ofEC_KEY_set_group(3)andEC_KEY_new_by_curve_name(3)set_privateβ at the beginning ofEC_KEY_set_private_key(3)set_publicβ at the beginning ofEC_KEY_set_public_key(3)
If any of these callbacks returns 0, the calling function fails. By default, all these callbacks are NULL. Arguments of EC_KEY_METHOD_get_init() can be set to NULL to selectively retrieve callback function pointers.
EC_KEY_METHOD_set_sign() and EC_KEY_METHOD_get_sign() set and retrieve the functions implementing ECDSA_sign(3) and ECDSA_do_sign(3).
EC_KEY_METHOD_set_verify() and EC_KEY_METHOD_get_verify() set and retrieve the functions implementing ECDSA_verify(3) and ECDSA_do_verify(3).
EC_KEY_METHOD_set_keygen() and EC_KEY_METHOD_get_keygen() set and retrieve the function implementing EC_KEY_generate_key(3).
EC_KEY_METHOD_set_compute_key() and EC_KEY_METHOD_get_compute_key() set and retrieve the function implementing ECDH_compute_key(3).
EC_KEY_set_default_method() chooses the meth to be used for the creation of new EC_KEY objects by future invocations of EC_KEY_new_method(), or reverts to the default implementation if meth is NULL.
EC_KEY_new_method() creates and initializes a new EC_KEY object using the EC_KEY_METHOD set with EC_KEY_set_default_method(). The ENGINE *engine argument is always ignored and passing NULL is recommended.
EC_KEY_set_method() dissociates the key from the ENGINE it is using, if any, and causes it to use meth in the future.
π¦ RETURN VALUES π¦
EC_KEY_METHOD_new()returns the newly allocatedEC_KEY_METHODobject orNULLif an error occurs.EC_KEY_OpenSSL()returns a static object representing the defaultEC_KEYimplementation.EC_KEY_get_default_method()returns theEC_KEY_METHODthatEC_KEY_new_method()will use for the creation of newEC_KEYobjects in the future.EC_KEY_new_method()returns the newly allocatedEC_KEYobject orNULLif an error occurs.EC_KEY_set_method()returns1for success or0for failure.EC_KEY_get_method()returns theEC_KEYimplementation used by the given key.
π SEE ALSO π
Go peek at these besties: EC_KEY_new(3), ECDSA_sign(3).
π HISTORY π
These functions first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.5. Iconic behavior, honestly.
Debian, July 21, 2024 β that's the source/version-date situation for the EC_KEY_METHOD_NEW(3) page. Mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms