]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/core_numbers.h
Add RSA key validation to default provider
[thirdparty/openssl.git] / include / openssl / core_numbers.h
CommitLineData
4c2883a9
RL
1/*
2 * Copyright 2019 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
ae4186b0
DMSP
10#ifndef OPENSSL_CORE_NUMBERS_H
11# define OPENSSL_CORE_NUMBERS_H
4c2883a9 12
3593266d 13# include <stdarg.h>
4c2883a9 14# include <openssl/core.h>
36fc5fc6 15# include <openssl/self_test.h>
4c2883a9
RL
16
17# ifdef __cplusplus
18extern "C" {
19# endif
20
21/*-
22 * Identities
23 * ----------
24 *
25 * All series start with 1, to allow 0 to be an array terminator.
26 * For any FUNC identity, we also provide a function signature typedef
27 * and a static inline function to extract a function pointer from a
28 * OSSL_DISPATCH element in a type safe manner.
29 *
30 * Names:
31 * for any function base name 'foo' (uppercase form 'FOO'), we will have
32 * the following:
79c44b4e 33 * - a macro for the identity with the name OSSL_FUNC_'FOO' or derivatives
4c2883a9
RL
34 * thereof (to be specified further down)
35 * - a function signature typedef with the name OSSL_'foo'_fn
36 * - a function pointer extractor function with the name OSSL_'foo'
37 */
38
b60cba3c
RS
39/*
40 * Helper macro to create the function signature typedef and the extractor
41 * |type| is the return-type of the function, |name| is the name of the
42 * function to fetch, and |args| is a parenthesized list of parameters
43 * for the function (that is, it is |name|'s function signature).
44 */
4c2883a9
RL
45#define OSSL_CORE_MAKE_FUNC(type,name,args) \
46 typedef type (OSSL_##name##_fn)args; \
47 static ossl_inline \
48 OSSL_##name##_fn *OSSL_get_##name(const OSSL_DISPATCH *opf) \
49 { \
50 return (OSSL_##name##_fn *)opf->function; \
51 }
52
53/*
54 * Core function identities, for the two OSSL_DISPATCH tables being passed
55 * in the OSSL_provider_init call.
56 *
57 * 0 serves as a marker for the end of the OSSL_DISPATCH array, and must
58 * therefore NEVER be used as a function identity.
59 */
60/* Functions provided by the Core to the provider, reserved numbers 1-1023 */
dca97d00 61# define OSSL_FUNC_CORE_GETTABLE_PARAMS 1
26175013 62OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *,
dca97d00 63 core_gettable_params,(const OSSL_PROVIDER *prov))
4c2883a9
RL
64# define OSSL_FUNC_CORE_GET_PARAMS 2
65OSSL_CORE_MAKE_FUNC(int,core_get_params,(const OSSL_PROVIDER *prov,
4e7991b4 66 OSSL_PARAM params[]))
da747958
MC
67# define OSSL_FUNC_CORE_THREAD_START 3
68OSSL_CORE_MAKE_FUNC(int,core_thread_start,(const OSSL_PROVIDER *prov,
69 OSSL_thread_stop_handler_fn handfn))
49c64346 70# define OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT 4
e7706e63
RL
71OSSL_CORE_MAKE_FUNC(OPENSSL_CTX *,core_get_library_context,
72 (const OSSL_PROVIDER *prov))
49c64346
RL
73# define OSSL_FUNC_CORE_NEW_ERROR 5
74OSSL_CORE_MAKE_FUNC(void,core_new_error,(const OSSL_PROVIDER *prov))
75# define OSSL_FUNC_CORE_SET_ERROR_DEBUG 6
76OSSL_CORE_MAKE_FUNC(void,core_set_error_debug,
77 (const OSSL_PROVIDER *prov,
78 const char *file, int line, const char *func))
79# define OSSL_FUNC_CORE_VSET_ERROR 7
80OSSL_CORE_MAKE_FUNC(void,core_vset_error,
81 (const OSSL_PROVIDER *prov,
82 uint32_t reason, const char *fmt, va_list args))
7b131de2
RL
83# define OSSL_FUNC_CORE_SET_ERROR_MARK 8
84OSSL_CORE_MAKE_FUNC(int, core_set_error_mark, (const OSSL_PROVIDER *prov))
85# define OSSL_FUNC_CORE_CLEAR_LAST_ERROR_MARK 9
86OSSL_CORE_MAKE_FUNC(int, core_clear_last_error_mark,
87 (const OSSL_PROVIDER *prov))
88# define OSSL_FUNC_CORE_POP_ERROR_TO_MARK 10
89OSSL_CORE_MAKE_FUNC(int, core_pop_error_to_mark, (const OSSL_PROVIDER *prov))
4c2883a9 90
b60cba3c 91/* Memory allocation, freeing, clearing. */
7b131de2 92#define OSSL_FUNC_CRYPTO_MALLOC 20
b60cba3c
RS
93OSSL_CORE_MAKE_FUNC(void *,
94 CRYPTO_malloc, (size_t num, const char *file, int line))
7b131de2 95#define OSSL_FUNC_CRYPTO_ZALLOC 21
b60cba3c
RS
96OSSL_CORE_MAKE_FUNC(void *,
97 CRYPTO_zalloc, (size_t num, const char *file, int line))
7b131de2 98#define OSSL_FUNC_CRYPTO_FREE 22
b60cba3c
RS
99OSSL_CORE_MAKE_FUNC(void,
100 CRYPTO_free, (void *ptr, const char *file, int line))
7b131de2 101#define OSSL_FUNC_CRYPTO_CLEAR_FREE 23
b60cba3c
RS
102OSSL_CORE_MAKE_FUNC(void,
103 CRYPTO_clear_free, (void *ptr, size_t num, const char *file, int line))
7b131de2 104#define OSSL_FUNC_CRYPTO_REALLOC 24
b60cba3c
RS
105OSSL_CORE_MAKE_FUNC(void *,
106 CRYPTO_realloc, (void *addr, size_t num, const char *file, int line))
7b131de2 107#define OSSL_FUNC_CRYPTO_CLEAR_REALLOC 25
b60cba3c 108OSSL_CORE_MAKE_FUNC(void *,
784883fc
SL
109 CRYPTO_clear_realloc, (void *addr, size_t old_num, size_t num,
110 const char *file, int line))
7b131de2 111#define OSSL_FUNC_CRYPTO_SECURE_MALLOC 26
b60cba3c
RS
112OSSL_CORE_MAKE_FUNC(void *,
113 CRYPTO_secure_malloc, (size_t num, const char *file, int line))
7b131de2 114#define OSSL_FUNC_CRYPTO_SECURE_ZALLOC 27
b60cba3c
RS
115OSSL_CORE_MAKE_FUNC(void *,
116 CRYPTO_secure_zalloc, (size_t num, const char *file, int line))
7b131de2 117#define OSSL_FUNC_CRYPTO_SECURE_FREE 28
b60cba3c
RS
118OSSL_CORE_MAKE_FUNC(void,
119 CRYPTO_secure_free, (void *ptr, const char *file, int line))
7b131de2 120#define OSSL_FUNC_CRYPTO_SECURE_CLEAR_FREE 29
b60cba3c 121OSSL_CORE_MAKE_FUNC(void,
784883fc
SL
122 CRYPTO_secure_clear_free, (void *ptr, size_t num, const char *file,
123 int line))
7b131de2 124#define OSSL_FUNC_CRYPTO_SECURE_ALLOCATED 30
b60cba3c
RS
125OSSL_CORE_MAKE_FUNC(int,
126 CRYPTO_secure_allocated, (const void *ptr))
7b131de2 127#define OSSL_FUNC_OPENSSL_CLEANSE 31
b60cba3c
RS
128OSSL_CORE_MAKE_FUNC(void,
129 OPENSSL_cleanse, (void *ptr, size_t len))
b60cba3c 130
25e60144 131/* Bio functions provided by the core */
7b131de2
RL
132#define OSSL_FUNC_BIO_NEW_FILE 40
133#define OSSL_FUNC_BIO_NEW_MEMBUF 41
134#define OSSL_FUNC_BIO_READ_EX 42
135#define OSSL_FUNC_BIO_FREE 43
136#define OSSL_FUNC_BIO_VPRINTF 44
25e60144
SL
137
138OSSL_CORE_MAKE_FUNC(BIO *, BIO_new_file, (const char *filename, const char *mode))
139OSSL_CORE_MAKE_FUNC(BIO *, BIO_new_membuf, (const void *buf, int len))
7bb82f92
SL
140OSSL_CORE_MAKE_FUNC(int, BIO_read_ex, (BIO *bio, void *data, size_t data_len,
141 size_t *bytes_read))
25e60144 142OSSL_CORE_MAKE_FUNC(int, BIO_free, (BIO *bio))
63665fff
RL
143OSSL_CORE_MAKE_FUNC(int, BIO_vprintf, (BIO *bio, const char *format,
144 va_list args))
25e60144 145
7b131de2 146#define OSSL_FUNC_SELF_TEST_CB 100
36fc5fc6
SL
147OSSL_CORE_MAKE_FUNC(void, self_test_cb, (OPENSSL_CTX *ctx, OSSL_CALLBACK **cb,
148 void **cbarg))
149
4c2883a9
RL
150/* Functions provided by the provider to the Core, reserved numbers 1024-1535 */
151# define OSSL_FUNC_PROVIDER_TEARDOWN 1024
a39eb840 152OSSL_CORE_MAKE_FUNC(void,provider_teardown,(void *provctx))
dca97d00 153# define OSSL_FUNC_PROVIDER_GETTABLE_PARAMS 1025
26175013 154OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *,
dca97d00 155 provider_gettable_params,(void *provctx))
4c2883a9 156# define OSSL_FUNC_PROVIDER_GET_PARAMS 1026
a39eb840 157OSSL_CORE_MAKE_FUNC(int,provider_get_params,(void *provctx,
4e7991b4 158 OSSL_PARAM params[]))
099bd339
RL
159# define OSSL_FUNC_PROVIDER_QUERY_OPERATION 1027
160OSSL_CORE_MAKE_FUNC(const OSSL_ALGORITHM *,provider_query_operation,
a39eb840 161 (void *provctx, int operation_id, const int *no_store))
6ebc2f56
RL
162# define OSSL_FUNC_PROVIDER_GET_REASON_STRINGS 1028
163OSSL_CORE_MAKE_FUNC(const OSSL_ITEM *,provider_get_reason_strings,
164 (void *provctx))
4c2883a9 165
784883fc 166/* Operations */
3653d0c2 167
2893111f 168# define OSSL_OP_DIGEST 1
784883fc
SL
169# define OSSL_OP_CIPHER 2 /* Symmetric Ciphers */
170# define OSSL_OP_MAC 3
ad1700c7 171# define OSSL_OP_KDF 4
784883fc
SL
172# define OSSL_OP_KEYMGMT 10
173# define OSSL_OP_KEYEXCH 11
dfcb5d29 174# define OSSL_OP_SIGNATURE 12
2c938e2e 175# define OSSL_OP_ASYM_CIPHER 13
0d003c52
RL
176/* New section for non-EVP operations */
177# define OSSL_OP_SERIALIZER 20
784883fc 178/* Highest known operation number */
0d003c52 179# define OSSL_OP__HIGHEST 20
784883fc
SL
180
181/* Digests */
2893111f
RL
182
183# define OSSL_FUNC_DIGEST_NEWCTX 1
184# define OSSL_FUNC_DIGEST_INIT 2
185# define OSSL_FUNC_DIGEST_UPDATE 3
186# define OSSL_FUNC_DIGEST_FINAL 4
187# define OSSL_FUNC_DIGEST_DIGEST 5
188# define OSSL_FUNC_DIGEST_FREECTX 6
189# define OSSL_FUNC_DIGEST_DUPCTX 7
190# define OSSL_FUNC_DIGEST_GET_PARAMS 8
92d9d0ae
RL
191# define OSSL_FUNC_DIGEST_SET_CTX_PARAMS 9
192# define OSSL_FUNC_DIGEST_GET_CTX_PARAMS 10
ae3ff60e
RL
193# define OSSL_FUNC_DIGEST_GETTABLE_PARAMS 11
194# define OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS 12
195# define OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS 13
df05f2ce 196
a39eb840
RL
197OSSL_CORE_MAKE_FUNC(void *, OP_digest_newctx, (void *provctx))
198OSSL_CORE_MAKE_FUNC(int, OP_digest_init, (void *dctx))
3653d0c2 199OSSL_CORE_MAKE_FUNC(int, OP_digest_update,
a39eb840 200 (void *dctx, const unsigned char *in, size_t inl))
3653d0c2 201OSSL_CORE_MAKE_FUNC(int, OP_digest_final,
a39eb840
RL
202 (void *dctx,
203 unsigned char *out, size_t *outl, size_t outsz))
3653d0c2 204OSSL_CORE_MAKE_FUNC(int, OP_digest_digest,
a39eb840 205 (void *provctx, const unsigned char *in, size_t inl,
8ccf2ffb 206 unsigned char *out, size_t *outl, size_t outsz))
df05f2ce 207
a39eb840
RL
208OSSL_CORE_MAKE_FUNC(void, OP_digest_freectx, (void *dctx))
209OSSL_CORE_MAKE_FUNC(void *, OP_digest_dupctx, (void *dctx))
d5e5e2ff 210
2893111f 211OSSL_CORE_MAKE_FUNC(int, OP_digest_get_params, (OSSL_PARAM params[]))
92d9d0ae 212OSSL_CORE_MAKE_FUNC(int, OP_digest_set_ctx_params,
2893111f 213 (void *vctx, const OSSL_PARAM params[]))
92d9d0ae 214OSSL_CORE_MAKE_FUNC(int, OP_digest_get_ctx_params,
2893111f 215 (void *vctx, OSSL_PARAM params[]))
ae3ff60e
RL
216OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_digest_gettable_params, (void))
217OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_digest_settable_ctx_params, (void))
218OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_digest_gettable_ctx_params, (void))
df05f2ce
MC
219
220/* Symmetric Ciphers */
221
df05f2ce
MC
222# define OSSL_FUNC_CIPHER_NEWCTX 1
223# define OSSL_FUNC_CIPHER_ENCRYPT_INIT 2
224# define OSSL_FUNC_CIPHER_DECRYPT_INIT 3
225# define OSSL_FUNC_CIPHER_UPDATE 4
226# define OSSL_FUNC_CIPHER_FINAL 5
718b133a
MC
227# define OSSL_FUNC_CIPHER_CIPHER 6
228# define OSSL_FUNC_CIPHER_FREECTX 7
229# define OSSL_FUNC_CIPHER_DUPCTX 8
80942379 230# define OSSL_FUNC_CIPHER_GET_PARAMS 9
92d9d0ae
RL
231# define OSSL_FUNC_CIPHER_GET_CTX_PARAMS 10
232# define OSSL_FUNC_CIPHER_SET_CTX_PARAMS 11
ae3ff60e
RL
233# define OSSL_FUNC_CIPHER_GETTABLE_PARAMS 12
234# define OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS 13
235# define OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS 14
df05f2ce 236
a39eb840
RL
237OSSL_CORE_MAKE_FUNC(void *, OP_cipher_newctx, (void *provctx))
238OSSL_CORE_MAKE_FUNC(int, OP_cipher_encrypt_init, (void *cctx,
df05f2ce 239 const unsigned char *key,
344cfa34
MC
240 size_t keylen,
241 const unsigned char *iv,
242 size_t ivlen))
a39eb840 243OSSL_CORE_MAKE_FUNC(int, OP_cipher_decrypt_init, (void *cctx,
df05f2ce 244 const unsigned char *key,
344cfa34
MC
245 size_t keylen,
246 const unsigned char *iv,
247 size_t ivlen))
df05f2ce 248OSSL_CORE_MAKE_FUNC(int, OP_cipher_update,
a39eb840
RL
249 (void *cctx,
250 unsigned char *out, size_t *outl, size_t outsize,
df05f2ce
MC
251 const unsigned char *in, size_t inl))
252OSSL_CORE_MAKE_FUNC(int, OP_cipher_final,
a39eb840
RL
253 (void *cctx,
254 unsigned char *out, size_t *outl, size_t outsize))
df05f2ce 255OSSL_CORE_MAKE_FUNC(int, OP_cipher_cipher,
a39eb840 256 (void *cctx,
f79858ac
RL
257 unsigned char *out, size_t *outl, size_t outsize,
258 const unsigned char *in, size_t inl))
a39eb840
RL
259OSSL_CORE_MAKE_FUNC(void, OP_cipher_freectx, (void *cctx))
260OSSL_CORE_MAKE_FUNC(void *, OP_cipher_dupctx, (void *cctx))
4e7991b4 261OSSL_CORE_MAKE_FUNC(int, OP_cipher_get_params, (OSSL_PARAM params[]))
92d9d0ae 262OSSL_CORE_MAKE_FUNC(int, OP_cipher_get_ctx_params, (void *cctx,
4e7991b4 263 OSSL_PARAM params[]))
92d9d0ae 264OSSL_CORE_MAKE_FUNC(int, OP_cipher_set_ctx_params, (void *cctx,
718b133a 265 const OSSL_PARAM params[]))
784883fc
SL
266OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_cipher_gettable_params, (void))
267OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_cipher_settable_ctx_params, (void))
268OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_cipher_gettable_ctx_params, (void))
df05f2ce 269
e74bd290
RL
270/* MACs */
271
e74bd290
RL
272# define OSSL_FUNC_MAC_NEWCTX 1
273# define OSSL_FUNC_MAC_DUPCTX 2
274# define OSSL_FUNC_MAC_FREECTX 3
275# define OSSL_FUNC_MAC_INIT 4
276# define OSSL_FUNC_MAC_UPDATE 5
277# define OSSL_FUNC_MAC_FINAL 6
784883fc
SL
278# define OSSL_FUNC_MAC_GET_PARAMS 7
279# define OSSL_FUNC_MAC_GET_CTX_PARAMS 8
280# define OSSL_FUNC_MAC_SET_CTX_PARAMS 9
281# define OSSL_FUNC_MAC_GETTABLE_PARAMS 10
282# define OSSL_FUNC_MAC_GETTABLE_CTX_PARAMS 11
283# define OSSL_FUNC_MAC_SETTABLE_CTX_PARAMS 12
e74bd290
RL
284
285OSSL_CORE_MAKE_FUNC(void *, OP_mac_newctx, (void *provctx))
286OSSL_CORE_MAKE_FUNC(void *, OP_mac_dupctx, (void *src))
287OSSL_CORE_MAKE_FUNC(void, OP_mac_freectx, (void *mctx))
288OSSL_CORE_MAKE_FUNC(size_t, OP_mac_size, (void *mctx))
289OSSL_CORE_MAKE_FUNC(int, OP_mac_init, (void *mctx))
290OSSL_CORE_MAKE_FUNC(int, OP_mac_update,
291 (void *mctx, const unsigned char *in, size_t inl))
292OSSL_CORE_MAKE_FUNC(int, OP_mac_final,
293 (void *mctx,
294 unsigned char *out, size_t *outl, size_t outsize))
295OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_mac_gettable_params, (void))
296OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_mac_gettable_ctx_params, (void))
297OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_mac_settable_ctx_params, (void))
298OSSL_CORE_MAKE_FUNC(int, OP_mac_get_params, (OSSL_PARAM params[]))
92d9d0ae 299OSSL_CORE_MAKE_FUNC(int, OP_mac_get_ctx_params,
e74bd290 300 (void *mctx, OSSL_PARAM params[]))
92d9d0ae 301OSSL_CORE_MAKE_FUNC(int, OP_mac_set_ctx_params,
e74bd290
RL
302 (void *mctx, const OSSL_PARAM params[]))
303
2f755701 304/* KDFs and PRFs */
2f755701
P
305
306# define OSSL_FUNC_KDF_NEWCTX 1
307# define OSSL_FUNC_KDF_DUPCTX 2
308# define OSSL_FUNC_KDF_FREECTX 3
309# define OSSL_FUNC_KDF_RESET 4
310# define OSSL_FUNC_KDF_DERIVE 5
311# define OSSL_FUNC_KDF_GETTABLE_PARAMS 6
312# define OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS 7
313# define OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS 8
314# define OSSL_FUNC_KDF_GET_PARAMS 9
315# define OSSL_FUNC_KDF_GET_CTX_PARAMS 10
316# define OSSL_FUNC_KDF_SET_CTX_PARAMS 11
317
318OSSL_CORE_MAKE_FUNC(void *, OP_kdf_newctx, (void *provctx))
319OSSL_CORE_MAKE_FUNC(void *, OP_kdf_dupctx, (void *src))
320OSSL_CORE_MAKE_FUNC(void, OP_kdf_freectx, (void *kctx))
321OSSL_CORE_MAKE_FUNC(void, OP_kdf_reset, (void *kctx))
322OSSL_CORE_MAKE_FUNC(int, OP_kdf_derive, (void *kctx, unsigned char *key,
323 size_t keylen))
324OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_kdf_gettable_params, (void))
325OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_kdf_gettable_ctx_params, (void))
326OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_kdf_settable_ctx_params, (void))
327OSSL_CORE_MAKE_FUNC(int, OP_kdf_get_params, (OSSL_PARAM params[]))
328OSSL_CORE_MAKE_FUNC(int, OP_kdf_get_ctx_params,
329 (void *kctx, OSSL_PARAM params[]))
330OSSL_CORE_MAKE_FUNC(int, OP_kdf_set_ctx_params,
331 (void *kctx, const OSSL_PARAM params[]))
332
a94a3e0d
RL
333/*-
334 * Key management
335 *
336 * Key domain parameter references can be created in several manners:
337 * - by importing the domain parameter material via an OSSL_PARAM array.
338 * - by generating key domain parameters, given input via an OSSL_PARAM
339 * array.
340 *
341 * Key references can be created in several manners:
342 * - by importing the key material via an OSSL_PARAM array.
343 * - by generating a key, given optional domain parameters and
344 * additional keygen parameters.
345 * If domain parameters are given, they must have been generated using
346 * the domain parameter generator functions.
347 * If the domain parameters comes from a different provider, results
348 * are undefined.
349 * THE CALLER MUST ENSURE THAT CORRECT DOMAIN PARAMETERS ARE USED.
350 * - by loading an internal key, given a binary blob that forms an identity.
351 * THE CALLER MUST ENSURE THAT A CORRECT IDENTITY IS USED.
352 */
353
a94a3e0d 354/* Key domain parameter creation and destruction */
c8a55735
RL
355# define OSSL_FUNC_KEYMGMT_IMPORTDOMPARAMS 1
356# define OSSL_FUNC_KEYMGMT_GENDOMPARAMS 2
357# define OSSL_FUNC_KEYMGMT_FREEDOMPARAMS 3
a94a3e0d
RL
358OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_importdomparams,
359 (void *provctx, const OSSL_PARAM params[]))
360OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_gendomparams,
361 (void *provctx, const OSSL_PARAM params[]))
362OSSL_CORE_MAKE_FUNC(void, OP_keymgmt_freedomparams, (void *domparams))
363
364/* Key domain parameter export */
c8a55735 365# define OSSL_FUNC_KEYMGMT_EXPORTDOMPARAMS 4
a94a3e0d 366OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_exportdomparams,
1640d48c 367 (void *domparams, OSSL_CALLBACK *param_cb, void *cbarg))
a94a3e0d
RL
368
369/* Key domain parameter discovery */
1640d48c
RL
370/*
371 * TODO(v3.0) investigate if we need OP_keymgmt_exportdomparam_types.
372 * 'openssl provider' may be a caller...
373 */
c8a55735
RL
374# define OSSL_FUNC_KEYMGMT_IMPORTDOMPARAM_TYPES 5
375# define OSSL_FUNC_KEYMGMT_EXPORTDOMPARAM_TYPES 6
a94a3e0d
RL
376OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_importdomparam_types,
377 (void))
378OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_exportdomparam_types,
379 (void))
380
6508e858 381/* Key domain parameter information */
c8a55735
RL
382#define OSSL_FUNC_KEYMGMT_GET_DOMPARAM_PARAMS 7
383#define OSSL_FUNC_KEYMGMT_GETTABLE_DOMPARAM_PARAMS 8
6508e858
RL
384OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_domparam_params,
385 (void *domparam, OSSL_PARAM params[]))
386OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_domparam_params,
387 (void))
388
a94a3e0d 389/* Key creation and destruction */
c8a55735
RL
390# define OSSL_FUNC_KEYMGMT_IMPORTKEY 20
391# define OSSL_FUNC_KEYMGMT_GENKEY 21
392# define OSSL_FUNC_KEYMGMT_LOADKEY 22
393# define OSSL_FUNC_KEYMGMT_FREEKEY 23
a94a3e0d
RL
394OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_importkey,
395 (void *provctx, const OSSL_PARAM params[]))
396OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_genkey,
397 (void *provctx,
398 void *domparams, const OSSL_PARAM genkeyparams[]))
399OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_loadkey,
400 (void *provctx, void *id, size_t idlen))
401OSSL_CORE_MAKE_FUNC(void, OP_keymgmt_freekey, (void *key))
402
403/* Key export */
c8a55735 404# define OSSL_FUNC_KEYMGMT_EXPORTKEY 24
a94a3e0d 405OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_exportkey,
1640d48c 406 (void *key, OSSL_CALLBACK *param_cb, void *cbarg))
a94a3e0d
RL
407
408/* Key discovery */
1640d48c
RL
409/*
410 * TODO(v3.0) investigate if we need OP_keymgmt_exportkey_types.
411 * 'openssl provider' may be a caller...
412 */
c8a55735
RL
413# define OSSL_FUNC_KEYMGMT_IMPORTKEY_TYPES 25
414# define OSSL_FUNC_KEYMGMT_EXPORTKEY_TYPES 26
a94a3e0d
RL
415OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_importkey_types, (void))
416OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_exportkey_types, (void))
417
6508e858 418/* Key information */
12603de6
SL
419# define OSSL_FUNC_KEYMGMT_GET_KEY_PARAMS 27
420# define OSSL_FUNC_KEYMGMT_GETTABLE_KEY_PARAMS 28
6508e858
RL
421OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_key_params,
422 (void *key, OSSL_PARAM params[]))
423OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_key_params, (void))
424
e62a45b6 425/* Discovery of supported operations */
c8a55735 426# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 40
e62a45b6
RL
427OSSL_CORE_MAKE_FUNC(const char *,OP_keymgmt_query_operation_name,
428 (int operation_id))
429
12603de6
SL
430/* Key validation */
431# define OSSL_FUNC_KEYMGMT_VALIDATE_DOMPARAMS 29
432# define OSSL_FUNC_KEYMGMT_VALIDATE_PUBLIC 30
433# define OSSL_FUNC_KEYMGMT_VALIDATE_PRIVATE 31
434# define OSSL_FUNC_KEYMGMT_VALIDATE_PAIRWISE 32
435OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_validate_domparams, (void *key))
436OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_validate_public, (void *key))
437OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_validate_private, (void *key))
438OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_validate_pairwise, (void *key))
439
ff64702b
MC
440/* Key Exchange */
441
ff64702b
MC
442# define OSSL_FUNC_KEYEXCH_NEWCTX 1
443# define OSSL_FUNC_KEYEXCH_INIT 2
444# define OSSL_FUNC_KEYEXCH_DERIVE 3
445# define OSSL_FUNC_KEYEXCH_SET_PEER 4
446# define OSSL_FUNC_KEYEXCH_FREECTX 5
447# define OSSL_FUNC_KEYEXCH_DUPCTX 6
9c45222d
MC
448# define OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS 7
449# define OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS 8
ff64702b
MC
450
451OSSL_CORE_MAKE_FUNC(void *, OP_keyexch_newctx, (void *provctx))
8b84b075 452OSSL_CORE_MAKE_FUNC(int, OP_keyexch_init, (void *ctx, void *provkey))
59972370
MC
453OSSL_CORE_MAKE_FUNC(int, OP_keyexch_derive, (void *ctx, unsigned char *secret,
454 size_t *secretlen, size_t outlen))
8b84b075 455OSSL_CORE_MAKE_FUNC(int, OP_keyexch_set_peer, (void *ctx, void *provkey))
ff64702b
MC
456OSSL_CORE_MAKE_FUNC(void, OP_keyexch_freectx, (void *ctx))
457OSSL_CORE_MAKE_FUNC(void *, OP_keyexch_dupctx, (void *ctx))
9c45222d
MC
458OSSL_CORE_MAKE_FUNC(int, OP_keyexch_set_ctx_params, (void *ctx,
459 const OSSL_PARAM params[]))
460OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keyexch_settable_ctx_params,
461 (void))
ff64702b 462
dfcb5d29
MC
463/* Signature */
464
465# define OSSL_FUNC_SIGNATURE_NEWCTX 1
466# define OSSL_FUNC_SIGNATURE_SIGN_INIT 2
467# define OSSL_FUNC_SIGNATURE_SIGN 3
390acbeb
MC
468# define OSSL_FUNC_SIGNATURE_VERIFY_INIT 4
469# define OSSL_FUNC_SIGNATURE_VERIFY 5
470# define OSSL_FUNC_SIGNATURE_VERIFY_RECOVER_INIT 6
471# define OSSL_FUNC_SIGNATURE_VERIFY_RECOVER 7
d8c98d79
MC
472# define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT 8
473# define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE 9
474# define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL 10
475# define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT 11
476# define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE 12
477# define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL 13
478# define OSSL_FUNC_SIGNATURE_FREECTX 14
479# define OSSL_FUNC_SIGNATURE_DUPCTX 15
480# define OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS 16
481# define OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS 17
482# define OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS 18
483# define OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS 19
484# define OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS 20
485# define OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS 21
486# define OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS 22
487# define OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS 23
dfcb5d29
MC
488
489OSSL_CORE_MAKE_FUNC(void *, OP_signature_newctx, (void *provctx))
490OSSL_CORE_MAKE_FUNC(int, OP_signature_sign_init, (void *ctx, void *provkey))
491OSSL_CORE_MAKE_FUNC(int, OP_signature_sign, (void *ctx, unsigned char *sig,
492 size_t *siglen, size_t sigsize,
493 const unsigned char *tbs,
494 size_t tbslen))
390acbeb
MC
495OSSL_CORE_MAKE_FUNC(int, OP_signature_verify_init, (void *ctx, void *provkey))
496OSSL_CORE_MAKE_FUNC(int, OP_signature_verify, (void *ctx,
497 const unsigned char *sig,
498 size_t siglen,
499 const unsigned char *tbs,
500 size_t tbslen))
501OSSL_CORE_MAKE_FUNC(int, OP_signature_verify_recover_init, (void *ctx,
502 void *provkey))
503OSSL_CORE_MAKE_FUNC(int, OP_signature_verify_recover, (void *ctx,
504 unsigned char *rout,
505 size_t *routlen,
506 size_t routsize,
507 const unsigned char *sig,
508 size_t siglen))
d8c98d79
MC
509OSSL_CORE_MAKE_FUNC(int, OP_signature_digest_sign_init,
510 (void *ctx, const char *mdname, const char *props,
511 void *provkey))
512OSSL_CORE_MAKE_FUNC(int, OP_signature_digest_sign_update,
513 (void *ctx, const unsigned char *data, size_t datalen))
514OSSL_CORE_MAKE_FUNC(int, OP_signature_digest_sign_final,
515 (void *ctx, unsigned char *sig, size_t *siglen,
516 size_t sigsize))
517OSSL_CORE_MAKE_FUNC(int, OP_signature_digest_verify_init,
518 (void *ctx, const char *mdname, const char *props,
519 void *provkey))
520OSSL_CORE_MAKE_FUNC(int, OP_signature_digest_verify_update,
521 (void *ctx, const unsigned char *data, size_t datalen))
522OSSL_CORE_MAKE_FUNC(int, OP_signature_digest_verify_final,
523 (void *ctx, const unsigned char *sig, size_t siglen))
dfcb5d29
MC
524OSSL_CORE_MAKE_FUNC(void, OP_signature_freectx, (void *ctx))
525OSSL_CORE_MAKE_FUNC(void *, OP_signature_dupctx, (void *ctx))
9c45222d
MC
526OSSL_CORE_MAKE_FUNC(int, OP_signature_get_ctx_params,
527 (void *ctx, OSSL_PARAM params[]))
528OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_signature_gettable_ctx_params,
529 (void))
530OSSL_CORE_MAKE_FUNC(int, OP_signature_set_ctx_params,
531 (void *ctx, const OSSL_PARAM params[]))
532OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_signature_settable_ctx_params,
533 (void))
d8c98d79
MC
534OSSL_CORE_MAKE_FUNC(int, OP_signature_get_ctx_md_params,
535 (void *ctx, OSSL_PARAM params[]))
536OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_signature_gettable_ctx_md_params,
537 (void *ctx))
538OSSL_CORE_MAKE_FUNC(int, OP_signature_set_ctx_md_params,
539 (void *ctx, const OSSL_PARAM params[]))
540OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_signature_settable_ctx_md_params,
541 (void *ctx))
dfcb5d29 542
2c938e2e
MC
543
544/* Asymmetric Ciphers */
545
546# define OSSL_FUNC_ASYM_CIPHER_NEWCTX 1
547# define OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT 2
548# define OSSL_FUNC_ASYM_CIPHER_ENCRYPT 3
549# define OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT 4
550# define OSSL_FUNC_ASYM_CIPHER_DECRYPT 5
551# define OSSL_FUNC_ASYM_CIPHER_FREECTX 6
552# define OSSL_FUNC_ASYM_CIPHER_DUPCTX 7
553# define OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS 8
554# define OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS 9
555# define OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS 10
556# define OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS 11
557
558OSSL_CORE_MAKE_FUNC(void *, OP_asym_cipher_newctx, (void *provctx))
559OSSL_CORE_MAKE_FUNC(int, OP_asym_cipher_encrypt_init, (void *ctx, void *provkey))
560OSSL_CORE_MAKE_FUNC(int, OP_asym_cipher_encrypt, (void *ctx, unsigned char *out,
561 size_t *outlen,
562 size_t outsize,
563 const unsigned char *in,
564 size_t inlen))
565OSSL_CORE_MAKE_FUNC(int, OP_asym_cipher_decrypt_init, (void *ctx, void *provkey))
566OSSL_CORE_MAKE_FUNC(int, OP_asym_cipher_decrypt, (void *ctx, unsigned char *out,
567 size_t *outlen,
568 size_t outsize,
569 const unsigned char *in,
570 size_t inlen))
571OSSL_CORE_MAKE_FUNC(void, OP_asym_cipher_freectx, (void *ctx))
572OSSL_CORE_MAKE_FUNC(void *, OP_asym_cipher_dupctx, (void *ctx))
573OSSL_CORE_MAKE_FUNC(int, OP_asym_cipher_get_ctx_params,
574 (void *ctx, OSSL_PARAM params[]))
575OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_asym_cipher_gettable_ctx_params,
576 (void))
577OSSL_CORE_MAKE_FUNC(int, OP_asym_cipher_set_ctx_params,
578 (void *ctx, const OSSL_PARAM params[]))
579OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_asym_cipher_settable_ctx_params,
580 (void))
581
0d003c52
RL
582/* Serializers */
583# define OSSL_FUNC_SERIALIZER_NEWCTX 1
584# define OSSL_FUNC_SERIALIZER_FREECTX 2
585# define OSSL_FUNC_SERIALIZER_SET_CTX_PARAMS 3
586# define OSSL_FUNC_SERIALIZER_SETTABLE_CTX_PARAMS 4
587# define OSSL_FUNC_SERIALIZER_SERIALIZE_DATA 10
588# define OSSL_FUNC_SERIALIZER_SERIALIZE_OBJECT 11
589OSSL_CORE_MAKE_FUNC(void *, OP_serializer_newctx, (void *provctx))
590OSSL_CORE_MAKE_FUNC(void, OP_serializer_freectx, (void *ctx))
591OSSL_CORE_MAKE_FUNC(int, OP_serializer_set_ctx_params,
592 (void *ctx, const OSSL_PARAM params[]))
593OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_serializer_settable_ctx_params,
594 (void))
595
596OSSL_CORE_MAKE_FUNC(int, OP_serializer_serialize_data,
597 (void *ctx, const OSSL_PARAM[], BIO *out,
598 OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg))
599OSSL_CORE_MAKE_FUNC(int, OP_serializer_serialize_object,
600 (void *ctx, void *obj, BIO *out,
601 OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg))
602
4c2883a9
RL
603# ifdef __cplusplus
604}
605# endif
606
607#endif