EVP_PKEY_meth_new.pod 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY_meth_new, EVP_PKEY_meth_free, EVP_PKEY_meth_copy, EVP_PKEY_meth_find,
  4. EVP_PKEY_meth_add0, EVP_PKEY_METHOD,
  5. EVP_PKEY_meth_set_init, EVP_PKEY_meth_set_copy, EVP_PKEY_meth_set_cleanup,
  6. EVP_PKEY_meth_set_paramgen, EVP_PKEY_meth_set_keygen, EVP_PKEY_meth_set_sign,
  7. EVP_PKEY_meth_set_verify, EVP_PKEY_meth_set_verify_recover, EVP_PKEY_meth_set_signctx,
  8. EVP_PKEY_meth_set_verifyctx, EVP_PKEY_meth_set_encrypt, EVP_PKEY_meth_set_decrypt,
  9. EVP_PKEY_meth_set_derive, EVP_PKEY_meth_set_ctrl,
  10. EVP_PKEY_meth_set_digestsign, EVP_PKEY_meth_set_digestverify,
  11. EVP_PKEY_meth_set_check,
  12. EVP_PKEY_meth_set_public_check, EVP_PKEY_meth_set_param_check,
  13. EVP_PKEY_meth_set_digest_custom,
  14. EVP_PKEY_meth_get_init, EVP_PKEY_meth_get_copy, EVP_PKEY_meth_get_cleanup,
  15. EVP_PKEY_meth_get_paramgen, EVP_PKEY_meth_get_keygen, EVP_PKEY_meth_get_sign,
  16. EVP_PKEY_meth_get_verify, EVP_PKEY_meth_get_verify_recover, EVP_PKEY_meth_get_signctx,
  17. EVP_PKEY_meth_get_verifyctx, EVP_PKEY_meth_get_encrypt, EVP_PKEY_meth_get_decrypt,
  18. EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl,
  19. EVP_PKEY_meth_get_digestsign, EVP_PKEY_meth_get_digestverify,
  20. EVP_PKEY_meth_get_check,
  21. EVP_PKEY_meth_get_public_check, EVP_PKEY_meth_get_param_check,
  22. EVP_PKEY_meth_get_digest_custom,
  23. EVP_PKEY_meth_remove
  24. - manipulating EVP_PKEY_METHOD structure
  25. =head1 SYNOPSIS
  26. #include <openssl/evp.h>
  27. The following functions have been deprecated since OpenSSL 3.0, and can be
  28. hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
  29. see L<openssl_user_macros(7)>:
  30. typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
  31. EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
  32. void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
  33. void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
  34. const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
  35. int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
  36. int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);
  37. void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
  38. int (*init) (EVP_PKEY_CTX *ctx));
  39. void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
  40. int (*copy) (EVP_PKEY_CTX *dst,
  41. const EVP_PKEY_CTX *src));
  42. void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
  43. void (*cleanup) (EVP_PKEY_CTX *ctx));
  44. void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
  45. int (*paramgen_init) (EVP_PKEY_CTX *ctx),
  46. int (*paramgen) (EVP_PKEY_CTX *ctx,
  47. EVP_PKEY *pkey));
  48. void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
  49. int (*keygen_init) (EVP_PKEY_CTX *ctx),
  50. int (*keygen) (EVP_PKEY_CTX *ctx,
  51. EVP_PKEY *pkey));
  52. void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
  53. int (*sign_init) (EVP_PKEY_CTX *ctx),
  54. int (*sign) (EVP_PKEY_CTX *ctx,
  55. unsigned char *sig, size_t *siglen,
  56. const unsigned char *tbs,
  57. size_t tbslen));
  58. void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
  59. int (*verify_init) (EVP_PKEY_CTX *ctx),
  60. int (*verify) (EVP_PKEY_CTX *ctx,
  61. const unsigned char *sig,
  62. size_t siglen,
  63. const unsigned char *tbs,
  64. size_t tbslen));
  65. void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
  66. int (*verify_recover_init) (EVP_PKEY_CTX
  67. *ctx),
  68. int (*verify_recover) (EVP_PKEY_CTX
  69. *ctx,
  70. unsigned char
  71. *sig,
  72. size_t *siglen,
  73. const unsigned
  74. char *tbs,
  75. size_t tbslen));
  76. void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
  77. int (*signctx_init) (EVP_PKEY_CTX *ctx,
  78. EVP_MD_CTX *mctx),
  79. int (*signctx) (EVP_PKEY_CTX *ctx,
  80. unsigned char *sig,
  81. size_t *siglen,
  82. EVP_MD_CTX *mctx));
  83. void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
  84. int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
  85. EVP_MD_CTX *mctx),
  86. int (*verifyctx) (EVP_PKEY_CTX *ctx,
  87. const unsigned char *sig,
  88. int siglen,
  89. EVP_MD_CTX *mctx));
  90. void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
  91. int (*encrypt_init) (EVP_PKEY_CTX *ctx),
  92. int (*encryptfn) (EVP_PKEY_CTX *ctx,
  93. unsigned char *out,
  94. size_t *outlen,
  95. const unsigned char *in,
  96. size_t inlen));
  97. void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
  98. int (*decrypt_init) (EVP_PKEY_CTX *ctx),
  99. int (*decrypt) (EVP_PKEY_CTX *ctx,
  100. unsigned char *out,
  101. size_t *outlen,
  102. const unsigned char *in,
  103. size_t inlen));
  104. void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
  105. int (*derive_init) (EVP_PKEY_CTX *ctx),
  106. int (*derive) (EVP_PKEY_CTX *ctx,
  107. unsigned char *key,
  108. size_t *keylen));
  109. void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
  110. int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
  111. void *p2),
  112. int (*ctrl_str) (EVP_PKEY_CTX *ctx,
  113. const char *type,
  114. const char *value));
  115. void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth,
  116. int (*digestsign) (EVP_MD_CTX *ctx,
  117. unsigned char *sig,
  118. size_t *siglen,
  119. const unsigned char *tbs,
  120. size_t tbslen));
  121. void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth,
  122. int (*digestverify) (EVP_MD_CTX *ctx,
  123. const unsigned char *sig,
  124. size_t siglen,
  125. const unsigned char *tbs,
  126. size_t tbslen));
  127. void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth,
  128. int (*check) (EVP_PKEY *pkey));
  129. void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth,
  130. int (*check) (EVP_PKEY *pkey));
  131. void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth,
  132. int (*check) (EVP_PKEY *pkey));
  133. void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth,
  134. int (*digest_custom) (EVP_PKEY_CTX *ctx,
  135. EVP_MD_CTX *mctx));
  136. void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth,
  137. int (**pinit) (EVP_PKEY_CTX *ctx));
  138. void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth,
  139. int (**pcopy) (EVP_PKEY_CTX *dst,
  140. EVP_PKEY_CTX *src));
  141. void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth,
  142. void (**pcleanup) (EVP_PKEY_CTX *ctx));
  143. void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth,
  144. int (**pparamgen_init) (EVP_PKEY_CTX *ctx),
  145. int (**pparamgen) (EVP_PKEY_CTX *ctx,
  146. EVP_PKEY *pkey));
  147. void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth,
  148. int (**pkeygen_init) (EVP_PKEY_CTX *ctx),
  149. int (**pkeygen) (EVP_PKEY_CTX *ctx,
  150. EVP_PKEY *pkey));
  151. void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth,
  152. int (**psign_init) (EVP_PKEY_CTX *ctx),
  153. int (**psign) (EVP_PKEY_CTX *ctx,
  154. unsigned char *sig, size_t *siglen,
  155. const unsigned char *tbs,
  156. size_t tbslen));
  157. void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth,
  158. int (**pverify_init) (EVP_PKEY_CTX *ctx),
  159. int (**pverify) (EVP_PKEY_CTX *ctx,
  160. const unsigned char *sig,
  161. size_t siglen,
  162. const unsigned char *tbs,
  163. size_t tbslen));
  164. void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth,
  165. int (**pverify_recover_init) (EVP_PKEY_CTX
  166. *ctx),
  167. int (**pverify_recover) (EVP_PKEY_CTX
  168. *ctx,
  169. unsigned char
  170. *sig,
  171. size_t *siglen,
  172. const unsigned
  173. char *tbs,
  174. size_t tbslen));
  175. void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth,
  176. int (**psignctx_init) (EVP_PKEY_CTX *ctx,
  177. EVP_MD_CTX *mctx),
  178. int (**psignctx) (EVP_PKEY_CTX *ctx,
  179. unsigned char *sig,
  180. size_t *siglen,
  181. EVP_MD_CTX *mctx));
  182. void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth,
  183. int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,
  184. EVP_MD_CTX *mctx),
  185. int (**pverifyctx) (EVP_PKEY_CTX *ctx,
  186. const unsigned char *sig,
  187. int siglen,
  188. EVP_MD_CTX *mctx));
  189. void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth,
  190. int (**pencrypt_init) (EVP_PKEY_CTX *ctx),
  191. int (**pencryptfn) (EVP_PKEY_CTX *ctx,
  192. unsigned char *out,
  193. size_t *outlen,
  194. const unsigned char *in,
  195. size_t inlen));
  196. void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth,
  197. int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
  198. int (**pdecrypt) (EVP_PKEY_CTX *ctx,
  199. unsigned char *out,
  200. size_t *outlen,
  201. const unsigned char *in,
  202. size_t inlen));
  203. void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth,
  204. int (**pderive_init) (EVP_PKEY_CTX *ctx),
  205. int (**pderive) (EVP_PKEY_CTX *ctx,
  206. unsigned char *key,
  207. size_t *keylen));
  208. void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth,
  209. int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
  210. void *p2),
  211. int (**pctrl_str) (EVP_PKEY_CTX *ctx,
  212. const char *type,
  213. const char *value));
  214. void EVP_PKEY_meth_get_digestsign(const EVP_PKEY_METHOD *pmeth,
  215. int (**digestsign) (EVP_MD_CTX *ctx,
  216. unsigned char *sig,
  217. size_t *siglen,
  218. const unsigned char *tbs,
  219. size_t tbslen));
  220. void EVP_PKEY_meth_get_digestverify(const EVP_PKEY_METHOD *pmeth,
  221. int (**digestverify) (EVP_MD_CTX *ctx,
  222. const unsigned char *sig,
  223. size_t siglen,
  224. const unsigned char *tbs,
  225. size_t tbslen));
  226. void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth,
  227. int (**pcheck) (EVP_PKEY *pkey));
  228. void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth,
  229. int (**pcheck) (EVP_PKEY *pkey));
  230. void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth,
  231. int (**pcheck) (EVP_PKEY *pkey));
  232. void EVP_PKEY_meth_get_digest_custom(const EVP_PKEY_METHOD *pmeth,
  233. int (**pdigest_custom) (EVP_PKEY_CTX *ctx,
  234. EVP_MD_CTX *mctx));
  235. =head1 DESCRIPTION
  236. All of the functions described on this page are deprecated.
  237. Applications should instead use the OSSL_PROVIDER APIs.
  238. B<EVP_PKEY_METHOD> is a structure which holds a set of methods for a
  239. specific public key cryptographic algorithm. Those methods are usually
  240. used to perform different jobs, such as generating a key, signing or
  241. verifying, encrypting or decrypting, etc.
  242. There are two places where the B<EVP_PKEY_METHOD> objects are stored: one
  243. is a built-in static array representing the standard methods for different
  244. algorithms, and the other one is a stack of user-defined application-specific
  245. methods, which can be manipulated by using L<EVP_PKEY_meth_add0(3)>.
  246. The B<EVP_PKEY_METHOD> objects are usually referenced by B<EVP_PKEY_CTX>
  247. objects.
  248. =head2 Methods
  249. The methods are the underlying implementations of a particular public key
  250. algorithm present by the B<EVP_PKEY_CTX> object.
  251. int (*init) (EVP_PKEY_CTX *ctx);
  252. int (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);
  253. void (*cleanup) (EVP_PKEY_CTX *ctx);
  254. The init() method is called to initialize algorithm-specific data when a new
  255. B<EVP_PKEY_CTX> is created. As opposed to init(), the cleanup() method is called
  256. when an B<EVP_PKEY_CTX> is freed. The copy() method is called when an B<EVP_PKEY_CTX>
  257. is being duplicated. Refer to L<EVP_PKEY_CTX_new(3)>, L<EVP_PKEY_CTX_new_id(3)>,
  258. L<EVP_PKEY_CTX_free(3)> and L<EVP_PKEY_CTX_dup(3)>.
  259. int (*paramgen_init) (EVP_PKEY_CTX *ctx);
  260. int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
  261. The paramgen_init() and paramgen() methods deal with key parameter generation.
  262. They are called by L<EVP_PKEY_paramgen_init(3)> and L<EVP_PKEY_paramgen(3)> to
  263. handle the parameter generation process.
  264. int (*keygen_init) (EVP_PKEY_CTX *ctx);
  265. int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
  266. The keygen_init() and keygen() methods are used to generate the actual key for
  267. the specified algorithm. They are called by L<EVP_PKEY_keygen_init(3)> and
  268. L<EVP_PKEY_keygen(3)>.
  269. int (*sign_init) (EVP_PKEY_CTX *ctx);
  270. int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
  271. const unsigned char *tbs, size_t tbslen);
  272. The sign_init() and sign() methods are used to generate the signature of a
  273. piece of data using a private key. They are called by L<EVP_PKEY_sign_init(3)>
  274. and L<EVP_PKEY_sign(3)>.
  275. int (*verify_init) (EVP_PKEY_CTX *ctx);
  276. int (*verify) (EVP_PKEY_CTX *ctx,
  277. const unsigned char *sig, size_t siglen,
  278. const unsigned char *tbs, size_t tbslen);
  279. The verify_init() and verify() methods are used to verify whether a signature is
  280. valid. They are called by L<EVP_PKEY_verify_init(3)> and L<EVP_PKEY_verify(3)>.
  281. int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
  282. int (*verify_recover) (EVP_PKEY_CTX *ctx,
  283. unsigned char *rout, size_t *routlen,
  284. const unsigned char *sig, size_t siglen);
  285. The verify_recover_init() and verify_recover() methods are used to verify a
  286. signature and then recover the digest from the signature (for instance, a
  287. signature that was generated by RSA signing algorithm). They are called by
  288. L<EVP_PKEY_verify_recover_init(3)> and L<EVP_PKEY_verify_recover(3)>.
  289. int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
  290. int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
  291. EVP_MD_CTX *mctx);
  292. The signctx_init() and signctx() methods are used to sign a digest present by
  293. a B<EVP_MD_CTX> object. They are called by the EVP_DigestSign functions. See
  294. L<EVP_DigestSignInit(3)> for details.
  295. int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
  296. int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
  297. EVP_MD_CTX *mctx);
  298. The verifyctx_init() and verifyctx() methods are used to verify a signature
  299. against the data in a B<EVP_MD_CTX> object. They are called by the various
  300. EVP_DigestVerify functions. See L<EVP_DigestVerifyInit(3)> for details.
  301. int (*encrypt_init) (EVP_PKEY_CTX *ctx);
  302. int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
  303. const unsigned char *in, size_t inlen);
  304. The encrypt_init() and encrypt() methods are used to encrypt a piece of data.
  305. They are called by L<EVP_PKEY_encrypt_init(3)> and L<EVP_PKEY_encrypt(3)>.
  306. int (*decrypt_init) (EVP_PKEY_CTX *ctx);
  307. int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
  308. const unsigned char *in, size_t inlen);
  309. The decrypt_init() and decrypt() methods are used to decrypt a piece of data.
  310. They are called by L<EVP_PKEY_decrypt_init(3)> and L<EVP_PKEY_decrypt(3)>.
  311. int (*derive_init) (EVP_PKEY_CTX *ctx);
  312. int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
  313. The derive_init() and derive() methods are used to derive the shared secret
  314. from a public key algorithm (for instance, the DH algorithm). They are called by
  315. L<EVP_PKEY_derive_init(3)> and L<EVP_PKEY_derive(3)>.
  316. int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
  317. int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
  318. The ctrl() and ctrl_str() methods are used to adjust algorithm-specific
  319. settings. See L<EVP_PKEY_CTX_ctrl(3)> and related functions for details.
  320. int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
  321. const unsigned char *tbs, size_t tbslen);
  322. int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
  323. size_t siglen, const unsigned char *tbs,
  324. size_t tbslen);
  325. The digestsign() and digestverify() methods are used to generate or verify
  326. a signature in a one-shot mode. They could be called by L<EVP_DigestSign(3)>
  327. and L<EVP_DigestVerify(3)>.
  328. int (*check) (EVP_PKEY *pkey);
  329. int (*public_check) (EVP_PKEY *pkey);
  330. int (*param_check) (EVP_PKEY *pkey);
  331. The check(), public_check() and param_check() methods are used to validate a
  332. key-pair, the public component and parameters respectively for a given B<pkey>.
  333. They could be called by L<EVP_PKEY_check(3)>, L<EVP_PKEY_public_check(3)> and
  334. L<EVP_PKEY_param_check(3)> respectively.
  335. int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
  336. The digest_custom() method is used to generate customized digest content before
  337. the real message is passed to functions like L<EVP_DigestSignUpdate(3)> or
  338. L<EVP_DigestVerifyInit(3)>. This is usually required by some public key
  339. signature algorithms like SM2 which requires a hashed prefix to the message to
  340. be signed. The digest_custom() function will be called by L<EVP_DigestSignInit(3)>
  341. and L<EVP_DigestVerifyInit(3)>.
  342. =head2 Functions
  343. EVP_PKEY_meth_new() creates and returns a new B<EVP_PKEY_METHOD> object,
  344. and associates the given B<id> and B<flags>. The following flags are
  345. supported:
  346. EVP_PKEY_FLAG_AUTOARGLEN
  347. EVP_PKEY_FLAG_SIGCTX_CUSTOM
  348. If an B<EVP_PKEY_METHOD> is set with the B<EVP_PKEY_FLAG_AUTOARGLEN> flag, the
  349. maximum size of the output buffer will be automatically calculated or checked
  350. in corresponding EVP methods by the EVP framework. Thus the implementations of
  351. these methods don't need to care about handling the case of returning output
  352. buffer size by themselves. For details on the output buffer size, refer to
  353. L<EVP_PKEY_sign(3)>.
  354. The B<EVP_PKEY_FLAG_SIGCTX_CUSTOM> is used to indicate the signctx() method
  355. of an B<EVP_PKEY_METHOD> is always called by the EVP framework while doing a
  356. digest signing operation by calling L<EVP_DigestSignFinal(3)>.
  357. EVP_PKEY_meth_free() frees an existing B<EVP_PKEY_METHOD> pointed by
  358. B<pmeth>.
  359. EVP_PKEY_meth_copy() copies an B<EVP_PKEY_METHOD> object from B<src>
  360. to B<dst>.
  361. EVP_PKEY_meth_find() finds an B<EVP_PKEY_METHOD> object with the B<id>.
  362. This function first searches through the user-defined method objects and
  363. then the built-in objects.
  364. EVP_PKEY_meth_add0() adds B<pmeth> to the user defined stack of methods.
  365. EVP_PKEY_meth_remove() removes an B<EVP_PKEY_METHOD> object added by
  366. EVP_PKEY_meth_add0().
  367. The EVP_PKEY_meth_set functions set the corresponding fields of
  368. B<EVP_PKEY_METHOD> structure with the arguments passed.
  369. The EVP_PKEY_meth_get functions get the corresponding fields of
  370. B<EVP_PKEY_METHOD> structure to the arguments provided.
  371. =head1 RETURN VALUES
  372. EVP_PKEY_meth_new() returns a pointer to a new B<EVP_PKEY_METHOD>
  373. object or returns NULL on error.
  374. EVP_PKEY_meth_free() and EVP_PKEY_meth_copy() do not return values.
  375. EVP_PKEY_meth_find() returns a pointer to the found B<EVP_PKEY_METHOD>
  376. object or returns NULL if not found.
  377. EVP_PKEY_meth_add0() returns 1 if method is added successfully or 0
  378. if an error occurred.
  379. EVP_PKEY_meth_remove() returns 1 if method is removed successfully or
  380. 0 if an error occurred.
  381. All EVP_PKEY_meth_set and EVP_PKEY_meth_get functions have no return
  382. values. For the 'get' functions, function pointers are returned by
  383. arguments.
  384. =head1 HISTORY
  385. All of these functions were deprecated in OpenSSL 3.0.
  386. The signature of the I<copy> functional argument of EVP_PKEY_meth_set_copy()
  387. has changed in OpenSSL 3.0 so its I<src> parameter is now constified.
  388. =head1 COPYRIGHT
  389. Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
  390. Licensed under the Apache License 2.0 (the "License"). You may not use
  391. this file except in compliance with the License. You can obtain a copy
  392. in the file LICENSE in the source distribution or at
  393. L<https://www.openssl.org/source/license.html>.
  394. =cut