diff options
| author | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2021-08-18 16:06:57 +0000 |
| commit | d56c8fa8260d226f98b26f017b45b9c2b135f38d (patch) | |
| tree | 348178b41617813cc93787187984a734ef8379ca /src/lib/libcrypto/man/EVP_PKEY_meth_new.3 | |
| parent | 18b9c1bcab7c37d8c5bd05b8e0d14d0c59d96650 (diff) | |
| download | openbsd-tb_20210818.tar.gz openbsd-tb_20210818.tar.bz2 openbsd-tb_20210818.zip | |
This commit was manufactured by cvs2git to create tag 'tb_20210818'.tb_20210818
Diffstat (limited to 'src/lib/libcrypto/man/EVP_PKEY_meth_new.3')
| -rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_meth_new.3 | 555 |
1 files changed, 0 insertions, 555 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 b/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 deleted file mode 100644 index 706824cd59..0000000000 --- a/src/lib/libcrypto/man/EVP_PKEY_meth_new.3 +++ /dev/null | |||
| @@ -1,555 +0,0 @@ | |||
| 1 | .\" $OpenBSD: EVP_PKEY_meth_new.3,v 1.4 2019/06/06 01:06:58 schwarze Exp $ | ||
| 2 | .\" selective merge up to: OpenSSL 43f985fd Aug 21 11:47:17 2017 -0400 | ||
| 3 | .\" | ||
| 4 | .\" This file was written by Paul Yang <yang.yang@baishancloud.com> | ||
| 5 | .\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. | ||
| 6 | .\" | ||
| 7 | .\" Redistribution and use in source and binary forms, with or without | ||
| 8 | .\" modification, are permitted provided that the following conditions | ||
| 9 | .\" are met: | ||
| 10 | .\" | ||
| 11 | .\" 1. Redistributions of source code must retain the above copyright | ||
| 12 | .\" notice, this list of conditions and the following disclaimer. | ||
| 13 | .\" | ||
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | .\" notice, this list of conditions and the following disclaimer in | ||
| 16 | .\" the documentation and/or other materials provided with the | ||
| 17 | .\" distribution. | ||
| 18 | .\" | ||
| 19 | .\" 3. All advertising materials mentioning features or use of this | ||
| 20 | .\" software must display the following acknowledgment: | ||
| 21 | .\" "This product includes software developed by the OpenSSL Project | ||
| 22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 23 | .\" | ||
| 24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | .\" endorse or promote products derived from this software without | ||
| 26 | .\" prior written permission. For written permission, please contact | ||
| 27 | .\" openssl-core@openssl.org. | ||
| 28 | .\" | ||
| 29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
| 31 | .\" permission of the OpenSSL Project. | ||
| 32 | .\" | ||
| 33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | .\" acknowledgment: | ||
| 35 | .\" "This product includes software developed by the OpenSSL Project | ||
| 36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 37 | .\" | ||
| 38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | .\" | ||
| 51 | .Dd $Mdocdate: June 6 2019 $ | ||
| 52 | .Dt EVP_PKEY_METH_NEW 3 | ||
| 53 | .Os | ||
| 54 | .Sh NAME | ||
| 55 | .Nm EVP_PKEY_meth_new , | ||
| 56 | .Nm EVP_PKEY_meth_free , | ||
| 57 | .Nm EVP_PKEY_meth_copy , | ||
| 58 | .Nm EVP_PKEY_meth_find , | ||
| 59 | .Nm EVP_PKEY_meth_add0 , | ||
| 60 | .Nm EVP_PKEY_meth_set_init , | ||
| 61 | .Nm EVP_PKEY_meth_set_copy , | ||
| 62 | .Nm EVP_PKEY_meth_set_cleanup , | ||
| 63 | .Nm EVP_PKEY_meth_set_paramgen , | ||
| 64 | .Nm EVP_PKEY_meth_set_keygen , | ||
| 65 | .Nm EVP_PKEY_meth_set_sign , | ||
| 66 | .Nm EVP_PKEY_meth_set_verify , | ||
| 67 | .Nm EVP_PKEY_meth_set_verify_recover , | ||
| 68 | .Nm EVP_PKEY_meth_set_signctx , | ||
| 69 | .Nm EVP_PKEY_meth_set_verifyctx , | ||
| 70 | .Nm EVP_PKEY_meth_set_encrypt , | ||
| 71 | .Nm EVP_PKEY_meth_set_decrypt , | ||
| 72 | .Nm EVP_PKEY_meth_set_derive , | ||
| 73 | .Nm EVP_PKEY_meth_set_ctrl | ||
| 74 | .Nd manipulate an EVP_PKEY_METHOD structure | ||
| 75 | .Sh SYNOPSIS | ||
| 76 | .In openssl/evp.h | ||
| 77 | .Ft EVP_PKEY_METHOD * | ||
| 78 | .Fo EVP_PKEY_meth_new | ||
| 79 | .Fa "int id" | ||
| 80 | .Fa "int flags" | ||
| 81 | .Fc | ||
| 82 | .Ft void | ||
| 83 | .Fo EVP_PKEY_meth_free | ||
| 84 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 85 | .Fc | ||
| 86 | .Ft void | ||
| 87 | .Fo EVP_PKEY_meth_copy | ||
| 88 | .Fa "EVP_PKEY_METHOD *dst" | ||
| 89 | .Fa "const EVP_PKEY_METHOD *src" | ||
| 90 | .Fc | ||
| 91 | .Ft const EVP_PKEY_METHOD * | ||
| 92 | .Fo EVP_PKEY_meth_find | ||
| 93 | .Fa "int type" | ||
| 94 | .Fc | ||
| 95 | .Ft int | ||
| 96 | .Fo EVP_PKEY_meth_add0 | ||
| 97 | .Fa "const EVP_PKEY_METHOD *pmeth" | ||
| 98 | .Fc | ||
| 99 | .Ft void | ||
| 100 | .Fo EVP_PKEY_meth_set_init | ||
| 101 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 102 | .Fa "int (*init)(EVP_PKEY_CTX *ctx)" | ||
| 103 | .Fc | ||
| 104 | .Ft void | ||
| 105 | .Fo EVP_PKEY_meth_set_copy | ||
| 106 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 107 | .Fa "int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)" | ||
| 108 | .Fc | ||
| 109 | .Ft void | ||
| 110 | .Fo EVP_PKEY_meth_set_cleanup | ||
| 111 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 112 | .Fa "void (*cleanup)(EVP_PKEY_CTX *ctx)" | ||
| 113 | .Fc | ||
| 114 | .Ft void | ||
| 115 | .Fo EVP_PKEY_meth_set_paramgen | ||
| 116 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 117 | .Fa "int (*paramgen_init)(EVP_PKEY_CTX *ctx)" | ||
| 118 | .Fa "int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)" | ||
| 119 | .Fc | ||
| 120 | .Ft void | ||
| 121 | .Fo EVP_PKEY_meth_set_keygen | ||
| 122 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 123 | .Fa "int (*keygen_init)(EVP_PKEY_CTX *ctx)" | ||
| 124 | .Fa "int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)" | ||
| 125 | .Fc | ||
| 126 | .Ft void | ||
| 127 | .Fo EVP_PKEY_meth_set_sign | ||
| 128 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 129 | .Fa "int (*sign_init)(EVP_PKEY_CTX *ctx)" | ||
| 130 | .Fa "int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\ | ||
| 131 | const unsigned char *tbs, size_t tbslen)" | ||
| 132 | .Fc | ||
| 133 | .Ft void | ||
| 134 | .Fo EVP_PKEY_meth_set_verify | ||
| 135 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 136 | .Fa "int (*verify_init)(EVP_PKEY_CTX *ctx)" | ||
| 137 | .Fa "int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig,\ | ||
| 138 | size_t siglen, const unsigned char *tbs, size_t tbslen)" | ||
| 139 | .Fc | ||
| 140 | .Ft void | ||
| 141 | .Fo EVP_PKEY_meth_set_verify_recover | ||
| 142 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 143 | .Fa "int (*verify_recover_init)(EVP_PKEY_CTX *ctx)" | ||
| 144 | .Fa "int (*verify_recover)(EVP_PKEY_CTX *ctx, unsigned char *sig,\ | ||
| 145 | size_t *siglen, const unsigned char *tbs, size_t tbslen)" | ||
| 146 | .Fc | ||
| 147 | .Ft void | ||
| 148 | .Fo EVP_PKEY_meth_set_signctx | ||
| 149 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 150 | .Fa "int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)" | ||
| 151 | .Fa "int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig,\ | ||
| 152 | size_t *siglen, EVP_MD_CTX *mctx)" | ||
| 153 | .Fc | ||
| 154 | .Ft void | ||
| 155 | .Fo EVP_PKEY_meth_set_verifyctx | ||
| 156 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 157 | .Fa "int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)" | ||
| 158 | .Fa "int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,\ | ||
| 159 | int siglen, EVP_MD_CTX *mctx)" | ||
| 160 | .Fc | ||
| 161 | .Ft void | ||
| 162 | .Fo EVP_PKEY_meth_set_encrypt | ||
| 163 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 164 | .Fa "int (*encrypt_init)(EVP_PKEY_CTX *ctx)" | ||
| 165 | .Fa "int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out,\ | ||
| 166 | size_t *outlen, const unsigned char *in, size_t inlen)" | ||
| 167 | .Fc | ||
| 168 | .Ft void | ||
| 169 | .Fo EVP_PKEY_meth_set_decrypt | ||
| 170 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 171 | .Fa "int (*decrypt_init)(EVP_PKEY_CTX *ctx)" | ||
| 172 | .Fa "int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out,\ | ||
| 173 | size_t *outlen, const unsigned char *in, size_t inlen)" | ||
| 174 | .Fc | ||
| 175 | .Ft void | ||
| 176 | .Fo EVP_PKEY_meth_set_derive | ||
| 177 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 178 | .Fa "int (*derive_init)(EVP_PKEY_CTX *ctx)" | ||
| 179 | .Fa "int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)" | ||
| 180 | .Fc | ||
| 181 | .Ft void | ||
| 182 | .Fo EVP_PKEY_meth_set_ctrl | ||
| 183 | .Fa "EVP_PKEY_METHOD *pmeth" | ||
| 184 | .Fa "int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)" | ||
| 185 | .Fa "int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)" | ||
| 186 | .Fc | ||
| 187 | .Sh DESCRIPTION | ||
| 188 | The | ||
| 189 | .Vt EVP_PKEY_METHOD | ||
| 190 | structure holds a set of methods | ||
| 191 | for a specific public key cryptographic algorithm. | ||
| 192 | Those methods perform tasks such as generating keys, signing, verifying, | ||
| 193 | encrypting, decrypting, and so on. | ||
| 194 | .Pp | ||
| 195 | There are two places where the | ||
| 196 | .Vt EVP_PKEY_METHOD | ||
| 197 | objects are stored: one is a built-in static array representing the | ||
| 198 | standard methods for different algorithms, and the other one is a stack | ||
| 199 | of user-defined application-specific methods, which can be manipulated | ||
| 200 | with | ||
| 201 | .Fn EVP_PKEY_meth_add0 . | ||
| 202 | .Pp | ||
| 203 | The | ||
| 204 | .Vt EVP_PKEY_METHOD | ||
| 205 | objects are usually referenced by | ||
| 206 | .Vt EVP_PKEY_CTX | ||
| 207 | objects. | ||
| 208 | .Ss Methods | ||
| 209 | The methods implement the particular public key algorithm represented by the | ||
| 210 | .Vt EVP_PKEY_CTX | ||
| 211 | object. | ||
| 212 | .Bd -unfilled | ||
| 213 | .Ft int Fn (*init) "EVP_PKEY_CTX *ctx" | ||
| 214 | .Ft int Fn (*copy) "EVP_PKEY_CTX *dst" "EVP_PKEY_CTX *src" | ||
| 215 | .Ft void Fn (*cleanup) "EVP_PKEY_CTX *ctx" | ||
| 216 | .Ed | ||
| 217 | .Pp | ||
| 218 | The | ||
| 219 | .Fn init | ||
| 220 | method is called by | ||
| 221 | .Xr EVP_PKEY_CTX_new 3 | ||
| 222 | and | ||
| 223 | .Xr EVP_PKEY_CTX_new_id 3 | ||
| 224 | to initialize the algorithm-specific data when a new | ||
| 225 | .Vt EVP_PKEY_CTX | ||
| 226 | is created. | ||
| 227 | The | ||
| 228 | .Fn cleanup | ||
| 229 | method is called by | ||
| 230 | .Xr EVP_PKEY_CTX_free 3 | ||
| 231 | when an | ||
| 232 | .Vt EVP_PKEY_CTX | ||
| 233 | is freed. | ||
| 234 | The | ||
| 235 | .Fn copy | ||
| 236 | method is called by | ||
| 237 | .Xr EVP_PKEY_CTX_dup 3 | ||
| 238 | when an | ||
| 239 | .Vt EVP_PKEY_CTX | ||
| 240 | is duplicated. | ||
| 241 | .Bd -unfilled | ||
| 242 | .Ft int Fn (*paramgen_init) "EVP_PKEY_CTX *ctx" | ||
| 243 | .Ft int Fn (*paramgen) "EVP_PKEY_CTX *ctx" "EVP_PKEY *pkey" | ||
| 244 | .Ed | ||
| 245 | .Pp | ||
| 246 | The | ||
| 247 | .Fn paramgen_init | ||
| 248 | and | ||
| 249 | .Fn paramgen | ||
| 250 | methods deal with key parameter generation. | ||
| 251 | They are called by | ||
| 252 | .Xr EVP_PKEY_paramgen_init 3 | ||
| 253 | and | ||
| 254 | .Xr EVP_PKEY_paramgen 3 | ||
| 255 | to handle the parameter generation process. | ||
| 256 | .Bd -unfilled | ||
| 257 | .Ft int Fn (*keygen_init) "EVP_PKEY_CTX *ctx" | ||
| 258 | .Ft int Fn (*keygen) "EVP_PKEY_CTX *ctx" "EVP_PKEY *pkey" | ||
| 259 | .Ed | ||
| 260 | .Pp | ||
| 261 | The | ||
| 262 | .Fn keygen_init | ||
| 263 | and | ||
| 264 | .Fn keygen | ||
| 265 | methods are used to generate a key for the specified algorithm. | ||
| 266 | They are called by | ||
| 267 | .Xr EVP_PKEY_keygen_init 3 | ||
| 268 | and | ||
| 269 | .Xr EVP_PKEY_keygen 3 . | ||
| 270 | .Bd -unfilled | ||
| 271 | .Ft int Fn (*sign_init) "EVP_PKEY_CTX *ctx" | ||
| 272 | .Ft int Fo (*sign) | ||
| 273 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 274 | .Fa "unsigned char *sig" | ||
| 275 | .Fa "size_t *siglen" | ||
| 276 | .Fa "const unsigned char *tbs" | ||
| 277 | .Fa "size_t tbslen" | ||
| 278 | .Fc | ||
| 279 | .Ed | ||
| 280 | .Pp | ||
| 281 | The | ||
| 282 | .Fn sign_init | ||
| 283 | and | ||
| 284 | .Fn sign | ||
| 285 | methods are used to generate the signature of a piece of data using a | ||
| 286 | private key. | ||
| 287 | They are called by | ||
| 288 | .Xr EVP_PKEY_sign_init 3 | ||
| 289 | and | ||
| 290 | .Xr EVP_PKEY_sign 3 . | ||
| 291 | .Bd -unfilled | ||
| 292 | .Ft int Fn (*verify_init) "EVP_PKEY_CTX *ctx" | ||
| 293 | .Ft int Fo (*verify) | ||
| 294 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 295 | .Fa "const unsigned char *sig" | ||
| 296 | .Fa "size_t siglen" | ||
| 297 | .Fa "const unsigned char *tbs" | ||
| 298 | .Fa "size_t tbslen" | ||
| 299 | .Fc | ||
| 300 | .Ed | ||
| 301 | .Pp | ||
| 302 | The | ||
| 303 | .Fn verify_init | ||
| 304 | and | ||
| 305 | .Fn verify | ||
| 306 | methods are used to verify whether a signature is valid. | ||
| 307 | They are called by | ||
| 308 | .Xr EVP_PKEY_verify_init 3 | ||
| 309 | and | ||
| 310 | .Xr EVP_PKEY_verify 3 . | ||
| 311 | .Bd -unfilled | ||
| 312 | .Ft int Fn (*verify_recover_init) "EVP_PKEY_CTX *ctx" | ||
| 313 | .Ft int Fo (*verify_recover) | ||
| 314 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 315 | .Fa "unsigned char *rout" | ||
| 316 | .Fa "size_t *routlen" | ||
| 317 | .Fa "const unsigned char *sig" | ||
| 318 | .Fa "size_t siglen" | ||
| 319 | .Fc | ||
| 320 | .Ed | ||
| 321 | .Pp | ||
| 322 | The | ||
| 323 | .Fn verify_recover_init | ||
| 324 | and | ||
| 325 | .Fn verify_recover | ||
| 326 | methods are used to verify a signature and then recover the digest from | ||
| 327 | the signature (for instance, a signature that was generated by the RSA | ||
| 328 | signing algorithm). | ||
| 329 | They are called by | ||
| 330 | .Xr EVP_PKEY_verify_recover_init 3 | ||
| 331 | and | ||
| 332 | .Xr EVP_PKEY_verify_recover 3 . | ||
| 333 | .Bd -unfilled | ||
| 334 | .Ft int Fn (*signctx_init) "EVP_PKEY_CTX *ctx" "EVP_MD_CTX *mctx" | ||
| 335 | .Ft int Fo (*signctx) | ||
| 336 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 337 | .Fa "unsigned char *sig" | ||
| 338 | .Fa "size_t *siglen" | ||
| 339 | .Fa "EVP_MD_CTX *mctx" | ||
| 340 | .Fc | ||
| 341 | .Ed | ||
| 342 | .Pp | ||
| 343 | The | ||
| 344 | .Fn signctx_init | ||
| 345 | and | ||
| 346 | .Fn signctx | ||
| 347 | methods are used to sign a digest represented by an | ||
| 348 | .Vt EVP_MD_CTX | ||
| 349 | object. | ||
| 350 | They are called by the | ||
| 351 | .Xr EVP_DigestSignInit 3 | ||
| 352 | functions. | ||
| 353 | .Bd -unfilled | ||
| 354 | .Ft int Fn (*verifyctx_init) "EVP_PKEY_CTX *ctx" "EVP_MD_CTX *mctx" | ||
| 355 | .Ft int Fo (*verifyctx) | ||
| 356 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 357 | .Fa "const unsigned char *sig" | ||
| 358 | .Fa "int siglen" | ||
| 359 | .Fa "EVP_MD_CTX *mctx" | ||
| 360 | .Fc | ||
| 361 | .Ed | ||
| 362 | .Pp | ||
| 363 | The | ||
| 364 | .Fn verifyctx_init | ||
| 365 | and | ||
| 366 | .Fn verifyctx | ||
| 367 | methods are used to verify a signature against the data in an | ||
| 368 | .Vt EVP_MD_CTX | ||
| 369 | object. | ||
| 370 | They are called by the | ||
| 371 | .Xr EVP_DigestVerifyInit 3 | ||
| 372 | functions. | ||
| 373 | .Bd -unfilled | ||
| 374 | .Ft int Fn (*encrypt_init) "EVP_PKEY_CTX *ctx" | ||
| 375 | .Ft int Fo (*encrypt) | ||
| 376 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 377 | .Fa "unsigned char *out" | ||
| 378 | .Fa "size_t *outlen" | ||
| 379 | .Fa "const unsigned char *in" | ||
| 380 | .Fa "size_t inlen" | ||
| 381 | .Fc | ||
| 382 | .Ed | ||
| 383 | .Pp | ||
| 384 | The | ||
| 385 | .Fn encrypt_init | ||
| 386 | and | ||
| 387 | .Fn encrypt | ||
| 388 | methods are used to encrypt a piece of data. | ||
| 389 | They are called by | ||
| 390 | .Xr EVP_PKEY_encrypt_init 3 | ||
| 391 | and | ||
| 392 | .Xr EVP_PKEY_encrypt 3 . | ||
| 393 | .Bd -unfilled | ||
| 394 | .Ft int Fn (*decrypt_init) "EVP_PKEY_CTX *ctx" | ||
| 395 | .Ft int Fo (*decrypt) | ||
| 396 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 397 | .Fa "unsigned char *out" | ||
| 398 | .Fa "size_t *outlen" | ||
| 399 | .Fa "const unsigned char *in" | ||
| 400 | .Fa "size_t inlen" | ||
| 401 | .Fc | ||
| 402 | .Ed | ||
| 403 | .Pp | ||
| 404 | The | ||
| 405 | .Fn decrypt_init | ||
| 406 | and | ||
| 407 | .Fn decrypt | ||
| 408 | methods are used to decrypt a piece of data. | ||
| 409 | They are called by | ||
| 410 | .Xr EVP_PKEY_decrypt_init 3 | ||
| 411 | and | ||
| 412 | .Xr EVP_PKEY_decrypt 3 . | ||
| 413 | .Bd -unfilled | ||
| 414 | .Ft int Fn (*derive_init) "EVP_PKEY_CTX *ctx" | ||
| 415 | .Ft int Fo (*derive) | ||
| 416 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 417 | .Fa "unsigned char *key" | ||
| 418 | .Fa "size_t *keylen" | ||
| 419 | .Fc | ||
| 420 | .Ed | ||
| 421 | .Pp | ||
| 422 | The | ||
| 423 | .Fn derive_init | ||
| 424 | and | ||
| 425 | .Fn derive | ||
| 426 | methods are used to derive the shared secret from a public key algorithm | ||
| 427 | (for instance, the DH algorithm). | ||
| 428 | They are called by | ||
| 429 | .Xr EVP_PKEY_derive_init 3 | ||
| 430 | and | ||
| 431 | .Xr EVP_PKEY_derive 3 . | ||
| 432 | .Bd -unfilled | ||
| 433 | .Ft int Fo (*ctrl) | ||
| 434 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 435 | .Fa "int type" | ||
| 436 | .Fa "int p1" | ||
| 437 | .Fa "void *p2" | ||
| 438 | .Fc | ||
| 439 | .Ft int Fo (*ctrl_str) | ||
| 440 | .Fa "EVP_PKEY_CTX *ctx" | ||
| 441 | .Fa "const char *type" | ||
| 442 | .Fa "const char *value" | ||
| 443 | .Fc | ||
| 444 | .Ed | ||
| 445 | .Pp | ||
| 446 | The | ||
| 447 | .Fn ctrl | ||
| 448 | and | ||
| 449 | .Fn ctrl_str | ||
| 450 | methods are used to adjust algorithm-specific settings. | ||
| 451 | See | ||
| 452 | .Xr EVP_PKEY_CTX_ctrl 3 | ||
| 453 | for details. | ||
| 454 | .Ss Functions | ||
| 455 | .Fn EVP_PKEY_meth_new | ||
| 456 | creates a new | ||
| 457 | .Vt EVP_PKEY_METHOD | ||
| 458 | object with the given | ||
| 459 | .Fa id | ||
| 460 | and | ||
| 461 | .Fa flags . | ||
| 462 | The following flags are supported: | ||
| 463 | .Bl -tag -width Ds | ||
| 464 | .It Dv EVP_PKEY_FLAG_AUTOARGLEN | ||
| 465 | Automatically calculate the maximum size of the output buffer | ||
| 466 | in corresponding EVP methods by the EVP framework. | ||
| 467 | Thus the implementations of these methods don't need to care about | ||
| 468 | handling the case of returning output buffer size by themselves. | ||
| 469 | For details on the output buffer size, refer to | ||
| 470 | .Xr EVP_PKEY_sign 3 . | ||
| 471 | .It Dv EVP_PKEY_FLAG_SIGCTX_CUSTOM | ||
| 472 | Indicate that the | ||
| 473 | .Fn signctx | ||
| 474 | method of an | ||
| 475 | .Vt EVP_PKEY_METHOD | ||
| 476 | is always called by the EVP framework while doing a digest signing | ||
| 477 | operation by calling | ||
| 478 | .Xr EVP_DigestSignFinal 3 . | ||
| 479 | .El | ||
| 480 | .Pp | ||
| 481 | .Fn EVP_PKEY_meth_free | ||
| 482 | frees | ||
| 483 | .Fa pmeth . | ||
| 484 | .Pp | ||
| 485 | .Fn EVP_PKEY_meth_copy | ||
| 486 | copies | ||
| 487 | .Fa src | ||
| 488 | to | ||
| 489 | .Fa dst . | ||
| 490 | .Pp | ||
| 491 | .Fn EVP_PKEY_meth_find | ||
| 492 | finds an | ||
| 493 | .Vt EVP_PKEY_METHOD | ||
| 494 | object with the given | ||
| 495 | .Fa id . | ||
| 496 | This function first searches through the user-defined method objects and | ||
| 497 | then through the built-in objects. | ||
| 498 | .Pp | ||
| 499 | .Fn EVP_PKEY_meth_add0 | ||
| 500 | adds | ||
| 501 | .Fa pmeth | ||
| 502 | to the stack of user defined methods. | ||
| 503 | .Pp | ||
| 504 | The | ||
| 505 | .Fn EVP_PKEY_meth_set_* | ||
| 506 | functions set the corresponding fields of | ||
| 507 | .Fa pmeth | ||
| 508 | to the arguments passed. | ||
| 509 | .Sh RETURN VALUES | ||
| 510 | .Fn EVP_PKEY_meth_new | ||
| 511 | returns a pointer to a new | ||
| 512 | .Vt EVP_PKEY_METHOD | ||
| 513 | object or | ||
| 514 | .Dv NULL | ||
| 515 | on error. | ||
| 516 | .Pp | ||
| 517 | .Fn EVP_PKEY_meth_find | ||
| 518 | returns a pointer to the found | ||
| 519 | .Vt EVP_PKEY_METHOD | ||
| 520 | object or | ||
| 521 | .Dv NULL | ||
| 522 | if no matching object is found. | ||
| 523 | .Pp | ||
| 524 | .Fn EVP_PKEY_meth_add0 | ||
| 525 | returns 1 if the method is added successfully or 0 if an error occurred. | ||
| 526 | .Sh SEE ALSO | ||
| 527 | .Xr EVP_DigestInit 3 , | ||
| 528 | .Xr EVP_PKEY_meth_get0_info 3 , | ||
| 529 | .Xr EVP_PKEY_new 3 | ||
| 530 | .Sh HISTORY | ||
| 531 | .Fn EVP_PKEY_meth_new , | ||
| 532 | .Fn EVP_PKEY_meth_free , | ||
| 533 | .Fn EVP_PKEY_meth_find , | ||
| 534 | .Fn EVP_PKEY_meth_add0 , | ||
| 535 | .Fn EVP_PKEY_meth_set_init , | ||
| 536 | .Fn EVP_PKEY_meth_set_copy , | ||
| 537 | .Fn EVP_PKEY_meth_set_cleanup , | ||
| 538 | .Fn EVP_PKEY_meth_set_paramgen , | ||
| 539 | .Fn EVP_PKEY_meth_set_keygen , | ||
| 540 | .Fn EVP_PKEY_meth_set_sign , | ||
| 541 | .Fn EVP_PKEY_meth_set_verify , | ||
| 542 | .Fn EVP_PKEY_meth_set_verify_recover , | ||
| 543 | .Fn EVP_PKEY_meth_set_signctx , | ||
| 544 | .Fn EVP_PKEY_meth_set_verifyctx , | ||
| 545 | .Fn EVP_PKEY_meth_set_encrypt , | ||
| 546 | .Fn EVP_PKEY_meth_set_decrypt , | ||
| 547 | .Fn EVP_PKEY_meth_set_derive , | ||
| 548 | and | ||
| 549 | .Fn EVP_PKEY_meth_set_ctrl | ||
| 550 | first appeared in OpenSSL 1.0.0 and have been available since | ||
| 551 | .Ox 4.9 . | ||
| 552 | .Pp | ||
| 553 | .Fn EVP_PKEY_meth_copy | ||
| 554 | first appeared in OpenSSL 1.0.1 and has been available since | ||
| 555 | .Ox 5.3 . | ||
