xref: /freebsd/crypto/openssl/include/openssl/evp.h (revision ad991e4c)
1 /*
2  * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #ifndef OPENSSL_EVP_H
11 # define OPENSSL_EVP_H
12 # pragma once
13 
14 # include <openssl/macros.h>
15 # ifndef OPENSSL_NO_DEPRECATED_3_0
16 #  define HEADER_ENVELOPE_H
17 # endif
18 
19 # include <stdarg.h>
20 
21 # ifndef OPENSSL_NO_STDIO
22 #  include <stdio.h>
23 # endif
24 
25 # include <openssl/opensslconf.h>
26 # include <openssl/types.h>
27 # include <openssl/core.h>
28 # include <openssl/core_dispatch.h>
29 # include <openssl/symhacks.h>
30 # include <openssl/bio.h>
31 # include <openssl/evperr.h>
32 # include <openssl/params.h>
33 
34 # define EVP_MAX_MD_SIZE                 64/* longest known is SHA512 */
35 # define EVP_MAX_KEY_LENGTH              64
36 # define EVP_MAX_IV_LENGTH               16
37 # define EVP_MAX_BLOCK_LENGTH            32
38 
39 # define PKCS5_SALT_LEN                  8
40 /* Default PKCS#5 iteration count */
41 # define PKCS5_DEFAULT_ITER              2048
42 
43 # include <openssl/objects.h>
44 
45 # ifndef OPENSSL_NO_DEPRECATED_3_0
46 #  define EVP_PK_RSA      0x0001
47 #  define EVP_PK_DSA      0x0002
48 #  define EVP_PK_DH       0x0004
49 #  define EVP_PK_EC       0x0008
50 #  define EVP_PKT_SIGN    0x0010
51 #  define EVP_PKT_ENC     0x0020
52 #  define EVP_PKT_EXCH    0x0040
53 #  define EVP_PKS_RSA     0x0100
54 #  define EVP_PKS_DSA     0x0200
55 #  define EVP_PKS_EC      0x0400
56 # endif
57 
58 # define EVP_PKEY_NONE   NID_undef
59 # define EVP_PKEY_RSA    NID_rsaEncryption
60 # define EVP_PKEY_RSA2   NID_rsa
61 # define EVP_PKEY_RSA_PSS NID_rsassaPss
62 # define EVP_PKEY_DSA    NID_dsa
63 # define EVP_PKEY_DSA1   NID_dsa_2
64 # define EVP_PKEY_DSA2   NID_dsaWithSHA
65 # define EVP_PKEY_DSA3   NID_dsaWithSHA1
66 # define EVP_PKEY_DSA4   NID_dsaWithSHA1_2
67 # define EVP_PKEY_DH     NID_dhKeyAgreement
68 # define EVP_PKEY_DHX    NID_dhpublicnumber
69 # define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey
70 # define EVP_PKEY_SM2    NID_sm2
71 # define EVP_PKEY_HMAC   NID_hmac
72 # define EVP_PKEY_CMAC   NID_cmac
73 # define EVP_PKEY_SCRYPT NID_id_scrypt
74 # define EVP_PKEY_TLS1_PRF NID_tls1_prf
75 # define EVP_PKEY_HKDF   NID_hkdf
76 # define EVP_PKEY_POLY1305 NID_poly1305
77 # define EVP_PKEY_SIPHASH NID_siphash
78 # define EVP_PKEY_X25519 NID_X25519
79 # define EVP_PKEY_ED25519 NID_ED25519
80 # define EVP_PKEY_X448 NID_X448
81 # define EVP_PKEY_ED448 NID_ED448
82 /* Special indicator that the object is uniquely provider side */
83 # define EVP_PKEY_KEYMGMT -1
84 
85 /* Easy to use macros for EVP_PKEY related selections */
86 # define EVP_PKEY_KEY_PARAMETERS                                            \
87     ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
88 # define EVP_PKEY_PRIVATE_KEY                                               \
89     ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
90 # define EVP_PKEY_PUBLIC_KEY                                                \
91     ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
92 # define EVP_PKEY_KEYPAIR                                                   \
93     ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )
94 
95 #ifdef  __cplusplus
96 extern "C" {
97 #endif
98 
99 int EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq);
100 int EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx);
101 int EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable);
102 
103 # define EVP_PKEY_MO_SIGN        0x0001
104 # define EVP_PKEY_MO_VERIFY      0x0002
105 # define EVP_PKEY_MO_ENCRYPT     0x0004
106 # define EVP_PKEY_MO_DECRYPT     0x0008
107 
108 # ifndef EVP_MD
109 #  ifndef OPENSSL_NO_DEPRECATED_3_0
110 OSSL_DEPRECATEDIN_3_0 EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
111 OSSL_DEPRECATEDIN_3_0 EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
112 OSSL_DEPRECATEDIN_3_0 void EVP_MD_meth_free(EVP_MD *md);
113 OSSL_DEPRECATEDIN_3_0
114 int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);
115 OSSL_DEPRECATEDIN_3_0
116 int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);
117 OSSL_DEPRECATEDIN_3_0
118 int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);
119 OSSL_DEPRECATEDIN_3_0
120 int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);
121 OSSL_DEPRECATEDIN_3_0
122 int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));
123 OSSL_DEPRECATEDIN_3_0
124 int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
125                                                      const void *data,
126                                                      size_t count));
127 OSSL_DEPRECATEDIN_3_0
128 int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
129                                                    unsigned char *md));
130 OSSL_DEPRECATEDIN_3_0
131 int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
132                                                  const EVP_MD_CTX *from));
133 OSSL_DEPRECATEDIN_3_0
134 int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
135 OSSL_DEPRECATEDIN_3_0
136 int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,
137                                                  int p1, void *p2));
138 OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);
139 OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_result_size(const EVP_MD *md);
140 OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_app_datasize(const EVP_MD *md);
141 OSSL_DEPRECATEDIN_3_0 unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);
142 OSSL_DEPRECATEDIN_3_0
143 int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);
144 OSSL_DEPRECATEDIN_3_0
145 int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,
146                                                 const void *data, size_t count);
147 OSSL_DEPRECATEDIN_3_0
148 int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,
149                                                unsigned char *md);
150 OSSL_DEPRECATEDIN_3_0
151 int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
152                                               const EVP_MD_CTX *from);
153 OSSL_DEPRECATEDIN_3_0
154 int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);
155 OSSL_DEPRECATEDIN_3_0
156 int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
157                                               int p1, void *p2);
158 #  endif
159 /* digest can only handle a single block */
160 #  define EVP_MD_FLAG_ONESHOT     0x0001
161 
162 /* digest is extensible-output function, XOF */
163 #  define EVP_MD_FLAG_XOF         0x0002
164 
165 /* DigestAlgorithmIdentifier flags... */
166 
167 #  define EVP_MD_FLAG_DIGALGID_MASK               0x0018
168 
169 /* NULL or absent parameter accepted. Use NULL */
170 
171 #  define EVP_MD_FLAG_DIGALGID_NULL               0x0000
172 
173 /* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */
174 
175 #  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008
176 
177 /* Custom handling via ctrl */
178 
179 #  define EVP_MD_FLAG_DIGALGID_CUSTOM             0x0018
180 
181 /* Note if suitable for use in FIPS mode */
182 #  define EVP_MD_FLAG_FIPS        0x0400
183 
184 /* Digest ctrls */
185 
186 #  define EVP_MD_CTRL_DIGALGID                    0x1
187 #  define EVP_MD_CTRL_MICALG                      0x2
188 #  define EVP_MD_CTRL_XOF_LEN                     0x3
189 #  define EVP_MD_CTRL_TLSTREE                     0x4
190 
191 /* Minimum Algorithm specific ctrl value */
192 
193 #  define EVP_MD_CTRL_ALG_CTRL                    0x1000
194 
195 # endif                         /* !EVP_MD */
196 
197 /* values for EVP_MD_CTX flags */
198 
199 # define EVP_MD_CTX_FLAG_ONESHOT         0x0001/* digest update will be
200                                                 * called once only */
201 # define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been
202                                                 * cleaned */
203 # define EVP_MD_CTX_FLAG_REUSE           0x0004/* Don't free up ctx->md_data
204                                                 * in EVP_MD_CTX_reset */
205 /*
206  * FIPS and pad options are ignored in 1.0.0, definitions are here so we
207  * don't accidentally reuse the values for other purposes.
208  */
209 
210 /* This flag has no effect from openssl-3.0 onwards */
211 # define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW  0x0008
212 
213 /*
214  * The following PAD options are also currently ignored in 1.0.0, digest
215  * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*()
216  * instead.
217  */
218 # define EVP_MD_CTX_FLAG_PAD_MASK        0xF0/* RSA mode to use */
219 # define EVP_MD_CTX_FLAG_PAD_PKCS1       0x00/* PKCS#1 v1.5 mode */
220 # define EVP_MD_CTX_FLAG_PAD_X931        0x10/* X9.31 mode */
221 # define EVP_MD_CTX_FLAG_PAD_PSS         0x20/* PSS mode */
222 
223 # define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */
224 /*
225  * Some functions such as EVP_DigestSign only finalise copies of internal
226  * contexts so additional data can be included after the finalisation call.
227  * This is inefficient if this functionality is not required: it is disabled
228  * if the following flag is set.
229  */
230 # define EVP_MD_CTX_FLAG_FINALISE        0x0200
231 /* NOTE: 0x0400 is reserved for internal usage */
232 # ifndef OPENSSL_NO_DEPRECATED_3_0
233 OSSL_DEPRECATEDIN_3_0
234 EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len);
235 OSSL_DEPRECATEDIN_3_0
236 EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher);
237 OSSL_DEPRECATEDIN_3_0
238 void EVP_CIPHER_meth_free(EVP_CIPHER *cipher);
239 OSSL_DEPRECATEDIN_3_0
240 int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len);
241 OSSL_DEPRECATEDIN_3_0
242 int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags);
243 OSSL_DEPRECATEDIN_3_0
244 int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size);
245 OSSL_DEPRECATEDIN_3_0
246 int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,
247                              int (*init) (EVP_CIPHER_CTX *ctx,
248                                           const unsigned char *key,
249                                           const unsigned char *iv,
250                                           int enc));
251 OSSL_DEPRECATEDIN_3_0
252 int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,
253                                   int (*do_cipher) (EVP_CIPHER_CTX *ctx,
254                                                     unsigned char *out,
255                                                     const unsigned char *in,
256                                                     size_t inl));
257 OSSL_DEPRECATEDIN_3_0
258 int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,
259                                 int (*cleanup) (EVP_CIPHER_CTX *));
260 OSSL_DEPRECATEDIN_3_0
261 int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher,
262                                         int (*set_asn1_parameters) (EVP_CIPHER_CTX *,
263                                                                     ASN1_TYPE *));
264 OSSL_DEPRECATEDIN_3_0
265 int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher,
266                                         int (*get_asn1_parameters) (EVP_CIPHER_CTX *,
267                                                                     ASN1_TYPE *));
268 OSSL_DEPRECATEDIN_3_0
269 int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,
270                              int (*ctrl) (EVP_CIPHER_CTX *, int type,
271                                           int arg, void *ptr));
272 OSSL_DEPRECATEDIN_3_0 int
273 (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
274                                                       const unsigned char *key,
275                                                       const unsigned char *iv,
276                                                       int enc);
277 OSSL_DEPRECATEDIN_3_0 int
278 (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
279                                                            unsigned char *out,
280                                                            const unsigned char *in,
281                                                            size_t inl);
282 OSSL_DEPRECATEDIN_3_0 int
283 (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);
284 OSSL_DEPRECATEDIN_3_0 int
285 (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
286                                                                  ASN1_TYPE *);
287 OSSL_DEPRECATEDIN_3_0 int
288 (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
289                                                                  ASN1_TYPE *);
290 OSSL_DEPRECATEDIN_3_0 int
291 (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, int type,
292                                                       int arg, void *ptr);
293 # endif
294 
295 /* Values for cipher flags */
296 
297 /* Modes for ciphers */
298 
299 # define         EVP_CIPH_STREAM_CIPHER          0x0
300 # define         EVP_CIPH_ECB_MODE               0x1
301 # define         EVP_CIPH_CBC_MODE               0x2
302 # define         EVP_CIPH_CFB_MODE               0x3
303 # define         EVP_CIPH_OFB_MODE               0x4
304 # define         EVP_CIPH_CTR_MODE               0x5
305 # define         EVP_CIPH_GCM_MODE               0x6
306 # define         EVP_CIPH_CCM_MODE               0x7
307 # define         EVP_CIPH_XTS_MODE               0x10001
308 # define         EVP_CIPH_WRAP_MODE              0x10002
309 # define         EVP_CIPH_OCB_MODE               0x10003
310 # define         EVP_CIPH_SIV_MODE               0x10004
311 # define         EVP_CIPH_MODE                   0xF0007
312 /* Set if variable length cipher */
313 # define         EVP_CIPH_VARIABLE_LENGTH        0x8
314 /* Set if the iv handling should be done by the cipher itself */
315 # define         EVP_CIPH_CUSTOM_IV              0x10
316 /* Set if the cipher's init() function should be called if key is NULL */
317 # define         EVP_CIPH_ALWAYS_CALL_INIT       0x20
318 /* Call ctrl() to init cipher parameters */
319 # define         EVP_CIPH_CTRL_INIT              0x40
320 /* Don't use standard key length function */
321 # define         EVP_CIPH_CUSTOM_KEY_LENGTH      0x80
322 /* Don't use standard block padding */
323 # define         EVP_CIPH_NO_PADDING             0x100
324 /* cipher handles random key generation */
325 # define         EVP_CIPH_RAND_KEY               0x200
326 /* cipher has its own additional copying logic */
327 # define         EVP_CIPH_CUSTOM_COPY            0x400
328 /* Don't use standard iv length function */
329 # define         EVP_CIPH_CUSTOM_IV_LENGTH       0x800
330 /* Legacy and no longer relevant: Allow use default ASN1 get/set iv */
331 # define         EVP_CIPH_FLAG_DEFAULT_ASN1      0
332 /* Free:                                         0x1000 */
333 /* Buffer length in bits not bytes: CFB1 mode only */
334 # define         EVP_CIPH_FLAG_LENGTH_BITS       0x2000
335 /* Deprecated FIPS flag: was 0x4000 */
336 # define         EVP_CIPH_FLAG_FIPS              0
337 /* Deprecated FIPS flag: was 0x8000 */
338 # define         EVP_CIPH_FLAG_NON_FIPS_ALLOW    0
339 
340 /*
341  * Cipher handles any and all padding logic as well as finalisation.
342  */
343 # define         EVP_CIPH_FLAG_CTS               0x4000
344 # define         EVP_CIPH_FLAG_CUSTOM_CIPHER     0x100000
345 # define         EVP_CIPH_FLAG_AEAD_CIPHER       0x200000
346 # define         EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000
347 /* Cipher can handle pipeline operations */
348 # define         EVP_CIPH_FLAG_PIPELINE          0X800000
349 /* For provider implementations that handle  ASN1 get/set param themselves */
350 # define         EVP_CIPH_FLAG_CUSTOM_ASN1       0x1000000
351 /* For ciphers generating unprotected CMS attributes */
352 # define         EVP_CIPH_FLAG_CIPHER_WITH_MAC   0x2000000
353 /* For supplementary wrap cipher support */
354 # define         EVP_CIPH_FLAG_GET_WRAP_CIPHER   0x4000000
355 # define         EVP_CIPH_FLAG_INVERSE_CIPHER    0x8000000
356 
357 /*
358  * Cipher context flag to indicate we can handle wrap mode: if allowed in
359  * older applications it could overflow buffers.
360  */
361 
362 # define         EVP_CIPHER_CTX_FLAG_WRAP_ALLOW  0x1
363 
364 /* ctrl() values */
365 
366 # define         EVP_CTRL_INIT                   0x0
367 # define         EVP_CTRL_SET_KEY_LENGTH         0x1
368 # define         EVP_CTRL_GET_RC2_KEY_BITS       0x2
369 # define         EVP_CTRL_SET_RC2_KEY_BITS       0x3
370 # define         EVP_CTRL_GET_RC5_ROUNDS         0x4
371 # define         EVP_CTRL_SET_RC5_ROUNDS         0x5
372 # define         EVP_CTRL_RAND_KEY               0x6
373 # define         EVP_CTRL_PBE_PRF_NID            0x7
374 # define         EVP_CTRL_COPY                   0x8
375 # define         EVP_CTRL_AEAD_SET_IVLEN         0x9
376 # define         EVP_CTRL_AEAD_GET_TAG           0x10
377 # define         EVP_CTRL_AEAD_SET_TAG           0x11
378 # define         EVP_CTRL_AEAD_SET_IV_FIXED      0x12
379 # define         EVP_CTRL_GCM_SET_IVLEN          EVP_CTRL_AEAD_SET_IVLEN
380 # define         EVP_CTRL_GCM_GET_TAG            EVP_CTRL_AEAD_GET_TAG
381 # define         EVP_CTRL_GCM_SET_TAG            EVP_CTRL_AEAD_SET_TAG
382 # define         EVP_CTRL_GCM_SET_IV_FIXED       EVP_CTRL_AEAD_SET_IV_FIXED
383 # define         EVP_CTRL_GCM_IV_GEN             0x13
384 # define         EVP_CTRL_CCM_SET_IVLEN          EVP_CTRL_AEAD_SET_IVLEN
385 # define         EVP_CTRL_CCM_GET_TAG            EVP_CTRL_AEAD_GET_TAG
386 # define         EVP_CTRL_CCM_SET_TAG            EVP_CTRL_AEAD_SET_TAG
387 # define         EVP_CTRL_CCM_SET_IV_FIXED       EVP_CTRL_AEAD_SET_IV_FIXED
388 # define         EVP_CTRL_CCM_SET_L              0x14
389 # define         EVP_CTRL_CCM_SET_MSGLEN         0x15
390 /*
391  * AEAD cipher deduces payload length and returns number of bytes required to
392  * store MAC and eventual padding. Subsequent call to EVP_Cipher even
393  * appends/verifies MAC.
394  */
395 # define         EVP_CTRL_AEAD_TLS1_AAD          0x16
396 /* Used by composite AEAD ciphers, no-op in GCM, CCM... */
397 # define         EVP_CTRL_AEAD_SET_MAC_KEY       0x17
398 /* Set the GCM invocation field, decrypt only */
399 # define         EVP_CTRL_GCM_SET_IV_INV         0x18
400 
401 # define         EVP_CTRL_TLS1_1_MULTIBLOCK_AAD  0x19
402 # define         EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT      0x1a
403 # define         EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT      0x1b
404 # define         EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE  0x1c
405 
406 # define         EVP_CTRL_SSL3_MASTER_SECRET             0x1d
407 
408 /* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */
409 # define         EVP_CTRL_SET_SBOX                       0x1e
410 /*
411  * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a
412  * pre-allocated buffer with specified size
413  */
414 # define         EVP_CTRL_SBOX_USED                      0x1f
415 /* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after,
416  * 0 switches meshing off
417  */
418 # define         EVP_CTRL_KEY_MESH                       0x20
419 /* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */
420 # define         EVP_CTRL_BLOCK_PADDING_MODE             0x21
421 
422 /* Set the output buffers to use for a pipelined operation */
423 # define         EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS       0x22
424 /* Set the input buffers to use for a pipelined operation */
425 # define         EVP_CTRL_SET_PIPELINE_INPUT_BUFS        0x23
426 /* Set the input buffer lengths to use for a pipelined operation */
427 # define         EVP_CTRL_SET_PIPELINE_INPUT_LENS        0x24
428 /* Get the IV length used by the cipher */
429 # define         EVP_CTRL_GET_IVLEN                      0x25
430 /* 0x26 is unused */
431 /* Tell the cipher it's doing a speed test (SIV disallows multiple ops) */
432 # define         EVP_CTRL_SET_SPEED                      0x27
433 /* Get the unprotectedAttrs from cipher ctx */
434 # define         EVP_CTRL_PROCESS_UNPROTECTED            0x28
435 /* Get the supplementary wrap cipher */
436 #define          EVP_CTRL_GET_WRAP_CIPHER                0x29
437 /* TLSTREE key diversification */
438 #define          EVP_CTRL_TLSTREE                        0x2A
439 
440 /* Padding modes */
441 #define EVP_PADDING_PKCS7       1
442 #define EVP_PADDING_ISO7816_4   2
443 #define EVP_PADDING_ANSI923     3
444 #define EVP_PADDING_ISO10126    4
445 #define EVP_PADDING_ZERO        5
446 
447 /* RFC 5246 defines additional data to be 13 bytes in length */
448 # define         EVP_AEAD_TLS1_AAD_LEN           13
449 
450 typedef struct {
451     unsigned char *out;
452     const unsigned char *inp;
453     size_t len;
454     unsigned int interleave;
455 } EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM;
456 
457 /* GCM TLS constants */
458 /* Length of fixed part of IV derived from PRF */
459 # define EVP_GCM_TLS_FIXED_IV_LEN                        4
460 /* Length of explicit part of IV part of TLS records */
461 # define EVP_GCM_TLS_EXPLICIT_IV_LEN                     8
462 /* Length of tag for TLS */
463 # define EVP_GCM_TLS_TAG_LEN                             16
464 
465 /* CCM TLS constants */
466 /* Length of fixed part of IV derived from PRF */
467 # define EVP_CCM_TLS_FIXED_IV_LEN                        4
468 /* Length of explicit part of IV part of TLS records */
469 # define EVP_CCM_TLS_EXPLICIT_IV_LEN                     8
470 /* Total length of CCM IV length for TLS */
471 # define EVP_CCM_TLS_IV_LEN                              12
472 /* Length of tag for TLS */
473 # define EVP_CCM_TLS_TAG_LEN                             16
474 /* Length of CCM8 tag for TLS */
475 # define EVP_CCM8_TLS_TAG_LEN                            8
476 
477 /* Length of tag for TLS */
478 # define EVP_CHACHAPOLY_TLS_TAG_LEN                      16
479 
480 typedef struct evp_cipher_info_st {
481     const EVP_CIPHER *cipher;
482     unsigned char iv[EVP_MAX_IV_LENGTH];
483 } EVP_CIPHER_INFO;
484 
485 
486 /* Password based encryption function */
487 typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass,
488                               int passlen, ASN1_TYPE *param,
489                               const EVP_CIPHER *cipher, const EVP_MD *md,
490                               int en_de);
491 
492 typedef int (EVP_PBE_KEYGEN_EX) (EVP_CIPHER_CTX *ctx, const char *pass,
493                                  int passlen, ASN1_TYPE *param,
494                                  const EVP_CIPHER *cipher, const EVP_MD *md,
495                                  int en_de, OSSL_LIB_CTX *libctx, const char *propq);
496 
497 # ifndef OPENSSL_NO_DEPRECATED_3_0
498 #  define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
499                                                          (rsa))
500 # endif
501 
502 # ifndef OPENSSL_NO_DSA
503 #  define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
504                                         (dsa))
505 # endif
506 
507 # if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0)
508 #  define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,(dh))
509 # endif
510 
511 # ifndef OPENSSL_NO_DEPRECATED_3_0
512 #  ifndef OPENSSL_NO_EC
513 #   define EVP_PKEY_assign_EC_KEY(pkey,eckey) \
514         EVP_PKEY_assign((pkey), EVP_PKEY_EC, (eckey))
515 #  endif
516 # endif
517 # ifndef OPENSSL_NO_SIPHASH
518 #  define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),\
519                                         EVP_PKEY_SIPHASH,(shkey))
520 # endif
521 
522 # ifndef OPENSSL_NO_POLY1305
523 #  define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),\
524                                         EVP_PKEY_POLY1305,(polykey))
525 # endif
526 
527 /* Add some extra combinations */
528 # define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
529 # define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
530 # define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))
531 # define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
532 
533 int EVP_MD_get_type(const EVP_MD *md);
534 # define EVP_MD_type EVP_MD_get_type
535 # define EVP_MD_nid EVP_MD_get_type
536 const char *EVP_MD_get0_name(const EVP_MD *md);
537 # define EVP_MD_name EVP_MD_get0_name
538 const char *EVP_MD_get0_description(const EVP_MD *md);
539 int EVP_MD_is_a(const EVP_MD *md, const char *name);
540 int EVP_MD_names_do_all(const EVP_MD *md,
541                         void (*fn)(const char *name, void *data),
542                         void *data);
543 const OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md);
544 int EVP_MD_get_pkey_type(const EVP_MD *md);
545 # define EVP_MD_pkey_type EVP_MD_get_pkey_type
546 int EVP_MD_get_size(const EVP_MD *md);
547 # define EVP_MD_size EVP_MD_get_size
548 int EVP_MD_get_block_size(const EVP_MD *md);
549 # define EVP_MD_block_size EVP_MD_get_block_size
550 unsigned long EVP_MD_get_flags(const EVP_MD *md);
551 # define EVP_MD_flags EVP_MD_get_flags
552 
553 const EVP_MD *EVP_MD_CTX_get0_md(const EVP_MD_CTX *ctx);
554 EVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx);
555 # ifndef OPENSSL_NO_DEPRECATED_3_0
556 OSSL_DEPRECATEDIN_3_0
557 const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
558 OSSL_DEPRECATEDIN_3_0
559 int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,
560                                              const void *data, size_t count);
561 OSSL_DEPRECATEDIN_3_0
562 void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,
563                               int (*update) (EVP_MD_CTX *ctx,
564                                              const void *data, size_t count));
565 # endif
566 # define EVP_MD_CTX_get0_name(e)       EVP_MD_get0_name(EVP_MD_CTX_get0_md(e))
567 # define EVP_MD_CTX_get_size(e)        EVP_MD_get_size(EVP_MD_CTX_get0_md(e))
568 # define EVP_MD_CTX_size               EVP_MD_CTX_get_size
569 # define EVP_MD_CTX_get_block_size(e)  EVP_MD_get_block_size(EVP_MD_CTX_get0_md(e))
570 # define EVP_MD_CTX_block_size EVP_MD_CTX_get_block_size
571 # define EVP_MD_CTX_get_type(e)            EVP_MD_get_type(EVP_MD_CTX_get0_md(e))
572 # define EVP_MD_CTX_type EVP_MD_CTX_get_type
573 EVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx);
574 # define EVP_MD_CTX_pkey_ctx EVP_MD_CTX_get_pkey_ctx
575 void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);
576 void *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx);
577 # define EVP_MD_CTX_md_data EVP_MD_CTX_get0_md_data
578 
579 int EVP_CIPHER_get_nid(const EVP_CIPHER *cipher);
580 # define EVP_CIPHER_nid EVP_CIPHER_get_nid
581 const char *EVP_CIPHER_get0_name(const EVP_CIPHER *cipher);
582 # define EVP_CIPHER_name EVP_CIPHER_get0_name
583 const char *EVP_CIPHER_get0_description(const EVP_CIPHER *cipher);
584 int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name);
585 int EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,
586                             void (*fn)(const char *name, void *data),
587                             void *data);
588 const OSSL_PROVIDER *EVP_CIPHER_get0_provider(const EVP_CIPHER *cipher);
589 int EVP_CIPHER_get_block_size(const EVP_CIPHER *cipher);
590 # define EVP_CIPHER_block_size EVP_CIPHER_get_block_size
591 # ifndef OPENSSL_NO_DEPRECATED_3_0
592 OSSL_DEPRECATEDIN_3_0
593 int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher);
594 # endif
595 int EVP_CIPHER_get_key_length(const EVP_CIPHER *cipher);
596 # define EVP_CIPHER_key_length EVP_CIPHER_get_key_length
597 int EVP_CIPHER_get_iv_length(const EVP_CIPHER *cipher);
598 # define EVP_CIPHER_iv_length EVP_CIPHER_get_iv_length
599 unsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *cipher);
600 # define EVP_CIPHER_flags EVP_CIPHER_get_flags
601 int EVP_CIPHER_get_mode(const EVP_CIPHER *cipher);
602 # define EVP_CIPHER_mode EVP_CIPHER_get_mode
603 int EVP_CIPHER_get_type(const EVP_CIPHER *cipher);
604 # define EVP_CIPHER_type EVP_CIPHER_get_type
605 EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
606                              const char *properties);
607 int EVP_CIPHER_up_ref(EVP_CIPHER *cipher);
608 void EVP_CIPHER_free(EVP_CIPHER *cipher);
609 
610 const EVP_CIPHER *EVP_CIPHER_CTX_get0_cipher(const EVP_CIPHER_CTX *ctx);
611 EVP_CIPHER *EVP_CIPHER_CTX_get1_cipher(EVP_CIPHER_CTX *ctx);
612 int EVP_CIPHER_CTX_is_encrypting(const EVP_CIPHER_CTX *ctx);
613 # define EVP_CIPHER_CTX_encrypting EVP_CIPHER_CTX_is_encrypting
614 int EVP_CIPHER_CTX_get_nid(const EVP_CIPHER_CTX *ctx);
615 # define EVP_CIPHER_CTX_nid EVP_CIPHER_CTX_get_nid
616 int EVP_CIPHER_CTX_get_block_size(const EVP_CIPHER_CTX *ctx);
617 # define EVP_CIPHER_CTX_block_size EVP_CIPHER_CTX_get_block_size
618 int EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx);
619 # define EVP_CIPHER_CTX_key_length EVP_CIPHER_CTX_get_key_length
620 int EVP_CIPHER_CTX_get_iv_length(const EVP_CIPHER_CTX *ctx);
621 # define EVP_CIPHER_CTX_iv_length EVP_CIPHER_CTX_get_iv_length
622 int EVP_CIPHER_CTX_get_tag_length(const EVP_CIPHER_CTX *ctx);
623 # define EVP_CIPHER_CTX_tag_length EVP_CIPHER_CTX_get_tag_length
624 # ifndef OPENSSL_NO_DEPRECATED_3_0
625 const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);
626 OSSL_DEPRECATEDIN_3_0 const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);
627 OSSL_DEPRECATEDIN_3_0 const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);
628 OSSL_DEPRECATEDIN_3_0 unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);
629 # endif
630 int EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
631 int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
632 # ifndef OPENSSL_NO_DEPRECATED_3_0
633 OSSL_DEPRECATEDIN_3_0
634 unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);
635 # endif
636 int EVP_CIPHER_CTX_get_num(const EVP_CIPHER_CTX *ctx);
637 # define EVP_CIPHER_CTX_num EVP_CIPHER_CTX_get_num
638 int EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num);
639 int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
640 void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
641 void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
642 void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);
643 void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);
644 # define EVP_CIPHER_CTX_get0_name(c) EVP_CIPHER_get0_name(EVP_CIPHER_CTX_get0_cipher(c))
645 # define EVP_CIPHER_CTX_get_type(c)  EVP_CIPHER_get_type(EVP_CIPHER_CTX_get0_cipher(c))
646 # define EVP_CIPHER_CTX_type         EVP_CIPHER_CTX_get_type
647 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
648 #  define EVP_CIPHER_CTX_flags(c)    EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(c))
649 # endif
650 # define EVP_CIPHER_CTX_get_mode(c)  EVP_CIPHER_get_mode(EVP_CIPHER_CTX_get0_cipher(c))
651 # define EVP_CIPHER_CTX_mode         EVP_CIPHER_CTX_get_mode
652 
653 # define EVP_ENCODE_LENGTH(l)    ((((l)+2)/3*4)+((l)/48+1)*2+80)
654 # define EVP_DECODE_LENGTH(l)    (((l)+3)/4*3+80)
655 
656 # define EVP_SignInit_ex(a,b,c)          EVP_DigestInit_ex(a,b,c)
657 # define EVP_SignInit(a,b)               EVP_DigestInit(a,b)
658 # define EVP_SignUpdate(a,b,c)           EVP_DigestUpdate(a,b,c)
659 # define EVP_VerifyInit_ex(a,b,c)        EVP_DigestInit_ex(a,b,c)
660 # define EVP_VerifyInit(a,b)             EVP_DigestInit(a,b)
661 # define EVP_VerifyUpdate(a,b,c)         EVP_DigestUpdate(a,b,c)
662 # define EVP_OpenUpdate(a,b,c,d,e)       EVP_DecryptUpdate(a,b,c,d,e)
663 # define EVP_SealUpdate(a,b,c,d,e)       EVP_EncryptUpdate(a,b,c,d,e)
664 
665 # ifdef CONST_STRICT
666 void BIO_set_md(BIO *, const EVP_MD *md);
667 # else
668 #  define BIO_set_md(b,md)          BIO_ctrl(b,BIO_C_SET_MD,0,(void *)(md))
669 # endif
670 # define BIO_get_md(b,mdp)          BIO_ctrl(b,BIO_C_GET_MD,0,(mdp))
671 # define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(mdcp))
672 # define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(mdcp))
673 # define BIO_get_cipher_status(b)   BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
674 # define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(c_pp))
675 
676 /*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c,
677                           unsigned char *out,
678                           const unsigned char *in, unsigned int inl);
679 
680 # define EVP_add_cipher_alias(n,alias) \
681         OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
682 # define EVP_add_digest_alias(n,alias) \
683         OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
684 # define EVP_delete_cipher_alias(alias) \
685         OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);
686 # define EVP_delete_digest_alias(alias) \
687         OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
688 
689 int EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]);
690 int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);
691 int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);
692 const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest);
693 const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);
694 const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);
695 const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);
696 const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);
697 int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
698 EVP_MD_CTX *EVP_MD_CTX_new(void);
699 int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
700 void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
701 # define EVP_MD_CTX_create()     EVP_MD_CTX_new()
702 # define EVP_MD_CTX_init(ctx)    EVP_MD_CTX_reset((ctx))
703 # define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx))
704 __owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
705 void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
706 void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
707 int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);
708 __owur int EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type,
709                               const OSSL_PARAM params[]);
710 __owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type,
711                                  ENGINE *impl);
712 __owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d,
713                                 size_t cnt);
714 __owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md,
715                                   unsigned int *s);
716 __owur int EVP_Digest(const void *data, size_t count,
717                           unsigned char *md, unsigned int *size,
718                           const EVP_MD *type, ENGINE *impl);
719 __owur int EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name,
720                         const char *propq, const void *data, size_t datalen,
721                         unsigned char *md, size_t *mdlen);
722 
723 __owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
724 __owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
725 __owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md,
726                            unsigned int *s);
727 __owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md,
728                               size_t len);
729 
730 __owur EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
731                             const char *properties);
732 
733 int EVP_MD_up_ref(EVP_MD *md);
734 void EVP_MD_free(EVP_MD *md);
735 
736 int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
737 int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
738                            const char *prompt, int verify);
739 void EVP_set_pw_prompt(const char *prompt);
740 char *EVP_get_pw_prompt(void);
741 
742 __owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
743                           const unsigned char *salt,
744                           const unsigned char *data, int datal, int count,
745                           unsigned char *key, unsigned char *iv);
746 
747 void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);
748 void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);
749 int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);
750 
751 __owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
752                            const unsigned char *key, const unsigned char *iv);
753 /*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,
754                                   const EVP_CIPHER *cipher, ENGINE *impl,
755                                   const unsigned char *key,
756                                   const unsigned char *iv);
757 __owur int EVP_EncryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
758                                const unsigned char *key,
759                                const unsigned char *iv,
760                                const OSSL_PARAM params[]);
761 /*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
762                                  int *outl, const unsigned char *in, int inl);
763 /*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
764                                    int *outl);
765 /*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
766                                 int *outl);
767 
768 __owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
769                            const unsigned char *key, const unsigned char *iv);
770 /*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,
771                                   const EVP_CIPHER *cipher, ENGINE *impl,
772                                   const unsigned char *key,
773                                   const unsigned char *iv);
774 __owur int EVP_DecryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
775                                const unsigned char *key,
776                                const unsigned char *iv,
777                                const OSSL_PARAM params[]);
778 /*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
779                                  int *outl, const unsigned char *in, int inl);
780 __owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
781                             int *outl);
782 /*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
783                                    int *outl);
784 
785 __owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
786                           const unsigned char *key, const unsigned char *iv,
787                           int enc);
788 /*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,
789                                  const EVP_CIPHER *cipher, ENGINE *impl,
790                                  const unsigned char *key,
791                                  const unsigned char *iv, int enc);
792 __owur int EVP_CipherInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
793                               const unsigned char *key, const unsigned char *iv,
794                               int enc, const OSSL_PARAM params[]);
795 __owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
796                             int *outl, const unsigned char *in, int inl);
797 __owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
798                            int *outl);
799 __owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
800                               int *outl);
801 
802 __owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,
803                          EVP_PKEY *pkey);
804 __owur int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,
805                             EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
806                             const char *propq);
807 
808 __owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret,
809                           size_t *siglen, const unsigned char *tbs,
810                           size_t tbslen);
811 
812 __owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
813                            unsigned int siglen, EVP_PKEY *pkey);
814 __owur int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
815                               unsigned int siglen, EVP_PKEY *pkey,
816                               OSSL_LIB_CTX *libctx, const char *propq);
817 
818 __owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret,
819                             size_t siglen, const unsigned char *tbs,
820                             size_t tbslen);
821 
822 int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
823                           const char *mdname, OSSL_LIB_CTX *libctx,
824                           const char *props, EVP_PKEY *pkey,
825                           const OSSL_PARAM params[]);
826 /*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
827                                   const EVP_MD *type, ENGINE *e,
828                                   EVP_PKEY *pkey);
829 int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize);
830 __owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
831                                size_t *siglen);
832 
833 int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
834                             const char *mdname, OSSL_LIB_CTX *libctx,
835                             const char *props, EVP_PKEY *pkey,
836                             const OSSL_PARAM params[]);
837 __owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
838                                 const EVP_MD *type, ENGINE *e,
839                                 EVP_PKEY *pkey);
840 int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize);
841 __owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,
842                                  size_t siglen);
843 
844 __owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
845                         const unsigned char *ek, int ekl,
846                         const unsigned char *iv, EVP_PKEY *priv);
847 __owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
848 
849 __owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
850                         unsigned char **ek, int *ekl, unsigned char *iv,
851                         EVP_PKEY **pubk, int npubk);
852 __owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
853 
854 EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void);
855 void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx);
856 int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, const EVP_ENCODE_CTX *sctx);
857 int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx);
858 void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
859 int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
860                      const unsigned char *in, int inl);
861 void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);
862 int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
863 
864 void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
865 int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
866                      const unsigned char *in, int inl);
867 int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
868                     char *out, int *outl);
869 int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
870 
871 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
872 #  define EVP_CIPHER_CTX_init(c)      EVP_CIPHER_CTX_reset(c)
873 #  define EVP_CIPHER_CTX_cleanup(c)   EVP_CIPHER_CTX_reset(c)
874 # endif
875 EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
876 int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c);
877 void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c);
878 int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
879 int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
880 int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
881 int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
882 int EVP_CIPHER_get_params(EVP_CIPHER *cipher, OSSL_PARAM params[]);
883 int EVP_CIPHER_CTX_set_params(EVP_CIPHER_CTX *ctx, const OSSL_PARAM params[]);
884 int EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]);
885 const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher);
886 const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher);
887 const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher);
888 const OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *ctx);
889 const OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *ctx);
890 
891 const BIO_METHOD *BIO_f_md(void);
892 const BIO_METHOD *BIO_f_base64(void);
893 const BIO_METHOD *BIO_f_cipher(void);
894 const BIO_METHOD *BIO_f_reliable(void);
895 __owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,
896                           const unsigned char *i, int enc);
897 
898 const EVP_MD *EVP_md_null(void);
899 # ifndef OPENSSL_NO_MD2
900 const EVP_MD *EVP_md2(void);
901 # endif
902 # ifndef OPENSSL_NO_MD4
903 const EVP_MD *EVP_md4(void);
904 # endif
905 # ifndef OPENSSL_NO_MD5
906 const EVP_MD *EVP_md5(void);
907 const EVP_MD *EVP_md5_sha1(void);
908 # endif
909 # ifndef OPENSSL_NO_BLAKE2
910 const EVP_MD *EVP_blake2b512(void);
911 const EVP_MD *EVP_blake2s256(void);
912 # endif
913 const EVP_MD *EVP_sha1(void);
914 const EVP_MD *EVP_sha224(void);
915 const EVP_MD *EVP_sha256(void);
916 const EVP_MD *EVP_sha384(void);
917 const EVP_MD *EVP_sha512(void);
918 const EVP_MD *EVP_sha512_224(void);
919 const EVP_MD *EVP_sha512_256(void);
920 const EVP_MD *EVP_sha3_224(void);
921 const EVP_MD *EVP_sha3_256(void);
922 const EVP_MD *EVP_sha3_384(void);
923 const EVP_MD *EVP_sha3_512(void);
924 const EVP_MD *EVP_shake128(void);
925 const EVP_MD *EVP_shake256(void);
926 
927 # ifndef OPENSSL_NO_MDC2
928 const EVP_MD *EVP_mdc2(void);
929 # endif
930 # ifndef OPENSSL_NO_RMD160
931 const EVP_MD *EVP_ripemd160(void);
932 # endif
933 # ifndef OPENSSL_NO_WHIRLPOOL
934 const EVP_MD *EVP_whirlpool(void);
935 # endif
936 # ifndef OPENSSL_NO_SM3
937 const EVP_MD *EVP_sm3(void);
938 # endif
939 const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
940 # ifndef OPENSSL_NO_DES
941 const EVP_CIPHER *EVP_des_ecb(void);
942 const EVP_CIPHER *EVP_des_ede(void);
943 const EVP_CIPHER *EVP_des_ede3(void);
944 const EVP_CIPHER *EVP_des_ede_ecb(void);
945 const EVP_CIPHER *EVP_des_ede3_ecb(void);
946 const EVP_CIPHER *EVP_des_cfb64(void);
947 #  define EVP_des_cfb EVP_des_cfb64
948 const EVP_CIPHER *EVP_des_cfb1(void);
949 const EVP_CIPHER *EVP_des_cfb8(void);
950 const EVP_CIPHER *EVP_des_ede_cfb64(void);
951 #  define EVP_des_ede_cfb EVP_des_ede_cfb64
952 const EVP_CIPHER *EVP_des_ede3_cfb64(void);
953 #  define EVP_des_ede3_cfb EVP_des_ede3_cfb64
954 const EVP_CIPHER *EVP_des_ede3_cfb1(void);
955 const EVP_CIPHER *EVP_des_ede3_cfb8(void);
956 const EVP_CIPHER *EVP_des_ofb(void);
957 const EVP_CIPHER *EVP_des_ede_ofb(void);
958 const EVP_CIPHER *EVP_des_ede3_ofb(void);
959 const EVP_CIPHER *EVP_des_cbc(void);
960 const EVP_CIPHER *EVP_des_ede_cbc(void);
961 const EVP_CIPHER *EVP_des_ede3_cbc(void);
962 const EVP_CIPHER *EVP_desx_cbc(void);
963 const EVP_CIPHER *EVP_des_ede3_wrap(void);
964 /*
965  * This should now be supported through the dev_crypto ENGINE. But also, why
966  * are rc4 and md5 declarations made here inside a "NO_DES" precompiler
967  * branch?
968  */
969 # endif
970 # ifndef OPENSSL_NO_RC4
971 const EVP_CIPHER *EVP_rc4(void);
972 const EVP_CIPHER *EVP_rc4_40(void);
973 #  ifndef OPENSSL_NO_MD5
974 const EVP_CIPHER *EVP_rc4_hmac_md5(void);
975 #  endif
976 # endif
977 # ifndef OPENSSL_NO_IDEA
978 const EVP_CIPHER *EVP_idea_ecb(void);
979 const EVP_CIPHER *EVP_idea_cfb64(void);
980 #  define EVP_idea_cfb EVP_idea_cfb64
981 const EVP_CIPHER *EVP_idea_ofb(void);
982 const EVP_CIPHER *EVP_idea_cbc(void);
983 # endif
984 # ifndef OPENSSL_NO_RC2
985 const EVP_CIPHER *EVP_rc2_ecb(void);
986 const EVP_CIPHER *EVP_rc2_cbc(void);
987 const EVP_CIPHER *EVP_rc2_40_cbc(void);
988 const EVP_CIPHER *EVP_rc2_64_cbc(void);
989 const EVP_CIPHER *EVP_rc2_cfb64(void);
990 #  define EVP_rc2_cfb EVP_rc2_cfb64
991 const EVP_CIPHER *EVP_rc2_ofb(void);
992 # endif
993 # ifndef OPENSSL_NO_BF
994 const EVP_CIPHER *EVP_bf_ecb(void);
995 const EVP_CIPHER *EVP_bf_cbc(void);
996 const EVP_CIPHER *EVP_bf_cfb64(void);
997 #  define EVP_bf_cfb EVP_bf_cfb64
998 const EVP_CIPHER *EVP_bf_ofb(void);
999 # endif
1000 # ifndef OPENSSL_NO_CAST
1001 const EVP_CIPHER *EVP_cast5_ecb(void);
1002 const EVP_CIPHER *EVP_cast5_cbc(void);
1003 const EVP_CIPHER *EVP_cast5_cfb64(void);
1004 #  define EVP_cast5_cfb EVP_cast5_cfb64
1005 const EVP_CIPHER *EVP_cast5_ofb(void);
1006 # endif
1007 # ifndef OPENSSL_NO_RC5
1008 const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
1009 const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
1010 const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
1011 #  define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
1012 const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
1013 # endif
1014 const EVP_CIPHER *EVP_aes_128_ecb(void);
1015 const EVP_CIPHER *EVP_aes_128_cbc(void);
1016 const EVP_CIPHER *EVP_aes_128_cfb1(void);
1017 const EVP_CIPHER *EVP_aes_128_cfb8(void);
1018 const EVP_CIPHER *EVP_aes_128_cfb128(void);
1019 # define EVP_aes_128_cfb EVP_aes_128_cfb128
1020 const EVP_CIPHER *EVP_aes_128_ofb(void);
1021 const EVP_CIPHER *EVP_aes_128_ctr(void);
1022 const EVP_CIPHER *EVP_aes_128_ccm(void);
1023 const EVP_CIPHER *EVP_aes_128_gcm(void);
1024 const EVP_CIPHER *EVP_aes_128_xts(void);
1025 const EVP_CIPHER *EVP_aes_128_wrap(void);
1026 const EVP_CIPHER *EVP_aes_128_wrap_pad(void);
1027 # ifndef OPENSSL_NO_OCB
1028 const EVP_CIPHER *EVP_aes_128_ocb(void);
1029 # endif
1030 const EVP_CIPHER *EVP_aes_192_ecb(void);
1031 const EVP_CIPHER *EVP_aes_192_cbc(void);
1032 const EVP_CIPHER *EVP_aes_192_cfb1(void);
1033 const EVP_CIPHER *EVP_aes_192_cfb8(void);
1034 const EVP_CIPHER *EVP_aes_192_cfb128(void);
1035 # define EVP_aes_192_cfb EVP_aes_192_cfb128
1036 const EVP_CIPHER *EVP_aes_192_ofb(void);
1037 const EVP_CIPHER *EVP_aes_192_ctr(void);
1038 const EVP_CIPHER *EVP_aes_192_ccm(void);
1039 const EVP_CIPHER *EVP_aes_192_gcm(void);
1040 const EVP_CIPHER *EVP_aes_192_wrap(void);
1041 const EVP_CIPHER *EVP_aes_192_wrap_pad(void);
1042 # ifndef OPENSSL_NO_OCB
1043 const EVP_CIPHER *EVP_aes_192_ocb(void);
1044 # endif
1045 const EVP_CIPHER *EVP_aes_256_ecb(void);
1046 const EVP_CIPHER *EVP_aes_256_cbc(void);
1047 const EVP_CIPHER *EVP_aes_256_cfb1(void);
1048 const EVP_CIPHER *EVP_aes_256_cfb8(void);
1049 const EVP_CIPHER *EVP_aes_256_cfb128(void);
1050 # define EVP_aes_256_cfb EVP_aes_256_cfb128
1051 const EVP_CIPHER *EVP_aes_256_ofb(void);
1052 const EVP_CIPHER *EVP_aes_256_ctr(void);
1053 const EVP_CIPHER *EVP_aes_256_ccm(void);
1054 const EVP_CIPHER *EVP_aes_256_gcm(void);
1055 const EVP_CIPHER *EVP_aes_256_xts(void);
1056 const EVP_CIPHER *EVP_aes_256_wrap(void);
1057 const EVP_CIPHER *EVP_aes_256_wrap_pad(void);
1058 # ifndef OPENSSL_NO_OCB
1059 const EVP_CIPHER *EVP_aes_256_ocb(void);
1060 # endif
1061 const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
1062 const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
1063 const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void);
1064 const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void);
1065 # ifndef OPENSSL_NO_ARIA
1066 const EVP_CIPHER *EVP_aria_128_ecb(void);
1067 const EVP_CIPHER *EVP_aria_128_cbc(void);
1068 const EVP_CIPHER *EVP_aria_128_cfb1(void);
1069 const EVP_CIPHER *EVP_aria_128_cfb8(void);
1070 const EVP_CIPHER *EVP_aria_128_cfb128(void);
1071 #  define EVP_aria_128_cfb EVP_aria_128_cfb128
1072 const EVP_CIPHER *EVP_aria_128_ctr(void);
1073 const EVP_CIPHER *EVP_aria_128_ofb(void);
1074 const EVP_CIPHER *EVP_aria_128_gcm(void);
1075 const EVP_CIPHER *EVP_aria_128_ccm(void);
1076 const EVP_CIPHER *EVP_aria_192_ecb(void);
1077 const EVP_CIPHER *EVP_aria_192_cbc(void);
1078 const EVP_CIPHER *EVP_aria_192_cfb1(void);
1079 const EVP_CIPHER *EVP_aria_192_cfb8(void);
1080 const EVP_CIPHER *EVP_aria_192_cfb128(void);
1081 #  define EVP_aria_192_cfb EVP_aria_192_cfb128
1082 const EVP_CIPHER *EVP_aria_192_ctr(void);
1083 const EVP_CIPHER *EVP_aria_192_ofb(void);
1084 const EVP_CIPHER *EVP_aria_192_gcm(void);
1085 const EVP_CIPHER *EVP_aria_192_ccm(void);
1086 const EVP_CIPHER *EVP_aria_256_ecb(void);
1087 const EVP_CIPHER *EVP_aria_256_cbc(void);
1088 const EVP_CIPHER *EVP_aria_256_cfb1(void);
1089 const EVP_CIPHER *EVP_aria_256_cfb8(void);
1090 const EVP_CIPHER *EVP_aria_256_cfb128(void);
1091 #  define EVP_aria_256_cfb EVP_aria_256_cfb128
1092 const EVP_CIPHER *EVP_aria_256_ctr(void);
1093 const EVP_CIPHER *EVP_aria_256_ofb(void);
1094 const EVP_CIPHER *EVP_aria_256_gcm(void);
1095 const EVP_CIPHER *EVP_aria_256_ccm(void);
1096 # endif
1097 # ifndef OPENSSL_NO_CAMELLIA
1098 const EVP_CIPHER *EVP_camellia_128_ecb(void);
1099 const EVP_CIPHER *EVP_camellia_128_cbc(void);
1100 const EVP_CIPHER *EVP_camellia_128_cfb1(void);
1101 const EVP_CIPHER *EVP_camellia_128_cfb8(void);
1102 const EVP_CIPHER *EVP_camellia_128_cfb128(void);
1103 #  define EVP_camellia_128_cfb EVP_camellia_128_cfb128
1104 const EVP_CIPHER *EVP_camellia_128_ofb(void);
1105 const EVP_CIPHER *EVP_camellia_128_ctr(void);
1106 const EVP_CIPHER *EVP_camellia_192_ecb(void);
1107 const EVP_CIPHER *EVP_camellia_192_cbc(void);
1108 const EVP_CIPHER *EVP_camellia_192_cfb1(void);
1109 const EVP_CIPHER *EVP_camellia_192_cfb8(void);
1110 const EVP_CIPHER *EVP_camellia_192_cfb128(void);
1111 #  define EVP_camellia_192_cfb EVP_camellia_192_cfb128
1112 const EVP_CIPHER *EVP_camellia_192_ofb(void);
1113 const EVP_CIPHER *EVP_camellia_192_ctr(void);
1114 const EVP_CIPHER *EVP_camellia_256_ecb(void);
1115 const EVP_CIPHER *EVP_camellia_256_cbc(void);
1116 const EVP_CIPHER *EVP_camellia_256_cfb1(void);
1117 const EVP_CIPHER *EVP_camellia_256_cfb8(void);
1118 const EVP_CIPHER *EVP_camellia_256_cfb128(void);
1119 #  define EVP_camellia_256_cfb EVP_camellia_256_cfb128
1120 const EVP_CIPHER *EVP_camellia_256_ofb(void);
1121 const EVP_CIPHER *EVP_camellia_256_ctr(void);
1122 # endif
1123 # ifndef OPENSSL_NO_CHACHA
1124 const EVP_CIPHER *EVP_chacha20(void);
1125 #  ifndef OPENSSL_NO_POLY1305
1126 const EVP_CIPHER *EVP_chacha20_poly1305(void);
1127 #  endif
1128 # endif
1129 
1130 # ifndef OPENSSL_NO_SEED
1131 const EVP_CIPHER *EVP_seed_ecb(void);
1132 const EVP_CIPHER *EVP_seed_cbc(void);
1133 const EVP_CIPHER *EVP_seed_cfb128(void);
1134 #  define EVP_seed_cfb EVP_seed_cfb128
1135 const EVP_CIPHER *EVP_seed_ofb(void);
1136 # endif
1137 
1138 # ifndef OPENSSL_NO_SM4
1139 const EVP_CIPHER *EVP_sm4_ecb(void);
1140 const EVP_CIPHER *EVP_sm4_cbc(void);
1141 const EVP_CIPHER *EVP_sm4_cfb128(void);
1142 #  define EVP_sm4_cfb EVP_sm4_cfb128
1143 const EVP_CIPHER *EVP_sm4_ofb(void);
1144 const EVP_CIPHER *EVP_sm4_ctr(void);
1145 # endif
1146 
1147 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
1148 #  define OPENSSL_add_all_algorithms_conf() \
1149     OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
1150                         | OPENSSL_INIT_ADD_ALL_DIGESTS \
1151                         | OPENSSL_INIT_LOAD_CONFIG, NULL)
1152 #  define OPENSSL_add_all_algorithms_noconf() \
1153     OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
1154                         | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
1155 
1156 #  ifdef OPENSSL_LOAD_CONF
1157 #   define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf()
1158 #  else
1159 #   define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf()
1160 #  endif
1161 
1162 #  define OpenSSL_add_all_ciphers() \
1163     OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL)
1164 #  define OpenSSL_add_all_digests() \
1165     OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
1166 
1167 #  define EVP_cleanup() while(0) continue
1168 # endif
1169 
1170 int EVP_add_cipher(const EVP_CIPHER *cipher);
1171 int EVP_add_digest(const EVP_MD *digest);
1172 
1173 const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
1174 const EVP_MD *EVP_get_digestbyname(const char *name);
1175 
1176 void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph,
1177                                    const char *from, const char *to, void *x),
1178                        void *arg);
1179 void EVP_CIPHER_do_all_sorted(void (*fn)
1180                                (const EVP_CIPHER *ciph, const char *from,
1181                                 const char *to, void *x), void *arg);
1182 void EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
1183                                 void (*fn)(EVP_CIPHER *cipher, void *arg),
1184                                 void *arg);
1185 
1186 void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph,
1187                                const char *from, const char *to, void *x),
1188                    void *arg);
1189 void EVP_MD_do_all_sorted(void (*fn)
1190                            (const EVP_MD *ciph, const char *from,
1191                             const char *to, void *x), void *arg);
1192 void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,
1193                             void (*fn)(EVP_MD *md, void *arg),
1194                             void *arg);
1195 
1196 /* MAC stuff */
1197 
1198 EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
1199                        const char *properties);
1200 int EVP_MAC_up_ref(EVP_MAC *mac);
1201 void EVP_MAC_free(EVP_MAC *mac);
1202 const char *EVP_MAC_get0_name(const EVP_MAC *mac);
1203 const char *EVP_MAC_get0_description(const EVP_MAC *mac);
1204 int EVP_MAC_is_a(const EVP_MAC *mac, const char *name);
1205 const OSSL_PROVIDER *EVP_MAC_get0_provider(const EVP_MAC *mac);
1206 int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]);
1207 
1208 EVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac);
1209 void EVP_MAC_CTX_free(EVP_MAC_CTX *ctx);
1210 EVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src);
1211 EVP_MAC *EVP_MAC_CTX_get0_mac(EVP_MAC_CTX *ctx);
1212 int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);
1213 int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);
1214 
1215 size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);
1216 size_t EVP_MAC_CTX_get_block_size(EVP_MAC_CTX *ctx);
1217 unsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, const char *name, const char *propq,
1218                          const char *subalg, const OSSL_PARAM *params,
1219                          const void *key, size_t keylen,
1220                          const unsigned char *data, size_t datalen,
1221                          unsigned char *out, size_t outsize, size_t *outlen);
1222 int EVP_MAC_init(EVP_MAC_CTX *ctx, const unsigned char *key, size_t keylen,
1223                  const OSSL_PARAM params[]);
1224 int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);
1225 int EVP_MAC_final(EVP_MAC_CTX *ctx,
1226                   unsigned char *out, size_t *outl, size_t outsize);
1227 int EVP_MAC_finalXOF(EVP_MAC_CTX *ctx, unsigned char *out, size_t outsize);
1228 const OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac);
1229 const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac);
1230 const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac);
1231 const OSSL_PARAM *EVP_MAC_CTX_gettable_params(EVP_MAC_CTX *ctx);
1232 const OSSL_PARAM *EVP_MAC_CTX_settable_params(EVP_MAC_CTX *ctx);
1233 
1234 void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,
1235                              void (*fn)(EVP_MAC *mac, void *arg),
1236                              void *arg);
1237 int EVP_MAC_names_do_all(const EVP_MAC *mac,
1238                          void (*fn)(const char *name, void *data),
1239                          void *data);
1240 
1241 /* RAND stuff */
1242 EVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
1243                          const char *properties);
1244 int EVP_RAND_up_ref(EVP_RAND *rand);
1245 void EVP_RAND_free(EVP_RAND *rand);
1246 const char *EVP_RAND_get0_name(const EVP_RAND *rand);
1247 const char *EVP_RAND_get0_description(const EVP_RAND *md);
1248 int EVP_RAND_is_a(const EVP_RAND *rand, const char *name);
1249 const OSSL_PROVIDER *EVP_RAND_get0_provider(const EVP_RAND *rand);
1250 int EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]);
1251 
1252 EVP_RAND_CTX *EVP_RAND_CTX_new(EVP_RAND *rand, EVP_RAND_CTX *parent);
1253 void EVP_RAND_CTX_free(EVP_RAND_CTX *ctx);
1254 EVP_RAND *EVP_RAND_CTX_get0_rand(EVP_RAND_CTX *ctx);
1255 int EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);
1256 int EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);
1257 const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand);
1258 const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand);
1259 const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand);
1260 const OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx);
1261 const OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx);
1262 
1263 void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,
1264                               void (*fn)(EVP_RAND *rand, void *arg),
1265                               void *arg);
1266 int EVP_RAND_names_do_all(const EVP_RAND *rand,
1267                           void (*fn)(const char *name, void *data),
1268                           void *data);
1269 
1270 __owur int EVP_RAND_instantiate(EVP_RAND_CTX *ctx, unsigned int strength,
1271                                 int prediction_resistance,
1272                                 const unsigned char *pstr, size_t pstr_len,
1273                                 const OSSL_PARAM params[]);
1274 int EVP_RAND_uninstantiate(EVP_RAND_CTX *ctx);
1275 __owur int EVP_RAND_generate(EVP_RAND_CTX *ctx, unsigned char *out,
1276                              size_t outlen, unsigned int strength,
1277                              int prediction_resistance,
1278                              const unsigned char *addin, size_t addin_len);
1279 int EVP_RAND_reseed(EVP_RAND_CTX *ctx, int prediction_resistance,
1280                     const unsigned char *ent, size_t ent_len,
1281                     const unsigned char *addin, size_t addin_len);
1282 __owur int EVP_RAND_nonce(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen);
1283 __owur int EVP_RAND_enable_locking(EVP_RAND_CTX *ctx);
1284 
1285 int EVP_RAND_verify_zeroization(EVP_RAND_CTX *ctx);
1286 unsigned int EVP_RAND_get_strength(EVP_RAND_CTX *ctx);
1287 int EVP_RAND_get_state(EVP_RAND_CTX *ctx);
1288 
1289 # define EVP_RAND_STATE_UNINITIALISED    0
1290 # define EVP_RAND_STATE_READY            1
1291 # define EVP_RAND_STATE_ERROR            2
1292 
1293 /* PKEY stuff */
1294 # ifndef OPENSSL_NO_DEPRECATED_3_0
1295 OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_decrypt_old(unsigned char *dec_key,
1296                                           const unsigned char *enc_key,
1297                                           int enc_key_len,
1298                                           EVP_PKEY *private_key);
1299 OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_encrypt_old(unsigned char *enc_key,
1300                                           const unsigned char *key,
1301                                           int key_len, EVP_PKEY *pub_key);
1302 # endif
1303 int EVP_PKEY_is_a(const EVP_PKEY *pkey, const char *name);
1304 int EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey,
1305                                void (*fn)(const char *name, void *data),
1306                                void *data);
1307 int EVP_PKEY_type(int type);
1308 int EVP_PKEY_get_id(const EVP_PKEY *pkey);
1309 # define EVP_PKEY_id EVP_PKEY_get_id
1310 int EVP_PKEY_get_base_id(const EVP_PKEY *pkey);
1311 # define EVP_PKEY_base_id EVP_PKEY_get_base_id
1312 int EVP_PKEY_get_bits(const EVP_PKEY *pkey);
1313 # define EVP_PKEY_bits EVP_PKEY_get_bits
1314 int EVP_PKEY_get_security_bits(const EVP_PKEY *pkey);
1315 # define EVP_PKEY_security_bits EVP_PKEY_get_security_bits
1316 int EVP_PKEY_get_size(const EVP_PKEY *pkey);
1317 # define EVP_PKEY_size EVP_PKEY_get_size
1318 int EVP_PKEY_can_sign(const EVP_PKEY *pkey);
1319 int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
1320 int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
1321 int EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);
1322 # ifndef OPENSSL_NO_DEPRECATED_3_0
1323 #  ifndef OPENSSL_NO_ENGINE
1324 OSSL_DEPRECATEDIN_3_0
1325 int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e);
1326 OSSL_DEPRECATEDIN_3_0
1327 ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey);
1328 #  endif
1329 OSSL_DEPRECATEDIN_3_0
1330 int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
1331 OSSL_DEPRECATEDIN_3_0
1332 void *EVP_PKEY_get0(const EVP_PKEY *pkey);
1333 OSSL_DEPRECATEDIN_3_0
1334 const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);
1335 #  ifndef OPENSSL_NO_POLY1305
1336 OSSL_DEPRECATEDIN_3_0
1337 const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len);
1338 #  endif
1339 #  ifndef OPENSSL_NO_SIPHASH
1340 OSSL_DEPRECATEDIN_3_0
1341 const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len);
1342 #  endif
1343 
1344 struct rsa_st;
1345 OSSL_DEPRECATEDIN_3_0
1346 int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key);
1347 OSSL_DEPRECATEDIN_3_0
1348 const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
1349 OSSL_DEPRECATEDIN_3_0
1350 struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
1351 
1352 #  ifndef OPENSSL_NO_DSA
1353 struct dsa_st;
1354 OSSL_DEPRECATEDIN_3_0
1355 int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key);
1356 OSSL_DEPRECATEDIN_3_0
1357 const struct dsa_st *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey);
1358 OSSL_DEPRECATEDIN_3_0
1359 struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
1360 #  endif
1361 
1362 #  ifndef OPENSSL_NO_DH
1363 struct dh_st;
1364 OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key);
1365 OSSL_DEPRECATEDIN_3_0 const struct dh_st *EVP_PKEY_get0_DH(const EVP_PKEY *pkey);
1366 OSSL_DEPRECATEDIN_3_0 struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
1367 #  endif
1368 
1369 #  ifndef OPENSSL_NO_EC
1370 struct ec_key_st;
1371 OSSL_DEPRECATEDIN_3_0
1372 int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
1373 OSSL_DEPRECATEDIN_3_0
1374 const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);
1375 OSSL_DEPRECATEDIN_3_0
1376 struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
1377 #  endif
1378 # endif /* OPENSSL_NO_DEPRECATED_3_0 */
1379 
1380 EVP_PKEY *EVP_PKEY_new(void);
1381 int EVP_PKEY_up_ref(EVP_PKEY *pkey);
1382 EVP_PKEY *EVP_PKEY_dup(EVP_PKEY *pkey);
1383 void EVP_PKEY_free(EVP_PKEY *pkey);
1384 const char *EVP_PKEY_get0_description(const EVP_PKEY *pkey);
1385 const OSSL_PROVIDER *EVP_PKEY_get0_provider(const EVP_PKEY *key);
1386 
1387 EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
1388                         long length);
1389 int i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp);
1390 
1391 
1392 EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp,
1393                             long length, OSSL_LIB_CTX *libctx,
1394                             const char *propq);
1395 EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
1396                          long length);
1397 EVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp,
1398                                 long length, OSSL_LIB_CTX *libctx,
1399                                 const char *propq);
1400 EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
1401                              long length);
1402 int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp);
1403 
1404 int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp);
1405 EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp,
1406                         long length);
1407 int i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey);
1408 EVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in);
1409 
1410 int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
1411 int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
1412 int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode);
1413 int EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b);
1414 int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b);
1415 
1416 # ifndef OPENSSL_NO_DEPRECATED_3_0
1417 OSSL_DEPRECATEDIN_3_0
1418 int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
1419 OSSL_DEPRECATEDIN_3_0
1420 int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
1421 # endif
1422 
1423 int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
1424                           int indent, ASN1_PCTX *pctx);
1425 int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
1426                            int indent, ASN1_PCTX *pctx);
1427 int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
1428                           int indent, ASN1_PCTX *pctx);
1429 # ifndef OPENSSL_NO_STDIO
1430 int EVP_PKEY_print_public_fp(FILE *fp, const EVP_PKEY *pkey,
1431                              int indent, ASN1_PCTX *pctx);
1432 int EVP_PKEY_print_private_fp(FILE *fp, const EVP_PKEY *pkey,
1433                               int indent, ASN1_PCTX *pctx);
1434 int EVP_PKEY_print_params_fp(FILE *fp, const EVP_PKEY *pkey,
1435                              int indent, ASN1_PCTX *pctx);
1436 # endif
1437 
1438 int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
1439 int EVP_PKEY_get_default_digest_name(EVP_PKEY *pkey,
1440                                      char *mdname, size_t mdname_sz);
1441 int EVP_PKEY_digestsign_supports_digest(EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
1442                                         const char *name, const char *propq);
1443 
1444 # ifndef OPENSSL_NO_DEPRECATED_3_0
1445 /*
1446  * For backwards compatibility. Use EVP_PKEY_set1_encoded_public_key in
1447  * preference
1448  */
1449 #  define EVP_PKEY_set1_tls_encodedpoint(pkey, pt, ptlen) \
1450           EVP_PKEY_set1_encoded_public_key((pkey), (pt), (ptlen))
1451 # endif
1452 
1453 int EVP_PKEY_set1_encoded_public_key(EVP_PKEY *pkey,
1454                                      const unsigned char *pub, size_t publen);
1455 
1456 # ifndef OPENSSL_NO_DEPRECATED_3_0
1457 /*
1458  * For backwards compatibility. Use EVP_PKEY_get1_encoded_public_key in
1459  * preference
1460  */
1461 #  define EVP_PKEY_get1_tls_encodedpoint(pkey, ppt) \
1462           EVP_PKEY_get1_encoded_public_key((pkey), (ppt))
1463 # endif
1464 
1465 size_t EVP_PKEY_get1_encoded_public_key(EVP_PKEY *pkey, unsigned char **ppub);
1466 
1467 /* calls methods */
1468 int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1469 int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1470 
1471 /* These are used by EVP_CIPHER methods */
1472 int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1473 int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1474 
1475 /* PKCS5 password based encryption */
1476 int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
1477                        ASN1_TYPE *param, const EVP_CIPHER *cipher,
1478                        const EVP_MD *md, int en_de);
1479 int PKCS5_PBE_keyivgen_ex(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
1480                           ASN1_TYPE *param, const EVP_CIPHER *cipher,
1481                           const EVP_MD *md, int en_de, OSSL_LIB_CTX *libctx,
1482                           const char *propq);
1483 int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
1484                            const unsigned char *salt, int saltlen, int iter,
1485                            int keylen, unsigned char *out);
1486 int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
1487                       const unsigned char *salt, int saltlen, int iter,
1488                       const EVP_MD *digest, int keylen, unsigned char *out);
1489 int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
1490                           ASN1_TYPE *param, const EVP_CIPHER *cipher,
1491                           const EVP_MD *md, int en_de);
1492 int PKCS5_v2_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
1493                              ASN1_TYPE *param, const EVP_CIPHER *cipher,
1494                              const EVP_MD *md, int en_de,
1495                              OSSL_LIB_CTX *libctx, const char *propq);
1496 
1497 #ifndef OPENSSL_NO_SCRYPT
1498 int EVP_PBE_scrypt(const char *pass, size_t passlen,
1499                    const unsigned char *salt, size_t saltlen,
1500                    uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
1501                    unsigned char *key, size_t keylen);
1502 int EVP_PBE_scrypt_ex(const char *pass, size_t passlen,
1503                       const unsigned char *salt, size_t saltlen,
1504                       uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
1505                       unsigned char *key, size_t keylen,
1506                       OSSL_LIB_CTX *ctx, const char *propq);
1507 
1508 int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
1509                              int passlen, ASN1_TYPE *param,
1510                              const EVP_CIPHER *c, const EVP_MD *md, int en_de);
1511 int PKCS5_v2_scrypt_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass,
1512                                 int passlen, ASN1_TYPE *param,
1513                                 const EVP_CIPHER *c, const EVP_MD *md, int en_de,
1514                                 OSSL_LIB_CTX *libctx, const char *propq);
1515 #endif
1516 
1517 void PKCS5_PBE_add(void);
1518 
1519 int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
1520                        ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
1521 
1522 int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
1523                           ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de,
1524                           OSSL_LIB_CTX *libctx, const char *propq);
1525 
1526 /* PBE type */
1527 
1528 /* Can appear as the outermost AlgorithmIdentifier */
1529 # define EVP_PBE_TYPE_OUTER      0x0
1530 /* Is an PRF type OID */
1531 # define EVP_PBE_TYPE_PRF        0x1
1532 /* Is a PKCS#5 v2.0 KDF */
1533 # define EVP_PBE_TYPE_KDF        0x2
1534 
1535 int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
1536                          int md_nid, EVP_PBE_KEYGEN *keygen);
1537 int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
1538                     EVP_PBE_KEYGEN *keygen);
1539 int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
1540                  EVP_PBE_KEYGEN **pkeygen);
1541 int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
1542                     EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **pkeygen_ex);
1543 void EVP_PBE_cleanup(void);
1544 int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num);
1545 
1546 # define ASN1_PKEY_ALIAS         0x1
1547 # define ASN1_PKEY_DYNAMIC       0x2
1548 # define ASN1_PKEY_SIGPARAM_NULL 0x4
1549 
1550 # define ASN1_PKEY_CTRL_PKCS7_SIGN       0x1
1551 # define ASN1_PKEY_CTRL_PKCS7_ENCRYPT    0x2
1552 # define ASN1_PKEY_CTRL_DEFAULT_MD_NID   0x3
1553 # define ASN1_PKEY_CTRL_CMS_SIGN         0x5
1554 # define ASN1_PKEY_CTRL_CMS_ENVELOPE     0x7
1555 # define ASN1_PKEY_CTRL_CMS_RI_TYPE      0x8
1556 
1557 # define ASN1_PKEY_CTRL_SET1_TLS_ENCPT   0x9
1558 # define ASN1_PKEY_CTRL_GET1_TLS_ENCPT   0xa
1559 # define ASN1_PKEY_CTRL_CMS_IS_RI_TYPE_SUPPORTED 0xb
1560 
1561 int EVP_PKEY_asn1_get_count(void);
1562 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
1563 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
1564 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
1565                                                    const char *str, int len);
1566 int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
1567 int EVP_PKEY_asn1_add_alias(int to, int from);
1568 int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,
1569                             int *ppkey_flags, const char **pinfo,
1570                             const char **ppem_str,
1571                             const EVP_PKEY_ASN1_METHOD *ameth);
1572 
1573 const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey);
1574 EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
1575                                         const char *pem_str,
1576                                         const char *info);
1577 void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
1578                         const EVP_PKEY_ASN1_METHOD *src);
1579 void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
1580 void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
1581                               int (*pub_decode) (EVP_PKEY *pk,
1582                                                  const X509_PUBKEY *pub),
1583                               int (*pub_encode) (X509_PUBKEY *pub,
1584                                                  const EVP_PKEY *pk),
1585                               int (*pub_cmp) (const EVP_PKEY *a,
1586                                               const EVP_PKEY *b),
1587                               int (*pub_print) (BIO *out,
1588                                                 const EVP_PKEY *pkey,
1589                                                 int indent, ASN1_PCTX *pctx),
1590                               int (*pkey_size) (const EVP_PKEY *pk),
1591                               int (*pkey_bits) (const EVP_PKEY *pk));
1592 void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
1593                                int (*priv_decode) (EVP_PKEY *pk,
1594                                                    const PKCS8_PRIV_KEY_INFO
1595                                                    *p8inf),
1596                                int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,
1597                                                    const EVP_PKEY *pk),
1598                                int (*priv_print) (BIO *out,
1599                                                   const EVP_PKEY *pkey,
1600                                                   int indent,
1601                                                   ASN1_PCTX *pctx));
1602 void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
1603                              int (*param_decode) (EVP_PKEY *pkey,
1604                                                   const unsigned char **pder,
1605                                                   int derlen),
1606                              int (*param_encode) (const EVP_PKEY *pkey,
1607                                                   unsigned char **pder),
1608                              int (*param_missing) (const EVP_PKEY *pk),
1609                              int (*param_copy) (EVP_PKEY *to,
1610                                                 const EVP_PKEY *from),
1611                              int (*param_cmp) (const EVP_PKEY *a,
1612                                                const EVP_PKEY *b),
1613                              int (*param_print) (BIO *out,
1614                                                  const EVP_PKEY *pkey,
1615                                                  int indent,
1616                                                  ASN1_PCTX *pctx));
1617 
1618 void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
1619                             void (*pkey_free) (EVP_PKEY *pkey));
1620 void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
1621                             int (*pkey_ctrl) (EVP_PKEY *pkey, int op,
1622                                               long arg1, void *arg2));
1623 void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,
1624                             int (*item_verify) (EVP_MD_CTX *ctx,
1625                                                 const ASN1_ITEM *it,
1626                                                 const void *data,
1627                                                 const X509_ALGOR *a,
1628                                                 const ASN1_BIT_STRING *sig,
1629                                                 EVP_PKEY *pkey),
1630                             int (*item_sign) (EVP_MD_CTX *ctx,
1631                                               const ASN1_ITEM *it,
1632                                               const void *data,
1633                                               X509_ALGOR *alg1,
1634                                               X509_ALGOR *alg2,
1635                                               ASN1_BIT_STRING *sig));
1636 
1637 void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth,
1638                               int (*siginf_set) (X509_SIG_INFO *siginf,
1639                                                  const X509_ALGOR *alg,
1640                                                  const ASN1_STRING *sig));
1641 
1642 void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
1643                              int (*pkey_check) (const EVP_PKEY *pk));
1644 
1645 void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,
1646                                     int (*pkey_pub_check) (const EVP_PKEY *pk));
1647 
1648 void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
1649                                    int (*pkey_param_check) (const EVP_PKEY *pk));
1650 
1651 void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth,
1652                                     int (*set_priv_key) (EVP_PKEY *pk,
1653                                                          const unsigned char
1654                                                             *priv,
1655                                                          size_t len));
1656 void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth,
1657                                    int (*set_pub_key) (EVP_PKEY *pk,
1658                                                        const unsigned char *pub,
1659                                                        size_t len));
1660 void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth,
1661                                     int (*get_priv_key) (const EVP_PKEY *pk,
1662                                                          unsigned char *priv,
1663                                                          size_t *len));
1664 void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth,
1665                                    int (*get_pub_key) (const EVP_PKEY *pk,
1666                                                        unsigned char *pub,
1667                                                        size_t *len));
1668 
1669 void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
1670                                      int (*pkey_security_bits) (const EVP_PKEY
1671                                                                 *pk));
1672 
1673 int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
1674 int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
1675 
1676 int EVP_PKEY_CTX_set1_id(EVP_PKEY_CTX *ctx, const void *id, int len);
1677 int EVP_PKEY_CTX_get1_id(EVP_PKEY_CTX *ctx, void *id);
1678 int EVP_PKEY_CTX_get1_id_len(EVP_PKEY_CTX *ctx, size_t *id_len);
1679 
1680 int EVP_PKEY_CTX_set_kem_op(EVP_PKEY_CTX *ctx, const char *op);
1681 
1682 const char *EVP_PKEY_get0_type_name(const EVP_PKEY *key);
1683 
1684 # define EVP_PKEY_OP_UNDEFINED           0
1685 # define EVP_PKEY_OP_PARAMGEN            (1<<1)
1686 # define EVP_PKEY_OP_KEYGEN              (1<<2)
1687 # define EVP_PKEY_OP_FROMDATA            (1<<3)
1688 # define EVP_PKEY_OP_SIGN                (1<<4)
1689 # define EVP_PKEY_OP_VERIFY              (1<<5)
1690 # define EVP_PKEY_OP_VERIFYRECOVER       (1<<6)
1691 # define EVP_PKEY_OP_SIGNCTX             (1<<7)
1692 # define EVP_PKEY_OP_VERIFYCTX           (1<<8)
1693 # define EVP_PKEY_OP_ENCRYPT             (1<<9)
1694 # define EVP_PKEY_OP_DECRYPT             (1<<10)
1695 # define EVP_PKEY_OP_DERIVE              (1<<11)
1696 # define EVP_PKEY_OP_ENCAPSULATE         (1<<12)
1697 # define EVP_PKEY_OP_DECAPSULATE         (1<<13)
1698 
1699 # define EVP_PKEY_OP_TYPE_SIG    \
1700         (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
1701                 | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
1702 
1703 # define EVP_PKEY_OP_TYPE_CRYPT \
1704         (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
1705 
1706 # define EVP_PKEY_OP_TYPE_NOGEN \
1707         (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE)
1708 
1709 # define EVP_PKEY_OP_TYPE_GEN \
1710         (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
1711 
1712 
1713 int EVP_PKEY_CTX_set_mac_key(EVP_PKEY_CTX *ctx, const unsigned char *key,
1714                              int keylen);
1715 
1716 # define EVP_PKEY_CTRL_MD                1
1717 # define EVP_PKEY_CTRL_PEER_KEY          2
1718 # define EVP_PKEY_CTRL_SET_MAC_KEY       6
1719 # define EVP_PKEY_CTRL_DIGESTINIT        7
1720 /* Used by GOST key encryption in TLS */
1721 # define EVP_PKEY_CTRL_SET_IV            8
1722 # ifndef OPENSSL_NO_DEPRECATED_3_0
1723 #  define EVP_PKEY_CTRL_PKCS7_ENCRYPT     3
1724 #  define EVP_PKEY_CTRL_PKCS7_DECRYPT     4
1725 #  define EVP_PKEY_CTRL_PKCS7_SIGN        5
1726 #  define EVP_PKEY_CTRL_CMS_ENCRYPT       9
1727 #  define EVP_PKEY_CTRL_CMS_DECRYPT       10
1728 #  define EVP_PKEY_CTRL_CMS_SIGN          11
1729 # endif
1730 # define EVP_PKEY_CTRL_CIPHER            12
1731 # define EVP_PKEY_CTRL_GET_MD            13
1732 # define EVP_PKEY_CTRL_SET_DIGEST_SIZE   14
1733 # define EVP_PKEY_CTRL_SET1_ID           15
1734 # define EVP_PKEY_CTRL_GET1_ID           16
1735 # define EVP_PKEY_CTRL_GET1_ID_LEN       17
1736 
1737 # define EVP_PKEY_ALG_CTRL               0x1000
1738 
1739 # define EVP_PKEY_FLAG_AUTOARGLEN        2
1740 /*
1741  * Method handles all operations: don't assume any digest related defaults.
1742  */
1743 # define EVP_PKEY_FLAG_SIGCTX_CUSTOM     4
1744 # ifndef OPENSSL_NO_DEPRECATED_3_0
1745 OSSL_DEPRECATEDIN_3_0 const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
1746 OSSL_DEPRECATEDIN_3_0 EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
1747 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
1748                                               const EVP_PKEY_METHOD *meth);
1749 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst,
1750                                          const EVP_PKEY_METHOD *src);
1751 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
1752 OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
1753 OSSL_DEPRECATEDIN_3_0 int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);
1754 OSSL_DEPRECATEDIN_3_0 size_t EVP_PKEY_meth_get_count(void);
1755 OSSL_DEPRECATEDIN_3_0 const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx);
1756 # endif
1757 
1758 EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
1759                                const char *properties);
1760 int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);
1761 void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);
1762 const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt);
1763 const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt);
1764 const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt);
1765 int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);
1766 void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,
1767                                  void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
1768                                  void *arg);
1769 int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
1770                              void (*fn)(const char *name, void *data),
1771                              void *data);
1772 const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);
1773 const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);
1774 const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);
1775 
1776 EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
1777 EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
1778 EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OSSL_LIB_CTX *libctx,
1779                                          const char *name,
1780                                          const char *propquery);
1781 EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx,
1782                                          EVP_PKEY *pkey, const char *propquery);
1783 EVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx);
1784 void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
1785 int EVP_PKEY_CTX_is_a(EVP_PKEY_CTX *ctx, const char *keytype);
1786 
1787 int EVP_PKEY_CTX_get_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
1788 const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx);
1789 int EVP_PKEY_CTX_set_params(EVP_PKEY_CTX *ctx, const OSSL_PARAM *params);
1790 const OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx);
1791 int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
1792                       int cmd, int p1, void *p2);
1793 int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
1794                           const char *value);
1795 int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype,
1796                              int cmd, uint64_t value);
1797 
1798 int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str);
1799 int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex);
1800 
1801 int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md);
1802 
1803 int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
1804 void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);
1805 
1806 EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
1807                                const unsigned char *key, int keylen);
1808 EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OSSL_LIB_CTX *libctx,
1809                                           const char *keytype,
1810                                           const char *propq,
1811                                           const unsigned char *priv, size_t len);
1812 EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,
1813                                        const unsigned char *priv,
1814                                        size_t len);
1815 EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OSSL_LIB_CTX *libctx,
1816                                          const char *keytype, const char *propq,
1817                                          const unsigned char *pub, size_t len);
1818 EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e,
1819                                       const unsigned char *pub,
1820                                       size_t len);
1821 int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv,
1822                                  size_t *len);
1823 int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub,
1824                                 size_t *len);
1825 
1826 # ifndef OPENSSL_NO_DEPRECATED_3_0
1827 OSSL_DEPRECATEDIN_3_0
1828 EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,
1829                                 size_t len, const EVP_CIPHER *cipher);
1830 # endif
1831 
1832 void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
1833 void *EVP_PKEY_CTX_get_data(const EVP_PKEY_CTX *ctx);
1834 EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
1835 
1836 EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
1837 
1838 void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
1839 void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
1840 
1841 void EVP_SIGNATURE_free(EVP_SIGNATURE *signature);
1842 int EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature);
1843 OSSL_PROVIDER *EVP_SIGNATURE_get0_provider(const EVP_SIGNATURE *signature);
1844 EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
1845                                    const char *properties);
1846 int EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name);
1847 const char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);
1848 const char *EVP_SIGNATURE_get0_description(const EVP_SIGNATURE *signature);
1849 void EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx,
1850                                    void (*fn)(EVP_SIGNATURE *signature,
1851                                               void *data),
1852                                    void *data);
1853 int EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
1854                                void (*fn)(const char *name, void *data),
1855                                void *data);
1856 const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig);
1857 const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig);
1858 
1859 void EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher);
1860 int EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher);
1861 OSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher);
1862 EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
1863                                        const char *properties);
1864 int EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name);
1865 const char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher);
1866 const char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher);
1867 void EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
1868                                      void (*fn)(EVP_ASYM_CIPHER *cipher,
1869                                                 void *arg),
1870                                      void *arg);
1871 int EVP_ASYM_CIPHER_names_do_all(const EVP_ASYM_CIPHER *cipher,
1872                                  void (*fn)(const char *name, void *data),
1873                                  void *data);
1874 const OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *ciph);
1875 const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *ciph);
1876 
1877 void EVP_KEM_free(EVP_KEM *wrap);
1878 int EVP_KEM_up_ref(EVP_KEM *wrap);
1879 OSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *wrap);
1880 EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
1881                        const char *properties);
1882 int EVP_KEM_is_a(const EVP_KEM *wrap, const char *name);
1883 const char *EVP_KEM_get0_name(const EVP_KEM *wrap);
1884 const char *EVP_KEM_get0_description(const EVP_KEM *wrap);
1885 void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,
1886                              void (*fn)(EVP_KEM *wrap, void *arg), void *arg);
1887 int EVP_KEM_names_do_all(const EVP_KEM *wrap,
1888                          void (*fn)(const char *name, void *data), void *data);
1889 const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);
1890 const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);
1891 
1892 int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
1893 int EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1894 int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
1895                   unsigned char *sig, size_t *siglen,
1896                   const unsigned char *tbs, size_t tbslen);
1897 int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
1898 int EVP_PKEY_verify_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1899 int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
1900                     const unsigned char *sig, size_t siglen,
1901                     const unsigned char *tbs, size_t tbslen);
1902 int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
1903 int EVP_PKEY_verify_recover_init_ex(EVP_PKEY_CTX *ctx,
1904                                     const OSSL_PARAM params[]);
1905 int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
1906                             unsigned char *rout, size_t *routlen,
1907                             const unsigned char *sig, size_t siglen);
1908 int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
1909 int EVP_PKEY_encrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1910 int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
1911                      unsigned char *out, size_t *outlen,
1912                      const unsigned char *in, size_t inlen);
1913 int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
1914 int EVP_PKEY_decrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1915 int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
1916                      unsigned char *out, size_t *outlen,
1917                      const unsigned char *in, size_t inlen);
1918 
1919 int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
1920 int EVP_PKEY_derive_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1921 int EVP_PKEY_derive_set_peer_ex(EVP_PKEY_CTX *ctx, EVP_PKEY *peer,
1922                                 int validate_peer);
1923 int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
1924 int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
1925 
1926 int EVP_PKEY_encapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1927 int EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx,
1928                          unsigned char *wrappedkey, size_t *wrappedkeylen,
1929                          unsigned char *genkey, size_t *genkeylen);
1930 int EVP_PKEY_decapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);
1931 int EVP_PKEY_decapsulate(EVP_PKEY_CTX *ctx,
1932                          unsigned char *unwrapped, size_t *unwrappedlen,
1933                          const unsigned char *wrapped, size_t wrappedlen);
1934 
1935 typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
1936 
1937 int EVP_PKEY_fromdata_init(EVP_PKEY_CTX *ctx);
1938 int EVP_PKEY_fromdata(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey, int selection,
1939                       OSSL_PARAM param[]);
1940 const OSSL_PARAM *EVP_PKEY_fromdata_settable(EVP_PKEY_CTX *ctx, int selection);
1941 
1942 int EVP_PKEY_todata(const EVP_PKEY *pkey, int selection, OSSL_PARAM **params);
1943 int EVP_PKEY_export(const EVP_PKEY *pkey, int selection,
1944                     OSSL_CALLBACK *export_cb, void *export_cbarg);
1945 
1946 const OSSL_PARAM *EVP_PKEY_gettable_params(const EVP_PKEY *pkey);
1947 int EVP_PKEY_get_params(const EVP_PKEY *pkey, OSSL_PARAM params[]);
1948 int EVP_PKEY_get_int_param(const EVP_PKEY *pkey, const char *key_name,
1949                            int *out);
1950 int EVP_PKEY_get_size_t_param(const EVP_PKEY *pkey, const char *key_name,
1951                               size_t *out);
1952 int EVP_PKEY_get_bn_param(const EVP_PKEY *pkey, const char *key_name,
1953                           BIGNUM **bn);
1954 int EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey, const char *key_name,
1955                                     char *str, size_t max_buf_sz, size_t *out_sz);
1956 int EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey, const char *key_name,
1957                                     unsigned char *buf, size_t max_buf_sz,
1958                                     size_t *out_sz);
1959 
1960 const OSSL_PARAM *EVP_PKEY_settable_params(const EVP_PKEY *pkey);
1961 int EVP_PKEY_set_params(EVP_PKEY *pkey, OSSL_PARAM params[]);
1962 int EVP_PKEY_set_int_param(EVP_PKEY *pkey, const char *key_name, int in);
1963 int EVP_PKEY_set_size_t_param(EVP_PKEY *pkey, const char *key_name, size_t in);
1964 int EVP_PKEY_set_bn_param(EVP_PKEY *pkey, const char *key_name,
1965                           const BIGNUM *bn);
1966 int EVP_PKEY_set_utf8_string_param(EVP_PKEY *pkey, const char *key_name,
1967                                    const char *str);
1968 int EVP_PKEY_set_octet_string_param(EVP_PKEY *pkey, const char *key_name,
1969                                     const unsigned char *buf, size_t bsize);
1970 
1971 int EVP_PKEY_get_ec_point_conv_form(const EVP_PKEY *pkey);
1972 int EVP_PKEY_get_field_type(const EVP_PKEY *pkey);
1973 
1974 EVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq,
1975                             const char *type, ...);
1976 int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
1977 int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1978 int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
1979 int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1980 int EVP_PKEY_generate(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1981 int EVP_PKEY_check(EVP_PKEY_CTX *ctx);
1982 int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx);
1983 int EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx);
1984 int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);
1985 int EVP_PKEY_param_check_quick(EVP_PKEY_CTX *ctx);
1986 int EVP_PKEY_private_check(EVP_PKEY_CTX *ctx);
1987 int EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx);
1988 
1989 # define EVP_PKEY_get_ex_new_index(l, p, newf, dupf, freef) \
1990     CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EVP_PKEY, l, p, newf, dupf, freef)
1991 int EVP_PKEY_set_ex_data(EVP_PKEY *key, int idx, void *arg);
1992 void *EVP_PKEY_get_ex_data(const EVP_PKEY *key, int idx);
1993 
1994 void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
1995 EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
1996 
1997 int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
1998 # ifndef OPENSSL_NO_DEPRECATED_3_0
1999 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
2000                                              int (*init) (EVP_PKEY_CTX *ctx));
2001 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_copy
2002     (EVP_PKEY_METHOD *pmeth, int (*copy) (EVP_PKEY_CTX *dst,
2003                                           const EVP_PKEY_CTX *src));
2004 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_cleanup
2005     (EVP_PKEY_METHOD *pmeth, void (*cleanup) (EVP_PKEY_CTX *ctx));
2006 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_paramgen
2007     (EVP_PKEY_METHOD *pmeth, int (*paramgen_init) (EVP_PKEY_CTX *ctx),
2008      int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
2009 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_keygen
2010     (EVP_PKEY_METHOD *pmeth, int (*keygen_init) (EVP_PKEY_CTX *ctx),
2011      int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
2012 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_sign
2013     (EVP_PKEY_METHOD *pmeth, int (*sign_init) (EVP_PKEY_CTX *ctx),
2014      int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
2015                   const unsigned char *tbs, size_t tbslen));
2016 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_verify
2017     (EVP_PKEY_METHOD *pmeth, int (*verify_init) (EVP_PKEY_CTX *ctx),
2018      int (*verify) (EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,
2019                     const unsigned char *tbs, size_t tbslen));
2020 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_verify_recover
2021     (EVP_PKEY_METHOD *pmeth, int (*verify_recover_init) (EVP_PKEY_CTX *ctx),
2022      int (*verify_recover) (EVP_PKEY_CTX *ctx, unsigned char *sig,
2023                             size_t *siglen, const unsigned char *tbs,
2024                             size_t tbslen));
2025 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_signctx
2026     (EVP_PKEY_METHOD *pmeth, int (*signctx_init) (EVP_PKEY_CTX *ctx,
2027                                                   EVP_MD_CTX *mctx),
2028      int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
2029                      EVP_MD_CTX *mctx));
2030 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_verifyctx
2031     (EVP_PKEY_METHOD *pmeth, int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
2032                                                     EVP_MD_CTX *mctx),
2033      int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
2034                        EVP_MD_CTX *mctx));
2035 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_encrypt
2036     (EVP_PKEY_METHOD *pmeth, int (*encrypt_init) (EVP_PKEY_CTX *ctx),
2037      int (*encryptfn) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
2038                        const unsigned char *in, size_t inlen));
2039 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_decrypt
2040     (EVP_PKEY_METHOD *pmeth, int (*decrypt_init) (EVP_PKEY_CTX *ctx),
2041      int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
2042                      const unsigned char *in, size_t inlen));
2043 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_derive
2044     (EVP_PKEY_METHOD *pmeth, int (*derive_init) (EVP_PKEY_CTX *ctx),
2045      int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen));
2046 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_ctrl
2047     (EVP_PKEY_METHOD *pmeth, int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
2048                                           void *p2),
2049      int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value));
2050 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_digestsign
2051     (EVP_PKEY_METHOD *pmeth,
2052      int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
2053                         const unsigned char *tbs, size_t tbslen));
2054 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_digestverify
2055     (EVP_PKEY_METHOD *pmeth,
2056      int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
2057                           size_t siglen, const unsigned char *tbs,
2058                           size_t tbslen));
2059 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_check
2060     (EVP_PKEY_METHOD *pmeth, int (*check) (EVP_PKEY *pkey));
2061 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_public_check
2062     (EVP_PKEY_METHOD *pmeth, int (*check) (EVP_PKEY *pkey));
2063 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_param_check
2064     (EVP_PKEY_METHOD *pmeth, int (*check) (EVP_PKEY *pkey));
2065 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_set_digest_custom
2066     (EVP_PKEY_METHOD *pmeth, int (*digest_custom) (EVP_PKEY_CTX *ctx,
2067                                                    EVP_MD_CTX *mctx));
2068 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_init
2069     (const EVP_PKEY_METHOD *pmeth, int (**pinit) (EVP_PKEY_CTX *ctx));
2070 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_copy
2071     (const EVP_PKEY_METHOD *pmeth, int (**pcopy) (EVP_PKEY_CTX *dst,
2072                                                   const EVP_PKEY_CTX *src));
2073 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_cleanup
2074     (const EVP_PKEY_METHOD *pmeth, void (**pcleanup) (EVP_PKEY_CTX *ctx));
2075 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_paramgen
2076     (const EVP_PKEY_METHOD *pmeth, int (**pparamgen_init) (EVP_PKEY_CTX *ctx),
2077      int (**pparamgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
2078 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_keygen
2079     (const EVP_PKEY_METHOD *pmeth, int (**pkeygen_init) (EVP_PKEY_CTX *ctx),
2080      int (**pkeygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
2081 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_sign
2082     (const EVP_PKEY_METHOD *pmeth, int (**psign_init) (EVP_PKEY_CTX *ctx),
2083      int (**psign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
2084                     const unsigned char *tbs, size_t tbslen));
2085 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_verify
2086     (const EVP_PKEY_METHOD *pmeth, int (**pverify_init) (EVP_PKEY_CTX *ctx),
2087      int (**pverify) (EVP_PKEY_CTX *ctx, const unsigned char *sig,
2088                       size_t siglen, const unsigned char *tbs, size_t tbslen));
2089 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_verify_recover
2090     (const EVP_PKEY_METHOD *pmeth,
2091      int (**pverify_recover_init) (EVP_PKEY_CTX *ctx),
2092      int (**pverify_recover) (EVP_PKEY_CTX *ctx, unsigned char *sig,
2093                               size_t *siglen, const unsigned char *tbs,
2094                               size_t tbslen));
2095 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_signctx
2096     (const EVP_PKEY_METHOD *pmeth,
2097      int (**psignctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
2098      int (**psignctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
2099                        EVP_MD_CTX *mctx));
2100 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_verifyctx
2101     (const EVP_PKEY_METHOD *pmeth,
2102      int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
2103      int (**pverifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig,
2104                           int siglen, EVP_MD_CTX *mctx));
2105 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_encrypt
2106     (const EVP_PKEY_METHOD *pmeth, int (**pencrypt_init) (EVP_PKEY_CTX *ctx),
2107      int (**pencryptfn) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
2108                          const unsigned char *in, size_t inlen));
2109 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_decrypt
2110     (const EVP_PKEY_METHOD *pmeth, int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
2111      int (**pdecrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
2112                        const unsigned char *in, size_t inlen));
2113 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_derive
2114     (const EVP_PKEY_METHOD *pmeth, int (**pderive_init) (EVP_PKEY_CTX *ctx),
2115      int (**pderive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen));
2116 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_ctrl
2117     (const EVP_PKEY_METHOD *pmeth,
2118      int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2),
2119      int (**pctrl_str) (EVP_PKEY_CTX *ctx, const char *type,
2120                         const char *value));
2121 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_digestsign
2122     (const EVP_PKEY_METHOD *pmeth,
2123      int (**digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
2124                          const unsigned char *tbs, size_t tbslen));
2125 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_digestverify
2126     (const EVP_PKEY_METHOD *pmeth,
2127      int (**digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
2128                            size_t siglen, const unsigned char *tbs,
2129                            size_t tbslen));
2130 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_check
2131     (const EVP_PKEY_METHOD *pmeth, int (**pcheck) (EVP_PKEY *pkey));
2132 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_public_check
2133     (const EVP_PKEY_METHOD *pmeth, int (**pcheck) (EVP_PKEY *pkey));
2134 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_param_check
2135     (const EVP_PKEY_METHOD *pmeth, int (**pcheck) (EVP_PKEY *pkey));
2136 OSSL_DEPRECATEDIN_3_0 void EVP_PKEY_meth_get_digest_custom
2137     (const EVP_PKEY_METHOD *pmeth,
2138      int (**pdigest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx));
2139 # endif
2140 
2141 void EVP_KEYEXCH_free(EVP_KEYEXCH *exchange);
2142 int EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange);
2143 EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
2144                                const char *properties);
2145 OSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange);
2146 int EVP_KEYEXCH_is_a(const EVP_KEYEXCH *keyexch, const char *name);
2147 const char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *keyexch);
2148 const char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch);
2149 void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx,
2150                                  void (*fn)(EVP_KEYEXCH *keyexch, void *data),
2151                                  void *data);
2152 int EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *keyexch,
2153                              void (*fn)(const char *name, void *data),
2154                              void *data);
2155 const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch);
2156 const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch);
2157 
2158 void EVP_add_alg_module(void);
2159 
2160 int EVP_PKEY_CTX_set_group_name(EVP_PKEY_CTX *ctx, const char *name);
2161 int EVP_PKEY_CTX_get_group_name(EVP_PKEY_CTX *ctx, char *name, size_t namelen);
2162 int EVP_PKEY_get_group_name(const EVP_PKEY *pkey, char *name, size_t name_sz,
2163                             size_t *gname_len);
2164 
2165 OSSL_LIB_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx);
2166 const char *EVP_PKEY_CTX_get0_propq(const EVP_PKEY_CTX *ctx);
2167 const OSSL_PROVIDER *EVP_PKEY_CTX_get0_provider(const EVP_PKEY_CTX *ctx);
2168 
2169 # ifdef  __cplusplus
2170 }
2171 # endif
2172 #endif
2173