]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/crypto/evp.h
Implement provider-side keymgmt_dup function
[thirdparty/openssl.git] / include / crypto / evp.h
CommitLineData
27af42f9 1/*
a28d06f3 2 * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
27af42f9 3 *
48f4ad77 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
aa6bb135
RS
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
27af42f9
DSH
8 */
9
80ce21fe
F
10#ifndef OSSL_CRYPTO_EVP_H
11# define OSSL_CRYPTO_EVP_H
12# pragma once
13
14# include <openssl/evp.h>
15# include <openssl/core_dispatch.h>
16# include "internal/refcount.h"
17# include "crypto/ecx.h"
2f545ae4 18
4803717f
PY
19/*
20 * Don't free up md_ctx->pctx in EVP_MD_CTX_reset, use the reserved flag
21 * values in evp.h
22 */
23#define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX 0x0400
24
f21c9c64 25/*
6179dfc7 26 * An EVP_PKEY_CTX can have the following support states:
f21c9c64
RL
27 *
28 * Supports legacy implementations only:
29 *
30 * engine != NULL || keytype == NULL
31 *
32 * Supports provided implementations:
33 *
34 * engine == NULL && keytype != NULL
35 */
36#define evp_pkey_ctx_is_legacy(ctx) \
37 ((ctx)->engine != NULL || (ctx)->keytype == NULL)
38#define evp_pkey_ctx_is_provided(ctx) \
39 (!evp_pkey_ctx_is_legacy(ctx))
40
27af42f9 41struct evp_pkey_ctx_st {
864b89ce
MC
42 /* Actual operation */
43 int operation;
44
3ee348b0 45 /*
4b9e90f4
RL
46 * Library context, property query, keytype and keymgmt associated with
47 * this context
3ee348b0 48 */
b4250010 49 OSSL_LIB_CTX *libctx;
ddfd7182 50 char *propquery;
4b9e90f4 51 const char *keytype;
c0e0984f
RL
52 EVP_KEYMGMT *keymgmt;
53
864b89ce 54 union {
62924755
RL
55 struct {
56 void *genctx;
57 } keymgmt;
58
864b89ce
MC
59 struct {
60 EVP_KEYEXCH *exchange;
61 void *exchprovctx;
62 } kex;
ff64702b 63
864b89ce
MC
64 struct {
65 EVP_SIGNATURE *signature;
66 void *sigprovctx;
67 } sig;
2c938e2e
MC
68
69 struct {
70 EVP_ASYM_CIPHER *cipher;
71 void *ciphprovctx;
72 } ciph;
80f4fd18
SL
73 struct {
74 EVP_KEM *kem;
75 void *kemprovctx;
76 } encap;
864b89ce 77 } op;
dfcb5d29 78
86df26b3
RL
79 /*
80 * Cached parameters. Inits of operations that depend on these should
81 * call evp_pkey_ctx_use_delayed_data() when the operation has been set
82 * up properly.
83 */
84 struct {
85 /* Distinguishing Identifier, ISO/IEC 15946-3, FIPS 196 */
86 char *dist_id_name; /* The name used with EVP_PKEY_CTX_ctrl_str() */
87 void *dist_id; /* The distinguishing ID itself */
88 size_t dist_id_len; /* The length of the distinguishing ID */
89
90 /* Indicators of what has been set. Keep them together! */
91 unsigned int dist_id_set : 1;
92 } cached_parameters;
93
62924755
RL
94 /* Application specific data, usually used by the callback */
95 void *app_data;
96 /* Keygen callback */
97 EVP_PKEY_gen_cb *pkey_gencb;
98 /* implementation specific keygen data */
99 int *keygen_info;
100 int keygen_info_count;
101
ff64702b
MC
102 /* Legacy fields below */
103
50914496
RL
104 /* EVP_PKEY identity */
105 int legacy_keytype;
27af42f9
DSH
106 /* Method associated with this operation */
107 const EVP_PKEY_METHOD *pmeth;
108 /* Engine that implements this method or NULL if builtin */
109 ENGINE *engine;
110 /* Key: may be NULL */
111 EVP_PKEY *pkey;
112 /* Peer key for key agreement, may be NULL */
113 EVP_PKEY *peerkey;
27af42f9
DSH
114 /* Algorithm specific data */
115 void *data;
a5ce329e
RL
116 /* Indicator if digest_custom needs to be called */
117 unsigned int flag_call_digest_custom:1;
3786d748 118 /*
119 * Used to support taking custody of memory in the case of a provider being
120 * used with the deprecated EVP_PKEY_CTX_set_rsa_keygen_pubexp() API. This
121 * member should NOT be used for any other purpose and should be removed
122 * when said deprecated API is excised completely.
123 */
124 BIGNUM *rsa_pubexp;
27af42f9
DSH
125} /* EVP_PKEY_CTX */ ;
126
127#define EVP_PKEY_FLAG_DYNAMIC 1
128
129struct evp_pkey_method_st {
130 int pkey_id;
131 int flags;
132 int (*init) (EVP_PKEY_CTX *ctx);
9fdcc21f 133 int (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);
27af42f9
DSH
134 void (*cleanup) (EVP_PKEY_CTX *ctx);
135 int (*paramgen_init) (EVP_PKEY_CTX *ctx);
136 int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
137 int (*keygen_init) (EVP_PKEY_CTX *ctx);
138 int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
139 int (*sign_init) (EVP_PKEY_CTX *ctx);
140 int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
141 const unsigned char *tbs, size_t tbslen);
142 int (*verify_init) (EVP_PKEY_CTX *ctx);
143 int (*verify) (EVP_PKEY_CTX *ctx,
144 const unsigned char *sig, size_t siglen,
145 const unsigned char *tbs, size_t tbslen);
146 int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
147 int (*verify_recover) (EVP_PKEY_CTX *ctx,
148 unsigned char *rout, size_t *routlen,
149 const unsigned char *sig, size_t siglen);
150 int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
151 int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
152 EVP_MD_CTX *mctx);
153 int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
154 int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
155 EVP_MD_CTX *mctx);
156 int (*encrypt_init) (EVP_PKEY_CTX *ctx);
157 int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
158 const unsigned char *in, size_t inlen);
159 int (*decrypt_init) (EVP_PKEY_CTX *ctx);
160 int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
161 const unsigned char *in, size_t inlen);
162 int (*derive_init) (EVP_PKEY_CTX *ctx);
163 int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
164 int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
165 int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
f723c98e
DSH
166 int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
167 const unsigned char *tbs, size_t tbslen);
168 int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
169 size_t siglen, const unsigned char *tbs,
170 size_t tbslen);
2aee35d3 171 int (*check) (EVP_PKEY *pkey);
b0004708
PY
172 int (*public_check) (EVP_PKEY *pkey);
173 int (*param_check) (EVP_PKEY *pkey);
0a8fdef7
PY
174
175 int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
27af42f9
DSH
176} /* EVP_PKEY_METHOD */ ;
177
a8eba56e 178DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
4a1f3f27 179
27af42f9 180void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
8f463dbd 181
19dbb742
SL
182const EVP_PKEY_METHOD *ossl_dh_pkey_method(void);
183const EVP_PKEY_METHOD *ossl_dhx_pkey_method(void);
5af02212 184const EVP_PKEY_METHOD *ossl_dsa_pkey_method(void);
32ab57cb
SL
185const EVP_PKEY_METHOD *ossl_ec_pkey_method(void);
186const EVP_PKEY_METHOD *ossl_ecx25519_pkey_method(void);
187const EVP_PKEY_METHOD *ossl_ecx448_pkey_method(void);
188const EVP_PKEY_METHOD *ossl_ed25519_pkey_method(void);
189const EVP_PKEY_METHOD *ossl_ed448_pkey_method(void);
23b2fc0b
P
190const EVP_PKEY_METHOD *ossl_rsa_pkey_method(void);
191const EVP_PKEY_METHOD *ossl_rsa_pss_pkey_method(void);
2db6bf6f 192
567db2c1 193struct evp_mac_st {
e74bd290 194 OSSL_PROVIDER *prov;
f7c16d48 195 int name_id;
309a78aa 196 const char *description;
e74bd290
RL
197
198 CRYPTO_REF_COUNT refcnt;
199 CRYPTO_RWLOCK *lock;
200
363b1e5d
DMSP
201 OSSL_FUNC_mac_newctx_fn *newctx;
202 OSSL_FUNC_mac_dupctx_fn *dupctx;
203 OSSL_FUNC_mac_freectx_fn *freectx;
363b1e5d
DMSP
204 OSSL_FUNC_mac_init_fn *init;
205 OSSL_FUNC_mac_update_fn *update;
206 OSSL_FUNC_mac_final_fn *final;
207 OSSL_FUNC_mac_gettable_params_fn *gettable_params;
208 OSSL_FUNC_mac_gettable_ctx_params_fn *gettable_ctx_params;
209 OSSL_FUNC_mac_settable_ctx_params_fn *settable_ctx_params;
210 OSSL_FUNC_mac_get_params_fn *get_params;
211 OSSL_FUNC_mac_get_ctx_params_fn *get_ctx_params;
212 OSSL_FUNC_mac_set_ctx_params_fn *set_ctx_params;
567db2c1
RL
213};
214
d2ba8123 215struct evp_kdf_st {
fb9e6dd6 216 OSSL_PROVIDER *prov;
f7c16d48 217 int name_id;
309a78aa 218 const char *description;
fb9e6dd6
P
219 CRYPTO_REF_COUNT refcnt;
220 CRYPTO_RWLOCK *lock;
221
363b1e5d
DMSP
222 OSSL_FUNC_kdf_newctx_fn *newctx;
223 OSSL_FUNC_kdf_dupctx_fn *dupctx;
224 OSSL_FUNC_kdf_freectx_fn *freectx;
225 OSSL_FUNC_kdf_reset_fn *reset;
226 OSSL_FUNC_kdf_derive_fn *derive;
227 OSSL_FUNC_kdf_gettable_params_fn *gettable_params;
228 OSSL_FUNC_kdf_gettable_ctx_params_fn *gettable_ctx_params;
229 OSSL_FUNC_kdf_settable_ctx_params_fn *settable_ctx_params;
230 OSSL_FUNC_kdf_get_params_fn *get_params;
231 OSSL_FUNC_kdf_get_ctx_params_fn *get_ctx_params;
232 OSSL_FUNC_kdf_set_ctx_params_fn *set_ctx_params;
d2ba8123 233};
5a285add 234
2db6bf6f 235struct evp_md_st {
3653d0c2 236 /* nid */
2db6bf6f 237 int type;
3653d0c2
MC
238
239 /* Legacy structure members */
2db6bf6f
RL
240 int pkey_type;
241 int md_size;
242 unsigned long flags;
243 int (*init) (EVP_MD_CTX *ctx);
244 int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
245 int (*final) (EVP_MD_CTX *ctx, unsigned char *md);
246 int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from);
247 int (*cleanup) (EVP_MD_CTX *ctx);
248 int block_size;
249 int ctx_size; /* how big does the ctx->md_data need to be */
250 /* control function */
251 int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
3653d0c2
MC
252
253 /* New structure members */
946bdd12 254 /* Above comment to be removed when legacy has gone */
f7c16d48 255 int name_id;
309a78aa 256 const char *description;
3653d0c2
MC
257 OSSL_PROVIDER *prov;
258 CRYPTO_REF_COUNT refcnt;
259 CRYPTO_RWLOCK *lock;
363b1e5d
DMSP
260 OSSL_FUNC_digest_newctx_fn *newctx;
261 OSSL_FUNC_digest_init_fn *dinit;
262 OSSL_FUNC_digest_update_fn *dupdate;
263 OSSL_FUNC_digest_final_fn *dfinal;
264 OSSL_FUNC_digest_digest_fn *digest;
265 OSSL_FUNC_digest_freectx_fn *freectx;
266 OSSL_FUNC_digest_dupctx_fn *dupctx;
267 OSSL_FUNC_digest_get_params_fn *get_params;
268 OSSL_FUNC_digest_set_ctx_params_fn *set_ctx_params;
269 OSSL_FUNC_digest_get_ctx_params_fn *get_ctx_params;
270 OSSL_FUNC_digest_gettable_params_fn *gettable_params;
271 OSSL_FUNC_digest_settable_ctx_params_fn *settable_ctx_params;
272 OSSL_FUNC_digest_gettable_ctx_params_fn *gettable_ctx_params;
3653d0c2 273
2db6bf6f
RL
274} /* EVP_MD */ ;
275
e79f8773
RL
276struct evp_cipher_st {
277 int nid;
df05f2ce 278
e79f8773
RL
279 int block_size;
280 /* Default value for variable length ciphers */
281 int key_len;
282 int iv_len;
df05f2ce
MC
283
284 /* Legacy structure members */
e79f8773
RL
285 /* Various flags */
286 unsigned long flags;
287 /* init key */
288 int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key,
289 const unsigned char *iv, int enc);
290 /* encrypt/decrypt data */
291 int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out,
292 const unsigned char *in, size_t inl);
293 /* cleanup ctx */
294 int (*cleanup) (EVP_CIPHER_CTX *);
295 /* how big ctx->cipher_data needs to be */
296 int ctx_size;
297 /* Populate a ASN1_TYPE with parameters */
298 int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
299 /* Get parameters from a ASN1_TYPE */
300 int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
301 /* Miscellaneous operations */
302 int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr);
303 /* Application data */
304 void *app_data;
df05f2ce
MC
305
306 /* New structure members */
946bdd12 307 /* Above comment to be removed when legacy has gone */
f7c16d48 308 int name_id;
309a78aa 309 const char *description;
df05f2ce
MC
310 OSSL_PROVIDER *prov;
311 CRYPTO_REF_COUNT refcnt;
312 CRYPTO_RWLOCK *lock;
363b1e5d
DMSP
313 OSSL_FUNC_cipher_newctx_fn *newctx;
314 OSSL_FUNC_cipher_encrypt_init_fn *einit;
315 OSSL_FUNC_cipher_decrypt_init_fn *dinit;
316 OSSL_FUNC_cipher_update_fn *cupdate;
317 OSSL_FUNC_cipher_final_fn *cfinal;
318 OSSL_FUNC_cipher_cipher_fn *ccipher;
319 OSSL_FUNC_cipher_freectx_fn *freectx;
320 OSSL_FUNC_cipher_dupctx_fn *dupctx;
321 OSSL_FUNC_cipher_get_params_fn *get_params;
322 OSSL_FUNC_cipher_get_ctx_params_fn *get_ctx_params;
323 OSSL_FUNC_cipher_set_ctx_params_fn *set_ctx_params;
324 OSSL_FUNC_cipher_gettable_params_fn *gettable_params;
325 OSSL_FUNC_cipher_gettable_ctx_params_fn *gettable_ctx_params;
326 OSSL_FUNC_cipher_settable_ctx_params_fn *settable_ctx_params;
e79f8773
RL
327} /* EVP_CIPHER */ ;
328
329/* Macros to code block cipher wrappers */
330
331/* Wrapper functions for each cipher mode */
332
44ab2dfd
MC
333#define EVP_C_DATA(kstruct, ctx) \
334 ((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx))
e79f8773
RL
335
336#define BLOCK_CIPHER_ecb_loop() \
337 size_t i, bl; \
338 bl = EVP_CIPHER_CTX_cipher(ctx)->block_size; \
e8aa8b6c 339 if (inl < bl) return 1;\
e79f8773 340 inl -= bl; \
e8aa8b6c 341 for (i=0; i <= inl; i+=bl)
e79f8773
RL
342
343#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
344static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
345{\
346 BLOCK_CIPHER_ecb_loop() \
347 cprefix##_ecb_encrypt(in + i, out + i, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_encrypting(ctx)); \
348 return 1;\
349}
350
351#define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))
352
353#define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
354 static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
355{\
356 while(inl>=EVP_MAXCHUNK) {\
357 int num = EVP_CIPHER_CTX_num(ctx);\
2f5c405a 358 cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, ctx->iv, &num); \
e79f8773
RL
359 EVP_CIPHER_CTX_set_num(ctx, num);\
360 inl-=EVP_MAXCHUNK;\
361 in +=EVP_MAXCHUNK;\
362 out+=EVP_MAXCHUNK;\
363 }\
364 if (inl) {\
365 int num = EVP_CIPHER_CTX_num(ctx);\
2f5c405a 366 cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, ctx->iv, &num); \
e79f8773
RL
367 EVP_CIPHER_CTX_set_num(ctx, num);\
368 }\
369 return 1;\
370}
371
372#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
373static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
374{\
375 while(inl>=EVP_MAXCHUNK) \
376 {\
2f5c405a 377 cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, ctx->iv, EVP_CIPHER_CTX_encrypting(ctx));\
e79f8773
RL
378 inl-=EVP_MAXCHUNK;\
379 in +=EVP_MAXCHUNK;\
380 out+=EVP_MAXCHUNK;\
381 }\
382 if (inl)\
2f5c405a 383 cprefix##_cbc_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, ctx->iv, EVP_CIPHER_CTX_encrypting(ctx));\
e79f8773
RL
384 return 1;\
385}
386
387#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
388static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
389{\
e8aa8b6c
F
390 size_t chunk = EVP_MAXCHUNK;\
391 if (cbits == 1) chunk >>= 3;\
392 if (inl < chunk) chunk = inl;\
393 while (inl && inl >= chunk)\
394 {\
395 int num = EVP_CIPHER_CTX_num(ctx);\
396 cprefix##_cfb##cbits##_encrypt(in, out, (long) \
397 ((cbits == 1) \
398 && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
604e591e 399 ? chunk*8 : chunk), \
2f5c405a 400 &EVP_C_DATA(kstruct, ctx)->ksched, ctx->iv,\
e8aa8b6c
F
401 &num, EVP_CIPHER_CTX_encrypting(ctx));\
402 EVP_CIPHER_CTX_set_num(ctx, num);\
403 inl -= chunk;\
404 in += chunk;\
405 out += chunk;\
406 if (inl < chunk) chunk = inl;\
407 }\
408 return 1;\
e79f8773
RL
409}
410
411#define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
412 BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
413 BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
414 BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
415 BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)
416
417#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
418 key_len, iv_len, flags, init_key, cleanup, \
419 set_asn1, get_asn1, ctrl) \
420static const EVP_CIPHER cname##_##mode = { \
421 nid##_##nmode, block_size, key_len, iv_len, \
422 flags | EVP_CIPH_##MODE##_MODE, \
423 init_key, \
424 cname##_##mode##_cipher, \
425 cleanup, \
426 sizeof(kstruct), \
427 set_asn1, get_asn1,\
428 ctrl, \
429 NULL \
430}; \
431const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
432
433#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
434 iv_len, flags, init_key, cleanup, set_asn1, \
435 get_asn1, ctrl) \
436BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
437 iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
438
439#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \
440 iv_len, cbits, flags, init_key, cleanup, \
441 set_asn1, get_asn1, ctrl) \
442BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
443 key_len, iv_len, flags, init_key, cleanup, set_asn1, \
444 get_asn1, ctrl)
445
446#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \
447 iv_len, cbits, flags, init_key, cleanup, \
448 set_asn1, get_asn1, ctrl) \
449BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \
450 key_len, iv_len, flags, init_key, cleanup, set_asn1, \
451 get_asn1, ctrl)
452
453#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
454 flags, init_key, cleanup, set_asn1, \
455 get_asn1, ctrl) \
456BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
457 0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
458
459#define BLOCK_CIPHER_defs(cname, kstruct, \
460 nid, block_size, key_len, iv_len, cbits, flags, \
461 init_key, cleanup, set_asn1, get_asn1, ctrl) \
462BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
463 init_key, cleanup, set_asn1, get_asn1, ctrl) \
464BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
465 flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
466BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
467 flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
468BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
469 init_key, cleanup, set_asn1, get_asn1, ctrl)
470
471/*-
472#define BLOCK_CIPHER_defs(cname, kstruct, \
473 nid, block_size, key_len, iv_len, flags,\
474 init_key, cleanup, set_asn1, get_asn1, ctrl)\
475static const EVP_CIPHER cname##_cbc = {\
476 nid##_cbc, block_size, key_len, iv_len, \
477 flags | EVP_CIPH_CBC_MODE,\
478 init_key,\
479 cname##_cbc_cipher,\
480 cleanup,\
481 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
482 sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
483 set_asn1, get_asn1,\
484 ctrl, \
485 NULL \
486};\
487const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\
488static const EVP_CIPHER cname##_cfb = {\
489 nid##_cfb64, 1, key_len, iv_len, \
490 flags | EVP_CIPH_CFB_MODE,\
491 init_key,\
492 cname##_cfb_cipher,\
493 cleanup,\
494 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
495 sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
496 set_asn1, get_asn1,\
497 ctrl,\
498 NULL \
499};\
500const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\
501static const EVP_CIPHER cname##_ofb = {\
502 nid##_ofb64, 1, key_len, iv_len, \
503 flags | EVP_CIPH_OFB_MODE,\
504 init_key,\
505 cname##_ofb_cipher,\
506 cleanup,\
507 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
508 sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
509 set_asn1, get_asn1,\
510 ctrl,\
511 NULL \
512};\
513const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\
514static const EVP_CIPHER cname##_ecb = {\
515 nid##_ecb, block_size, key_len, iv_len, \
516 flags | EVP_CIPH_ECB_MODE,\
517 init_key,\
518 cname##_ecb_cipher,\
519 cleanup,\
520 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
521 sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
522 set_asn1, get_asn1,\
523 ctrl,\
524 NULL \
525};\
526const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
527*/
528
529#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
530 block_size, key_len, iv_len, cbits, \
531 flags, init_key, \
532 cleanup, set_asn1, get_asn1, ctrl) \
533 BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
534 BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
535 cbits, flags, init_key, cleanup, set_asn1, \
536 get_asn1, ctrl)
537
538#define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,fl) \
539 BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \
540 BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \
541 NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \
542 (fl)|EVP_CIPH_FLAG_DEFAULT_ASN1, \
543 cipher##_init_key, NULL, NULL, NULL, NULL)
544
924663c3
JZ
545typedef struct {
546 unsigned char iv[EVP_MAX_IV_LENGTH];
547 unsigned int iv_len;
548 unsigned int tag_len;
549} evp_cipher_aead_asn1_params;
550
551int evp_cipher_param_to_asn1_ex(EVP_CIPHER_CTX *c, ASN1_TYPE *type,
552 evp_cipher_aead_asn1_params *params);
553
554int evp_cipher_asn1_to_param_ex(EVP_CIPHER_CTX *c, ASN1_TYPE *type,
555 evp_cipher_aead_asn1_params *params);
556
64954e2f
P
557/*
558 * To support transparent execution of operation in backends other
559 * than the "origin" key, we support transparent export/import to
560 * those providers, and maintain a cache of the imported keydata,
561 * so we don't need to redo the export/import every time we perform
562 * the same operation in that same provider.
563 * This requires that the "origin" backend (whether it's a legacy or a
564 * provider "origin") implements exports, and that the target provider
565 * has an EVP_KEYMGMT that implements import.
566 */
567typedef struct {
568 EVP_KEYMGMT *keymgmt;
569 void *keydata;
570} OP_CACHE_ELEM;
571
572DEFINE_STACK_OF(OP_CACHE_ELEM)
573
3aeb9348 574/*
adc9f731
RL
575 * An EVP_PKEY can have the following states:
576 *
577 * untyped & empty:
578 *
579 * type == EVP_PKEY_NONE && keymgmt == NULL
580 *
581 * typed & empty:
582 *
583 * (type != EVP_PKEY_NONE && pkey.ptr == NULL) ## legacy (libcrypto only)
584 * || (keymgmt != NULL && keydata == NULL) ## provider side
585 *
586 * fully assigned:
587 *
588 * (type != EVP_PKEY_NONE && pkey.ptr != NULL) ## legacy (libcrypto only)
589 * || (keymgmt != NULL && keydata != NULL) ## provider side
590 *
5e5bc836
RL
591 * The easiest way to detect a legacy key is:
592 *
593 * keymgmt == NULL && type != EVP_PKEY_NONE
594 *
595 * The easiest way to detect a provider side key is:
596 *
597 * keymgmt != NULL
3aeb9348 598 */
5e5bc836
RL
599#define evp_pkey_is_blank(pk) \
600 ((pk)->type == EVP_PKEY_NONE && (pk)->keymgmt == NULL)
601#define evp_pkey_is_typed(pk) \
602 ((pk)->type != EVP_PKEY_NONE || (pk)->keymgmt != NULL)
4d4928ed
RL
603#ifndef FIPS_MODULE
604# define evp_pkey_is_assigned(pk) \
5e5bc836 605 ((pk)->pkey.ptr != NULL || (pk)->keydata != NULL)
4d4928ed
RL
606#else
607# define evp_pkey_is_assigned(pk) \
608 ((pk)->keydata != NULL)
609#endif
5e5bc836
RL
610#define evp_pkey_is_legacy(pk) \
611 ((pk)->type != EVP_PKEY_NONE && (pk)->keymgmt == NULL)
612#define evp_pkey_is_provided(pk) \
613 ((pk)->keymgmt != NULL)
614
b574c6a9
MC
615union legacy_pkey_st {
616 void *ptr;
617 struct rsa_st *rsa; /* RSA */
618# ifndef OPENSSL_NO_DSA
619 struct dsa_st *dsa; /* DSA */
620# endif
621# ifndef OPENSSL_NO_DH
622 struct dh_st *dh; /* DH */
623# endif
624# ifndef OPENSSL_NO_EC
625 struct ec_key_st *ec; /* ECC */
626 ECX_KEY *ecx; /* X25519, X448, Ed25519, Ed448 */
627# endif
628};
629
3aeb9348 630struct evp_pkey_st {
a94a3e0d 631 /* == Legacy attributes == */
3aeb9348
DSH
632 int type;
633 int save_type;
3c6ed955 634
f844f9eb 635# ifndef FIPS_MODULE
3c6ed955
RL
636 /*
637 * Legacy key "origin" is composed of a pointer to an EVP_PKEY_ASN1_METHOD,
638 * a pointer to a low level key and possibly a pointer to an engine.
639 */
3aeb9348
DSH
640 const EVP_PKEY_ASN1_METHOD *ameth;
641 ENGINE *engine;
d19b01ad 642 ENGINE *pmeth_engine; /* If not NULL public key ENGINE to use */
b574c6a9
MC
643
644 /* Union to store the reference to an origin legacy key */
645 union legacy_pkey_st pkey;
646
647 /* Union to store the reference to a non-origin legacy key */
648 union legacy_pkey_st legacy_cache_pkey;
adc9f731 649# endif
a94a3e0d
RL
650
651 /* == Common attributes == */
652 CRYPTO_REF_COUNT references;
03273d61 653 CRYPTO_RWLOCK *lock;
a94a3e0d
RL
654 STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
655 int save_parameters;
f844f9eb 656#ifndef FIPS_MODULE
ff1f7cde
AT
657 CRYPTO_EX_DATA ex_data;
658#endif
a94a3e0d
RL
659
660 /* == Provider attributes == */
3c6ed955
RL
661
662 /*
663 * Provider keydata "origin" is composed of a pointer to an EVP_KEYMGMT
664 * and a pointer to the provider side key data. This is never used at
665 * the same time as the legacy key data above.
666 */
667 EVP_KEYMGMT *keymgmt;
668 void *keydata;
669 /*
670 * If any libcrypto code does anything that may modify the keydata
671 * contents, this dirty counter must be incremented.
672 */
673 size_t dirty_cnt;
674
a94a3e0d 675 /*
3c6ed955
RL
676 * To support transparent execution of operation in backends other
677 * than the "origin" key, we support transparent export/import to
678 * those providers, and maintain a cache of the imported keydata,
679 * so we don't need to redo the export/import every time we perform
680 * the same operation in that same provider.
a94a3e0d 681 */
64954e2f
P
682 STACK_OF(OP_CACHE_ELEM) *operation_cache;
683
70a1f7b4 684 /*
3c6ed955
RL
685 * We keep a copy of that "origin"'s dirty count, so we know if the
686 * operation cache needs flushing.
70a1f7b4
RL
687 */
688 size_t dirty_cnt_copy;
6508e858 689
b305452f 690 /* Cache of key object information */
6508e858
RL
691 struct {
692 int bits;
693 int security_bits;
694 int size;
695 } cache;
3aeb9348 696} /* EVP_PKEY */ ;
7b9f8f7f 697
864b89ce
MC
698#define EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) \
699 ((ctx)->operation == EVP_PKEY_OP_SIGN \
700 || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
701 || (ctx)->operation == EVP_PKEY_OP_VERIFY \
702 || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
703 || (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
704
705#define EVP_PKEY_CTX_IS_DERIVE_OP(ctx) \
706 ((ctx)->operation == EVP_PKEY_OP_DERIVE)
7b9f8f7f 707
2c938e2e
MC
708#define EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx) \
709 ((ctx)->operation == EVP_PKEY_OP_ENCRYPT \
710 || (ctx)->operation == EVP_PKEY_OP_DECRYPT)
711
62924755
RL
712#define EVP_PKEY_CTX_IS_GEN_OP(ctx) \
713 ((ctx)->operation == EVP_PKEY_OP_PARAMGEN \
714 || (ctx)->operation == EVP_PKEY_OP_KEYGEN)
715
9a1c4e41
RL
716#define EVP_PKEY_CTX_IS_FROMDATA_OP(ctx) \
717 ((ctx)->operation == EVP_PKEY_OP_FROMDATA)
718
80f4fd18
SL
719#define EVP_PKEY_CTX_IS_KEM_OP(ctx) \
720 ((ctx)->operation == EVP_PKEY_OP_ENCAPSULATE \
721 || (ctx)->operation == EVP_PKEY_OP_DECAPSULATE)
722
b3599dbb
MC
723void openssl_add_all_ciphers_int(void);
724void openssl_add_all_digests_int(void);
725void evp_cleanup_int(void);
0822e89a 726void evp_app_cleanup_int(void);
b4250010 727void *evp_pkey_export_to_provider(EVP_PKEY *pk, OSSL_LIB_CTX *libctx,
3c6ed955
RL
728 EVP_KEYMGMT **keymgmt,
729 const char *propquery);
f844f9eb 730#ifndef FIPS_MODULE
4ce1025a 731int evp_pkey_copy_downgraded(EVP_PKEY **dest, const EVP_PKEY *src);
b574c6a9 732void *evp_pkey_get_legacy(EVP_PKEY *pk);
62924755 733void evp_pkey_free_legacy(EVP_PKEY *x);
4f0831b8
TM
734EVP_PKEY *evp_pkcs82pkey_legacy(const PKCS8_PRIV_KEY_INFO *p8inf,
735 OSSL_LIB_CTX *libctx, const char *propq);
62924755 736#endif
9d6fcd42 737
68552cde
RL
738/*
739 * KEYMGMT utility functions
740 */
af836c22
RL
741
742/*
743 * Key import structure and helper function, to be used as an export callback
744 */
745struct evp_keymgmt_util_try_import_data_st {
746 EVP_KEYMGMT *keymgmt;
747 void *keydata;
748
749 int selection;
750};
751int evp_keymgmt_util_try_import(const OSSL_PARAM params[], void *arg);
752int evp_keymgmt_util_assign_pkey(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt,
753 void *keydata);
754EVP_PKEY *evp_keymgmt_util_make_pkey(EVP_KEYMGMT *keymgmt, void *keydata);
755
655f73ce
RL
756int evp_keymgmt_util_export(const EVP_PKEY *pk, int selection,
757 OSSL_CALLBACK *export_cb, void *export_cbarg);
b305452f 758void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
64954e2f
P
759OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk,
760 EVP_KEYMGMT *keymgmt);
0b07db6f 761int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk, int locking);
64954e2f 762int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk,
3c6ed955
RL
763 EVP_KEYMGMT *keymgmt, void *keydata);
764void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk);
68552cde 765void *evp_keymgmt_util_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt,
b305452f 766 int selection, const OSSL_PARAM params[]);
157ded39 767int evp_keymgmt_util_has(EVP_PKEY *pk, int selection);
1e9101c4 768int evp_keymgmt_util_match(EVP_PKEY *pk1, EVP_PKEY *pk2, int selection);
ff3b59e1 769int evp_keymgmt_util_copy(EVP_PKEY *to, EVP_PKEY *from, int selection);
62924755
RL
770void *evp_keymgmt_util_gen(EVP_PKEY *target, EVP_KEYMGMT *keymgmt,
771 void *genctx, OSSL_CALLBACK *cb, void *cbarg);
3b924da0
RL
772int evp_keymgmt_util_get_deflt_digest_name(EVP_KEYMGMT *keymgmt,
773 void *keydata,
774 char *mdname, size_t mdname_sz);
70a1f7b4 775
68552cde
RL
776/*
777 * KEYMGMT provider interface functions
778 */
b305452f
RL
779void *evp_keymgmt_newdata(const EVP_KEYMGMT *keymgmt);
780void evp_keymgmt_freedata(const EVP_KEYMGMT *keymgmt, void *keyddata);
781int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt,
782 void *keydata, OSSL_PARAM params[]);
4fe54d67
NT
783int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt,
784 void *keydata, const OSSL_PARAM params[]);
1be63b3e
P
785void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection,
786 const OSSL_PARAM params[]);
1a5632e0
RL
787int evp_keymgmt_gen_set_template(const EVP_KEYMGMT *keymgmt, void *genctx,
788 void *template);
789int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx,
790 const OSSL_PARAM params[]);
1a5632e0
RL
791void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx,
792 OSSL_CALLBACK *cb, void *cbarg);
793void evp_keymgmt_gen_cleanup(const EVP_KEYMGMT *keymgmt, void *genctx);
b305452f 794
5dacb38c
RL
795void *evp_keymgmt_load(const EVP_KEYMGMT *keymgmt,
796 const void *objref, size_t objref_sz);
797
b305452f
RL
798int evp_keymgmt_has(const EVP_KEYMGMT *keymgmt, void *keyddata, int selection);
799int evp_keymgmt_validate(const EVP_KEYMGMT *keymgmt, void *keydata,
899e2564 800 int selection, int checktype);
bee5d6cd
RL
801int evp_keymgmt_match(const EVP_KEYMGMT *keymgmt,
802 const void *keydata1, const void *keydata2,
803 int selection);
b305452f
RL
804
805int evp_keymgmt_import(const EVP_KEYMGMT *keymgmt, void *keydata,
806 int selection, const OSSL_PARAM params[]);
807const OSSL_PARAM *evp_keymgmt_import_types(const EVP_KEYMGMT *keymgmt,
808 int selection);
809int evp_keymgmt_export(const EVP_KEYMGMT *keymgmt, void *keydata,
810 int selection, OSSL_CALLBACK *param_cb, void *cbarg);
811const OSSL_PARAM *evp_keymgmt_export_types(const EVP_KEYMGMT *keymgmt,
812 int selection);
13697f1c
RL
813int evp_keymgmt_copy(const EVP_KEYMGMT *keymgmt,
814 void *keydata_to, const void *keydata_from,
815 int selection);
4a9fe33c
TM
816void *evp_keymgmt_dup(const EVP_KEYMGMT *keymgmt,
817 const void *keydata_from);
12603de6 818
46f4e1be 819/* Pulling defines out of C source files */
9d6fcd42 820
80ce21fe
F
821# define EVP_RC4_KEY_SIZE 16
822# ifndef TLS1_1_VERSION
823# define TLS1_1_VERSION 0x0302
824# endif
c0804614
MC
825
826void evp_encode_ctx_set_flags(EVP_ENCODE_CTX *ctx, unsigned int flags);
827
828/* EVP_ENCODE_CTX flags */
3fd59700
MC
829/* Don't generate new lines when encoding */
830#define EVP_ENCODE_CTX_NO_NEWLINES 1
831/* Use the SRP base64 alphabet instead of the standard one */
832#define EVP_ENCODE_CTX_USE_SRP_ALPHABET 2
7606bed9 833
b4250010
DMSP
834const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx,
835 const char *name);
836const EVP_MD *evp_get_digestbyname_ex(OSSL_LIB_CTX *libctx,
837 const char *name);
e683582b 838
4e17fb00
SL
839int ossl_pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen,
840 const unsigned char *salt, int saltlen, int iter,
841 const EVP_MD *digest, int keylen,
842 unsigned char *out,
843 OSSL_LIB_CTX *libctx, const char *propq);
5ccada09 844
80ce21fe 845# ifndef FIPS_MODULE
4fe54d67
NT
846/*
847 * Internal helpers for stricter EVP_PKEY_CTX_{set,get}_params().
848 *
849 * Return 1 on success, 0 or negative for errors.
850 *
851 * In particular they return -2 if any of the params is not supported.
852 *
f844f9eb 853 * They are not available in FIPS_MODULE as they depend on
4fe54d67
NT
854 * - EVP_PKEY_CTX_{get,set}_params()
855 * - EVP_PKEY_CTX_{gettable,settable}_params()
856 *
857 */
858int evp_pkey_ctx_set_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
859int evp_pkey_ctx_get_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
472a88b7 860
d8652be0 861EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id,
b4250010 862 OSSL_LIB_CTX *libctx, const char *propq);
50914496 863int evp_pkey_name2type(const char *name);
977e95b9 864const char *evp_pkey_type2name(int type);
86df26b3
RL
865
866int evp_pkey_ctx_set1_id_prov(EVP_PKEY_CTX *ctx, const void *id, int len);
867int evp_pkey_ctx_get1_id_prov(EVP_PKEY_CTX *ctx, void *id);
868int evp_pkey_ctx_get1_id_len_prov(EVP_PKEY_CTX *ctx, size_t *id_len);
869
870int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx);
80ce21fe
F
871# endif /* !defined(FIPS_MODULE) */
872
860ecfd7 873int evp_method_store_flush(OSSL_LIB_CTX *libctx);
b4250010 874int evp_set_default_properties_int(OSSL_LIB_CTX *libctx, const char *propq,
e6c54619 875 int loadconfig);
3101ab60
MC
876
877void evp_md_ctx_clear_digest(EVP_MD_CTX *ctx, int force);
80ce21fe 878
e19246dc
RL
879/* Three possible states: */
880# define EVP_PKEY_STATE_UNKNOWN 0
881# define EVP_PKEY_STATE_LEGACY 1
882# define EVP_PKEY_STATE_PROVIDER 2
883int evp_pkey_ctx_state(const EVP_PKEY_CTX *ctx);
884
9a1c4e41
RL
885/* These two must ONLY be called for provider side operations */
886int evp_pkey_ctx_ctrl_to_param(EVP_PKEY_CTX *ctx,
887 int keytype, int optype,
888 int cmd, int p1, void *p2);
889int evp_pkey_ctx_ctrl_str_to_param(EVP_PKEY_CTX *ctx,
890 const char *name, const char *value);
891
892/* These two must ONLY be called for legacy operations */
893int evp_pkey_ctx_set_params_to_ctrl(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
894int evp_pkey_ctx_get_params_to_ctrl(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
895
896/* This must ONLY be called for legacy EVP_PKEYs */
897int evp_pkey_get_params_to_ctrl(const EVP_PKEY *pkey, OSSL_PARAM *params);
898
7bc0fdd3
MC
899/* Same as the public get0 functions but are not const */
900# ifndef OPENSSL_NO_DEPRECATED_3_0
901DH *evp_pkey_get0_DH_int(const EVP_PKEY *pkey);
902EC_KEY *evp_pkey_get0_EC_KEY_int(const EVP_PKEY *pkey);
903RSA *evp_pkey_get0_RSA_int(const EVP_PKEY *pkey);
904# endif
905
80ce21fe 906#endif /* OSSL_CRYPTO_EVP_H */