2 * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
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
10 #ifndef OPENSSL_CORE_NUMBERS_H
11 # define OPENSSL_CORE_NUMBERS_H
15 # include <openssl/core.h>
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.
31 * for any function base name 'foo' (uppercase form 'FOO'), we will have
33 * - a macro for the identity with the name OSSL_FUNC_'FOO' or derivatives
34 * thereof (to be specified further down)
35 * - a function signature typedef with the name OSSL_FUNC_'foo'_fn
36 * - a function pointer extractor function with the name OSSL_FUNC_'foo'
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 * Note: This is considered a "reserved" internal macro. Applications should
45 * not use this or assume its existence.
47 #define OSSL_CORE_MAKE_FUNC(type,name,args) \
48 typedef type (OSSL_FUNC_##name##_fn)args; \
49 static ossl_unused ossl_inline \
50 OSSL_FUNC_##name##_fn *OSSL_FUNC_##name(const OSSL_DISPATCH *opf) \
52 return (OSSL_FUNC_##name##_fn *)opf->function; \
56 * Core function identities, for the two OSSL_DISPATCH tables being passed
57 * in the OSSL_provider_init call.
59 * 0 serves as a marker for the end of the OSSL_DISPATCH array, and must
60 * therefore NEVER be used as a function identity.
62 /* Functions provided by the Core to the provider, reserved numbers 1-1023 */
63 # define OSSL_FUNC_CORE_GETTABLE_PARAMS 1
64 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,
65 core_gettable_params
,(const OSSL_CORE_HANDLE
*prov
))
66 # define OSSL_FUNC_CORE_GET_PARAMS 2
67 OSSL_CORE_MAKE_FUNC(int,core_get_params
,(const OSSL_CORE_HANDLE
*prov
,
69 # define OSSL_FUNC_CORE_THREAD_START 3
70 OSSL_CORE_MAKE_FUNC(int,core_thread_start
,(const OSSL_CORE_HANDLE
*prov
,
71 OSSL_thread_stop_handler_fn handfn
))
72 # define OSSL_FUNC_CORE_GET_LIBCTX 4
73 OSSL_CORE_MAKE_FUNC(OPENSSL_CORE_CTX
*,core_get_libctx
,
74 (const OSSL_CORE_HANDLE
*prov
))
75 # define OSSL_FUNC_CORE_NEW_ERROR 5
76 OSSL_CORE_MAKE_FUNC(void,core_new_error
,(const OSSL_CORE_HANDLE
*prov
))
77 # define OSSL_FUNC_CORE_SET_ERROR_DEBUG 6
78 OSSL_CORE_MAKE_FUNC(void,core_set_error_debug
,
79 (const OSSL_CORE_HANDLE
*prov
,
80 const char *file
, int line
, const char *func
))
81 # define OSSL_FUNC_CORE_VSET_ERROR 7
82 OSSL_CORE_MAKE_FUNC(void,core_vset_error
,
83 (const OSSL_CORE_HANDLE
*prov
,
84 uint32_t reason
, const char *fmt
, va_list args
))
85 # define OSSL_FUNC_CORE_SET_ERROR_MARK 8
86 OSSL_CORE_MAKE_FUNC(int, core_set_error_mark
, (const OSSL_CORE_HANDLE
*prov
))
87 # define OSSL_FUNC_CORE_CLEAR_LAST_ERROR_MARK 9
88 OSSL_CORE_MAKE_FUNC(int, core_clear_last_error_mark
,
89 (const OSSL_CORE_HANDLE
*prov
))
90 # define OSSL_FUNC_CORE_POP_ERROR_TO_MARK 10
91 OSSL_CORE_MAKE_FUNC(int, core_pop_error_to_mark
, (const OSSL_CORE_HANDLE
*prov
))
93 /* Memory allocation, freeing, clearing. */
94 #define OSSL_FUNC_CRYPTO_MALLOC 20
95 OSSL_CORE_MAKE_FUNC(void *,
96 CRYPTO_malloc
, (size_t num
, const char *file
, int line
))
97 #define OSSL_FUNC_CRYPTO_ZALLOC 21
98 OSSL_CORE_MAKE_FUNC(void *,
99 CRYPTO_zalloc
, (size_t num
, const char *file
, int line
))
100 #define OSSL_FUNC_CRYPTO_FREE 22
101 OSSL_CORE_MAKE_FUNC(void,
102 CRYPTO_free
, (void *ptr
, const char *file
, int line
))
103 #define OSSL_FUNC_CRYPTO_CLEAR_FREE 23
104 OSSL_CORE_MAKE_FUNC(void,
105 CRYPTO_clear_free
, (void *ptr
, size_t num
, const char *file
, int line
))
106 #define OSSL_FUNC_CRYPTO_REALLOC 24
107 OSSL_CORE_MAKE_FUNC(void *,
108 CRYPTO_realloc
, (void *addr
, size_t num
, const char *file
, int line
))
109 #define OSSL_FUNC_CRYPTO_CLEAR_REALLOC 25
110 OSSL_CORE_MAKE_FUNC(void *,
111 CRYPTO_clear_realloc
, (void *addr
, size_t old_num
, size_t num
,
112 const char *file
, int line
))
113 #define OSSL_FUNC_CRYPTO_SECURE_MALLOC 26
114 OSSL_CORE_MAKE_FUNC(void *,
115 CRYPTO_secure_malloc
, (size_t num
, const char *file
, int line
))
116 #define OSSL_FUNC_CRYPTO_SECURE_ZALLOC 27
117 OSSL_CORE_MAKE_FUNC(void *,
118 CRYPTO_secure_zalloc
, (size_t num
, const char *file
, int line
))
119 #define OSSL_FUNC_CRYPTO_SECURE_FREE 28
120 OSSL_CORE_MAKE_FUNC(void,
121 CRYPTO_secure_free
, (void *ptr
, const char *file
, int line
))
122 #define OSSL_FUNC_CRYPTO_SECURE_CLEAR_FREE 29
123 OSSL_CORE_MAKE_FUNC(void,
124 CRYPTO_secure_clear_free
, (void *ptr
, size_t num
, const char *file
,
126 #define OSSL_FUNC_CRYPTO_SECURE_ALLOCATED 30
127 OSSL_CORE_MAKE_FUNC(int,
128 CRYPTO_secure_allocated
, (const void *ptr
))
129 #define OSSL_FUNC_OPENSSL_CLEANSE 31
130 OSSL_CORE_MAKE_FUNC(void,
131 OPENSSL_cleanse
, (void *ptr
, size_t len
))
133 /* Bio functions provided by the core */
134 #define OSSL_FUNC_BIO_NEW_FILE 40
135 #define OSSL_FUNC_BIO_NEW_MEMBUF 41
136 #define OSSL_FUNC_BIO_READ_EX 42
137 #define OSSL_FUNC_BIO_WRITE_EX 43
138 #define OSSL_FUNC_BIO_FREE 44
139 #define OSSL_FUNC_BIO_VPRINTF 45
140 #define OSSL_FUNC_BIO_VSNPRINTF 46
141 #define OSSL_FUNC_BIO_PUTS 47
142 #define OSSL_FUNC_BIO_GETS 48
143 #define OSSL_FUNC_BIO_CTRL 49
146 OSSL_CORE_MAKE_FUNC(OSSL_CORE_BIO
*, BIO_new_file
, (const char *filename
,
148 OSSL_CORE_MAKE_FUNC(OSSL_CORE_BIO
*, BIO_new_membuf
, (const void *buf
, int len
))
149 OSSL_CORE_MAKE_FUNC(int, BIO_read_ex
, (OSSL_CORE_BIO
*bio
, void *data
,
150 size_t data_len
, size_t *bytes_read
))
151 OSSL_CORE_MAKE_FUNC(int, BIO_write_ex
, (OSSL_CORE_BIO
*bio
, const void *data
,
152 size_t data_len
, size_t *written
))
153 OSSL_CORE_MAKE_FUNC(int, BIO_gets
, (OSSL_CORE_BIO
*bio
, char *buf
, int size
))
154 OSSL_CORE_MAKE_FUNC(int, BIO_puts
, (OSSL_CORE_BIO
*bio
, const char *str
))
155 OSSL_CORE_MAKE_FUNC(int, BIO_free
, (OSSL_CORE_BIO
*bio
))
156 OSSL_CORE_MAKE_FUNC(int, BIO_vprintf
, (OSSL_CORE_BIO
*bio
, const char *format
,
158 OSSL_CORE_MAKE_FUNC(int, BIO_vsnprintf
,
159 (char *buf
, size_t n
, const char *fmt
, va_list args
))
160 OSSL_CORE_MAKE_FUNC(int, BIO_ctrl
, (OSSL_CORE_BIO
*bio
,
161 int cmd
, long num
, void *ptr
))
163 #define OSSL_FUNC_SELF_TEST_CB 100
164 OSSL_CORE_MAKE_FUNC(void, self_test_cb
, (OPENSSL_CORE_CTX
*ctx
, OSSL_CALLBACK
**cb
,
167 /* Functions to get seed material from the operating system */
168 #define OSSL_FUNC_GET_ENTROPY 101
169 #define OSSL_FUNC_CLEANUP_ENTROPY 102
170 #define OSSL_FUNC_GET_NONCE 103
171 #define OSSL_FUNC_CLEANUP_NONCE 104
172 OSSL_CORE_MAKE_FUNC(size_t, get_entropy
, (const OSSL_CORE_HANDLE
*handle
,
173 unsigned char **pout
, int entropy
,
174 size_t min_len
, size_t max_len
))
175 OSSL_CORE_MAKE_FUNC(void, cleanup_entropy
, (const OSSL_CORE_HANDLE
*handle
,
176 unsigned char *buf
, size_t len
))
177 OSSL_CORE_MAKE_FUNC(size_t, get_nonce
, (const OSSL_CORE_HANDLE
*handle
,
178 unsigned char **pout
, size_t min_len
,
179 size_t max_len
, const void *salt
,
181 OSSL_CORE_MAKE_FUNC(void, cleanup_nonce
, (const OSSL_CORE_HANDLE
*handle
,
182 unsigned char *buf
, size_t len
))
184 /* Functions provided by the provider to the Core, reserved numbers 1024-1535 */
185 # define OSSL_FUNC_PROVIDER_TEARDOWN 1024
186 OSSL_CORE_MAKE_FUNC(void,provider_teardown
,(void *provctx
))
187 # define OSSL_FUNC_PROVIDER_GETTABLE_PARAMS 1025
188 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,
189 provider_gettable_params
,(void *provctx
))
190 # define OSSL_FUNC_PROVIDER_GET_PARAMS 1026
191 OSSL_CORE_MAKE_FUNC(int,provider_get_params
,(void *provctx
,
192 OSSL_PARAM params
[]))
193 # define OSSL_FUNC_PROVIDER_QUERY_OPERATION 1027
194 OSSL_CORE_MAKE_FUNC(const OSSL_ALGORITHM
*,provider_query_operation
,
195 (void *provctx
, int operation_id
, int *no_store
))
196 # define OSSL_FUNC_PROVIDER_UNQUERY_OPERATION 1028
197 OSSL_CORE_MAKE_FUNC(void, provider_unquery_operation
,
198 (void *provctx
, int operation_id
, const OSSL_ALGORITHM
*))
199 # define OSSL_FUNC_PROVIDER_GET_REASON_STRINGS 1029
200 OSSL_CORE_MAKE_FUNC(const OSSL_ITEM
*,provider_get_reason_strings
,
202 # define OSSL_FUNC_PROVIDER_GET_CAPABILITIES 1030
203 OSSL_CORE_MAKE_FUNC(int, provider_get_capabilities
, (void *provctx
,
204 const char *capability
, OSSL_CALLBACK
*cb
, void *arg
))
205 # define OSSL_FUNC_PROVIDER_SELF_TEST 1031
206 OSSL_CORE_MAKE_FUNC(int, provider_self_test
, (void *provctx
))
210 # define OSSL_OP_DIGEST 1
211 # define OSSL_OP_CIPHER 2 /* Symmetric Ciphers */
212 # define OSSL_OP_MAC 3
213 # define OSSL_OP_KDF 4
214 # define OSSL_OP_RAND 5
215 # define OSSL_OP_KEYMGMT 10
216 # define OSSL_OP_KEYEXCH 11
217 # define OSSL_OP_SIGNATURE 12
218 # define OSSL_OP_ASYM_CIPHER 13
219 # define OSSL_OP_KEM 14
220 /* New section for non-EVP operations */
221 # define OSSL_OP_ENCODER 20
222 # define OSSL_OP_DECODER 21
223 # define OSSL_OP_STORE 22
224 /* Highest known operation number */
225 # define OSSL_OP__HIGHEST 22
229 # define OSSL_FUNC_DIGEST_NEWCTX 1
230 # define OSSL_FUNC_DIGEST_INIT 2
231 # define OSSL_FUNC_DIGEST_UPDATE 3
232 # define OSSL_FUNC_DIGEST_FINAL 4
233 # define OSSL_FUNC_DIGEST_DIGEST 5
234 # define OSSL_FUNC_DIGEST_FREECTX 6
235 # define OSSL_FUNC_DIGEST_DUPCTX 7
236 # define OSSL_FUNC_DIGEST_GET_PARAMS 8
237 # define OSSL_FUNC_DIGEST_SET_CTX_PARAMS 9
238 # define OSSL_FUNC_DIGEST_GET_CTX_PARAMS 10
239 # define OSSL_FUNC_DIGEST_GETTABLE_PARAMS 11
240 # define OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS 12
241 # define OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS 13
243 OSSL_CORE_MAKE_FUNC(void *, digest_newctx
, (void *provctx
))
244 OSSL_CORE_MAKE_FUNC(int, digest_init
, (void *dctx
))
245 OSSL_CORE_MAKE_FUNC(int, digest_update
,
246 (void *dctx
, const unsigned char *in
, size_t inl
))
247 OSSL_CORE_MAKE_FUNC(int, digest_final
,
249 unsigned char *out
, size_t *outl
, size_t outsz
))
250 OSSL_CORE_MAKE_FUNC(int, digest_digest
,
251 (void *provctx
, const unsigned char *in
, size_t inl
,
252 unsigned char *out
, size_t *outl
, size_t outsz
))
254 OSSL_CORE_MAKE_FUNC(void, digest_freectx
, (void *dctx
))
255 OSSL_CORE_MAKE_FUNC(void *, digest_dupctx
, (void *dctx
))
257 OSSL_CORE_MAKE_FUNC(int, digest_get_params
, (OSSL_PARAM params
[]))
258 OSSL_CORE_MAKE_FUNC(int, digest_set_ctx_params
,
259 (void *vctx
, const OSSL_PARAM params
[]))
260 OSSL_CORE_MAKE_FUNC(int, digest_get_ctx_params
,
261 (void *vctx
, OSSL_PARAM params
[]))
262 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, digest_gettable_params
,
264 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, digest_settable_ctx_params
,
265 (void *dctx
, void *provctx
))
266 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, digest_gettable_ctx_params
,
267 (void *dctx
, void *provctx
))
269 /* Symmetric Ciphers */
271 # define OSSL_FUNC_CIPHER_NEWCTX 1
272 # define OSSL_FUNC_CIPHER_ENCRYPT_INIT 2
273 # define OSSL_FUNC_CIPHER_DECRYPT_INIT 3
274 # define OSSL_FUNC_CIPHER_UPDATE 4
275 # define OSSL_FUNC_CIPHER_FINAL 5
276 # define OSSL_FUNC_CIPHER_CIPHER 6
277 # define OSSL_FUNC_CIPHER_FREECTX 7
278 # define OSSL_FUNC_CIPHER_DUPCTX 8
279 # define OSSL_FUNC_CIPHER_GET_PARAMS 9
280 # define OSSL_FUNC_CIPHER_GET_CTX_PARAMS 10
281 # define OSSL_FUNC_CIPHER_SET_CTX_PARAMS 11
282 # define OSSL_FUNC_CIPHER_GETTABLE_PARAMS 12
283 # define OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS 13
284 # define OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS 14
286 OSSL_CORE_MAKE_FUNC(void *, cipher_newctx
, (void *provctx
))
287 OSSL_CORE_MAKE_FUNC(int, cipher_encrypt_init
, (void *cctx
,
288 const unsigned char *key
,
290 const unsigned char *iv
,
292 OSSL_CORE_MAKE_FUNC(int, cipher_decrypt_init
, (void *cctx
,
293 const unsigned char *key
,
295 const unsigned char *iv
,
297 OSSL_CORE_MAKE_FUNC(int, cipher_update
,
299 unsigned char *out
, size_t *outl
, size_t outsize
,
300 const unsigned char *in
, size_t inl
))
301 OSSL_CORE_MAKE_FUNC(int, cipher_final
,
303 unsigned char *out
, size_t *outl
, size_t outsize
))
304 OSSL_CORE_MAKE_FUNC(int, cipher_cipher
,
306 unsigned char *out
, size_t *outl
, size_t outsize
,
307 const unsigned char *in
, size_t inl
))
308 OSSL_CORE_MAKE_FUNC(void, cipher_freectx
, (void *cctx
))
309 OSSL_CORE_MAKE_FUNC(void *, cipher_dupctx
, (void *cctx
))
310 OSSL_CORE_MAKE_FUNC(int, cipher_get_params
, (OSSL_PARAM params
[]))
311 OSSL_CORE_MAKE_FUNC(int, cipher_get_ctx_params
, (void *cctx
,
312 OSSL_PARAM params
[]))
313 OSSL_CORE_MAKE_FUNC(int, cipher_set_ctx_params
, (void *cctx
,
314 const OSSL_PARAM params
[]))
315 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, cipher_gettable_params
,
317 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, cipher_settable_ctx_params
,
319 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, cipher_gettable_ctx_params
,
324 # define OSSL_FUNC_MAC_NEWCTX 1
325 # define OSSL_FUNC_MAC_DUPCTX 2
326 # define OSSL_FUNC_MAC_FREECTX 3
327 # define OSSL_FUNC_MAC_INIT 4
328 # define OSSL_FUNC_MAC_UPDATE 5
329 # define OSSL_FUNC_MAC_FINAL 6
330 # define OSSL_FUNC_MAC_GET_PARAMS 7
331 # define OSSL_FUNC_MAC_GET_CTX_PARAMS 8
332 # define OSSL_FUNC_MAC_SET_CTX_PARAMS 9
333 # define OSSL_FUNC_MAC_GETTABLE_PARAMS 10
334 # define OSSL_FUNC_MAC_GETTABLE_CTX_PARAMS 11
335 # define OSSL_FUNC_MAC_SETTABLE_CTX_PARAMS 12
337 OSSL_CORE_MAKE_FUNC(void *, mac_newctx
, (void *provctx
))
338 OSSL_CORE_MAKE_FUNC(void *, mac_dupctx
, (void *src
))
339 OSSL_CORE_MAKE_FUNC(void, mac_freectx
, (void *mctx
))
340 OSSL_CORE_MAKE_FUNC(int, mac_init
, (void *mctx
))
341 OSSL_CORE_MAKE_FUNC(int, mac_update
,
342 (void *mctx
, const unsigned char *in
, size_t inl
))
343 OSSL_CORE_MAKE_FUNC(int, mac_final
,
345 unsigned char *out
, size_t *outl
, size_t outsize
))
346 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, mac_gettable_params
, (void *provctx
))
347 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, mac_gettable_ctx_params
,
349 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, mac_settable_ctx_params
,
351 OSSL_CORE_MAKE_FUNC(int, mac_get_params
, (OSSL_PARAM params
[]))
352 OSSL_CORE_MAKE_FUNC(int, mac_get_ctx_params
,
353 (void *mctx
, OSSL_PARAM params
[]))
354 OSSL_CORE_MAKE_FUNC(int, mac_set_ctx_params
,
355 (void *mctx
, const OSSL_PARAM params
[]))
359 # define OSSL_FUNC_KDF_NEWCTX 1
360 # define OSSL_FUNC_KDF_DUPCTX 2
361 # define OSSL_FUNC_KDF_FREECTX 3
362 # define OSSL_FUNC_KDF_RESET 4
363 # define OSSL_FUNC_KDF_DERIVE 5
364 # define OSSL_FUNC_KDF_GETTABLE_PARAMS 6
365 # define OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS 7
366 # define OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS 8
367 # define OSSL_FUNC_KDF_GET_PARAMS 9
368 # define OSSL_FUNC_KDF_GET_CTX_PARAMS 10
369 # define OSSL_FUNC_KDF_SET_CTX_PARAMS 11
371 OSSL_CORE_MAKE_FUNC(void *, kdf_newctx
, (void *provctx
))
372 OSSL_CORE_MAKE_FUNC(void *, kdf_dupctx
, (void *src
))
373 OSSL_CORE_MAKE_FUNC(void, kdf_freectx
, (void *kctx
))
374 OSSL_CORE_MAKE_FUNC(void, kdf_reset
, (void *kctx
))
375 OSSL_CORE_MAKE_FUNC(int, kdf_derive
, (void *kctx
, unsigned char *key
,
377 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, kdf_gettable_params
, (void *provctx
))
378 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, kdf_gettable_ctx_params
,
380 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, kdf_settable_ctx_params
,
382 OSSL_CORE_MAKE_FUNC(int, kdf_get_params
, (OSSL_PARAM params
[]))
383 OSSL_CORE_MAKE_FUNC(int, kdf_get_ctx_params
,
384 (void *kctx
, OSSL_PARAM params
[]))
385 OSSL_CORE_MAKE_FUNC(int, kdf_set_ctx_params
,
386 (void *kctx
, const OSSL_PARAM params
[]))
390 # define OSSL_FUNC_RAND_NEWCTX 1
391 # define OSSL_FUNC_RAND_FREECTX 2
392 # define OSSL_FUNC_RAND_INSTANTIATE 3
393 # define OSSL_FUNC_RAND_UNINSTANTIATE 4
394 # define OSSL_FUNC_RAND_GENERATE 5
395 # define OSSL_FUNC_RAND_RESEED 6
396 # define OSSL_FUNC_RAND_NONCE 7
397 # define OSSL_FUNC_RAND_ENABLE_LOCKING 8
398 # define OSSL_FUNC_RAND_LOCK 9
399 # define OSSL_FUNC_RAND_UNLOCK 10
400 # define OSSL_FUNC_RAND_GETTABLE_PARAMS 11
401 # define OSSL_FUNC_RAND_GETTABLE_CTX_PARAMS 12
402 # define OSSL_FUNC_RAND_SETTABLE_CTX_PARAMS 13
403 # define OSSL_FUNC_RAND_GET_PARAMS 14
404 # define OSSL_FUNC_RAND_GET_CTX_PARAMS 15
405 # define OSSL_FUNC_RAND_SET_CTX_PARAMS 16
406 # define OSSL_FUNC_RAND_VERIFY_ZEROIZATION 17
407 # define OSSL_FUNC_RAND_GET_SEED 18
408 # define OSSL_FUNC_RAND_CLEAR_SEED 19
410 OSSL_CORE_MAKE_FUNC(void *,rand_newctx
,
411 (void *provctx
, void *parent
,
412 const OSSL_DISPATCH
*parent_calls
))
413 OSSL_CORE_MAKE_FUNC(void,rand_freectx
, (void *vctx
))
414 OSSL_CORE_MAKE_FUNC(int,rand_instantiate
,
415 (void *vdrbg
, unsigned int strength
,
416 int prediction_resistance
,
417 const unsigned char *pstr
, size_t pstr_len
))
418 OSSL_CORE_MAKE_FUNC(int,rand_uninstantiate
, (void *vdrbg
))
419 OSSL_CORE_MAKE_FUNC(int,rand_generate
,
420 (void *vctx
, unsigned char *out
, size_t outlen
,
421 unsigned int strength
, int prediction_resistance
,
422 const unsigned char *addin
, size_t addin_len
))
423 OSSL_CORE_MAKE_FUNC(int,rand_reseed
,
424 (void *vctx
, int prediction_resistance
,
425 const unsigned char *ent
, size_t ent_len
,
426 const unsigned char *addin
, size_t addin_len
))
427 OSSL_CORE_MAKE_FUNC(size_t,rand_nonce
,
428 (void *vctx
, unsigned char *out
, unsigned int strength
,
429 size_t min_noncelen
, size_t max_noncelen
))
430 OSSL_CORE_MAKE_FUNC(int,rand_enable_locking
, (void *vctx
))
431 OSSL_CORE_MAKE_FUNC(int,rand_lock
, (void *vctx
))
432 OSSL_CORE_MAKE_FUNC(void,rand_unlock
, (void *vctx
))
433 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,rand_gettable_params
, (void *provctx
))
434 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,rand_gettable_ctx_params
,
435 (void *vctx
, void *provctx
))
436 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,rand_settable_ctx_params
,
437 (void *vctx
, void *provctx
))
438 OSSL_CORE_MAKE_FUNC(int,rand_get_params
, (OSSL_PARAM params
[]))
439 OSSL_CORE_MAKE_FUNC(int,rand_get_ctx_params
,
440 (void *vctx
, OSSL_PARAM params
[]))
441 OSSL_CORE_MAKE_FUNC(int,rand_set_ctx_params
,
442 (void *vctx
, const OSSL_PARAM params
[]))
443 OSSL_CORE_MAKE_FUNC(void,rand_set_callbacks
,
444 (void *vctx
, OSSL_INOUT_CALLBACK
*get_entropy
,
445 OSSL_CALLBACK
*cleanup_entropy
,
446 OSSL_INOUT_CALLBACK
*get_nonce
,
447 OSSL_CALLBACK
*cleanup_nonce
, void *arg
))
448 OSSL_CORE_MAKE_FUNC(int,rand_verify_zeroization
,
450 OSSL_CORE_MAKE_FUNC(size_t,rand_get_seed
,
451 (void *vctx
, unsigned char **buffer
,
452 int entropy
, size_t min_len
, size_t max_len
,
453 int prediction_resistance
,
454 const unsigned char *adin
, size_t adin_len
))
455 OSSL_CORE_MAKE_FUNC(void,rand_clear_seed
,
456 (void *vctx
, unsigned char *buffer
, size_t b_len
))
461 * The Key Management takes care of provider side key objects, and includes
462 * all current functionality to create them, destroy them, set parameters
463 * and key material, etc, essentially everything that manipulates the keys
464 * themselves and their parameters.
466 * The key objects are commonly refered to as |keydata|, and it MUST be able
467 * to contain parameters if the key has any, the public key and the private
468 * key. All parts are optional, but their presence determines what can be
469 * done with the key object in terms of encryption, signature, and so on.
470 * The assumption from libcrypto is that the key object contains any of the
471 * following data combinations:
475 * - public key + private key
476 * - parameters + public key
477 * - parameters + public key + private key
479 * What "parameters", "public key" and "private key" means in detail is left
480 * to the implementation. In the case of DH and DSA, they would typically
481 * include domain parameters, while for certain variants of RSA, they would
482 * typically include PSS or OAEP parameters.
484 * Key objects are created with OSSL_FUNC_keymgmt_new() and destroyed with
485 * OSSL_FUNC_keymgmt_free(). Key objects can have data filled in with
486 * OSSL_FUNC_keymgmt_import().
488 * Three functions are made available to check what selection of data is
489 * present in a key object: OSSL_FUNC_keymgmt_has_parameters(),
490 * OSSL_FUNC_keymgmt_has_public_key(), and OSSL_FUNC_keymgmt_has_private_key(),
493 /* Key data subset selection - individual bits */
494 # define OSSL_KEYMGMT_SELECT_PRIVATE_KEY 0x01
495 # define OSSL_KEYMGMT_SELECT_PUBLIC_KEY 0x02
496 # define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS 0x04
497 # define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS 0x80
499 /* Key data subset selection - combinations */
500 # define OSSL_KEYMGMT_SELECT_ALL_PARAMETERS \
501 ( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS \
502 | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
503 # define OSSL_KEYMGMT_SELECT_KEYPAIR \
504 ( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
505 # define OSSL_KEYMGMT_SELECT_ALL \
506 ( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
508 # define OSSL_KEYMGMT_VALIDATE_FULL_CHECK 0
509 # define OSSL_KEYMGMT_VALIDATE_QUICK_CHECK 1
511 /* Basic key object creation */
512 # define OSSL_FUNC_KEYMGMT_NEW 1
513 OSSL_CORE_MAKE_FUNC(void *, keymgmt_new
, (void *provctx
))
515 /* Generation, a more complex constructor */
516 # define OSSL_FUNC_KEYMGMT_GEN_INIT 2
517 # define OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE 3
518 # define OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS 4
519 # define OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS 5
520 # define OSSL_FUNC_KEYMGMT_GEN 6
521 # define OSSL_FUNC_KEYMGMT_GEN_CLEANUP 7
522 OSSL_CORE_MAKE_FUNC(void *, keymgmt_gen_init
,
523 (void *provctx
, int selection
))
524 OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_set_template
,
525 (void *genctx
, void *templ
))
526 OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_set_params
,
527 (void *genctx
, const OSSL_PARAM params
[]))
528 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,
529 keymgmt_gen_settable_params
, (void *provctx
))
530 OSSL_CORE_MAKE_FUNC(int, keymgmt_gen_get_params
,
531 (void *genctx
, OSSL_PARAM params
[]))
532 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*,
533 keymgmt_gen_gettable_params
, (void *provctx
))
534 OSSL_CORE_MAKE_FUNC(void *, keymgmt_gen
,
535 (void *genctx
, OSSL_CALLBACK
*cb
, void *cbarg
))
536 OSSL_CORE_MAKE_FUNC(void, keymgmt_gen_cleanup
, (void *genctx
))
538 /* Key loading by object reference */
539 # define OSSL_FUNC_KEYMGMT_LOAD 8
540 OSSL_CORE_MAKE_FUNC(void *, keymgmt_load
,
541 (const void *reference
, size_t reference_sz
))
543 /* Basic key object destruction */
544 # define OSSL_FUNC_KEYMGMT_FREE 10
545 OSSL_CORE_MAKE_FUNC(void, keymgmt_free
, (void *keydata
))
547 /* Key object information, with discovery */
548 #define OSSL_FUNC_KEYMGMT_GET_PARAMS 11
549 #define OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS 12
550 OSSL_CORE_MAKE_FUNC(int, keymgmt_get_params
,
551 (void *keydata
, OSSL_PARAM params
[]))
552 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, keymgmt_gettable_params
, (void *))
554 #define OSSL_FUNC_KEYMGMT_SET_PARAMS 13
555 #define OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS 14
556 OSSL_CORE_MAKE_FUNC(int, keymgmt_set_params
,
557 (void *keydata
, const OSSL_PARAM params
[]))
558 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, keymgmt_settable_params
, (void *))
560 /* Key checks - discovery of supported operations */
561 # define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 20
562 OSSL_CORE_MAKE_FUNC(const char *, keymgmt_query_operation_name
,
565 /* Key checks - key data content checks */
566 # define OSSL_FUNC_KEYMGMT_HAS 21
567 OSSL_CORE_MAKE_FUNC(int, keymgmt_has
, (const void *keydata
, int selection
))
569 /* Key checks - validation */
570 # define OSSL_FUNC_KEYMGMT_VALIDATE 22
571 OSSL_CORE_MAKE_FUNC(int, keymgmt_validate
, (const void *keydata
, int selection
,
574 /* Key checks - matching */
575 # define OSSL_FUNC_KEYMGMT_MATCH 23
576 OSSL_CORE_MAKE_FUNC(int, keymgmt_match
,
577 (const void *keydata1
, const void *keydata2
,
580 /* Import and export functions, with discovery */
581 # define OSSL_FUNC_KEYMGMT_IMPORT 40
582 # define OSSL_FUNC_KEYMGMT_IMPORT_TYPES 41
583 # define OSSL_FUNC_KEYMGMT_EXPORT 42
584 # define OSSL_FUNC_KEYMGMT_EXPORT_TYPES 43
585 OSSL_CORE_MAKE_FUNC(int, keymgmt_import
,
586 (void *keydata
, int selection
, const OSSL_PARAM params
[]))
587 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, keymgmt_import_types
,
589 OSSL_CORE_MAKE_FUNC(int, keymgmt_export
,
590 (void *keydata
, int selection
,
591 OSSL_CALLBACK
*param_cb
, void *cbarg
))
592 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, keymgmt_export_types
,
595 /* Copy function, only works for matching keymgmt */
596 # define OSSL_FUNC_KEYMGMT_COPY 44
597 OSSL_CORE_MAKE_FUNC(int, keymgmt_copy
,
598 ( void *keydata_to
, const void *keydata_from
,
603 # define OSSL_FUNC_KEYEXCH_NEWCTX 1
604 # define OSSL_FUNC_KEYEXCH_INIT 2
605 # define OSSL_FUNC_KEYEXCH_DERIVE 3
606 # define OSSL_FUNC_KEYEXCH_SET_PEER 4
607 # define OSSL_FUNC_KEYEXCH_FREECTX 5
608 # define OSSL_FUNC_KEYEXCH_DUPCTX 6
609 # define OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS 7
610 # define OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS 8
611 # define OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS 9
612 # define OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS 10
614 OSSL_CORE_MAKE_FUNC(void *, keyexch_newctx
, (void *provctx
))
615 OSSL_CORE_MAKE_FUNC(int, keyexch_init
, (void *ctx
, void *provkey
))
616 OSSL_CORE_MAKE_FUNC(int, keyexch_derive
, (void *ctx
, unsigned char *secret
,
617 size_t *secretlen
, size_t outlen
))
618 OSSL_CORE_MAKE_FUNC(int, keyexch_set_peer
, (void *ctx
, void *provkey
))
619 OSSL_CORE_MAKE_FUNC(void, keyexch_freectx
, (void *ctx
))
620 OSSL_CORE_MAKE_FUNC(void *, keyexch_dupctx
, (void *ctx
))
621 OSSL_CORE_MAKE_FUNC(int, keyexch_set_ctx_params
, (void *ctx
,
622 const OSSL_PARAM params
[]))
623 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, keyexch_settable_ctx_params
,
625 OSSL_CORE_MAKE_FUNC(int, keyexch_get_ctx_params
, (void *ctx
,
626 OSSL_PARAM params
[]))
627 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, keyexch_gettable_ctx_params
,
632 # define OSSL_FUNC_SIGNATURE_NEWCTX 1
633 # define OSSL_FUNC_SIGNATURE_SIGN_INIT 2
634 # define OSSL_FUNC_SIGNATURE_SIGN 3
635 # define OSSL_FUNC_SIGNATURE_VERIFY_INIT 4
636 # define OSSL_FUNC_SIGNATURE_VERIFY 5
637 # define OSSL_FUNC_SIGNATURE_VERIFY_RECOVER_INIT 6
638 # define OSSL_FUNC_SIGNATURE_VERIFY_RECOVER 7
639 # define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT 8
640 # define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE 9
641 # define OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL 10
642 # define OSSL_FUNC_SIGNATURE_DIGEST_SIGN 11
643 # define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT 12
644 # define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE 13
645 # define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL 14
646 # define OSSL_FUNC_SIGNATURE_DIGEST_VERIFY 15
647 # define OSSL_FUNC_SIGNATURE_FREECTX 16
648 # define OSSL_FUNC_SIGNATURE_DUPCTX 17
649 # define OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS 18
650 # define OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS 19
651 # define OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS 20
652 # define OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS 21
653 # define OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS 22
654 # define OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS 23
655 # define OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS 24
656 # define OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS 25
658 OSSL_CORE_MAKE_FUNC(void *, signature_newctx
, (void *provctx
,
660 OSSL_CORE_MAKE_FUNC(int, signature_sign_init
, (void *ctx
, void *provkey
))
661 OSSL_CORE_MAKE_FUNC(int, signature_sign
, (void *ctx
, unsigned char *sig
,
662 size_t *siglen
, size_t sigsize
,
663 const unsigned char *tbs
,
665 OSSL_CORE_MAKE_FUNC(int, signature_verify_init
, (void *ctx
, void *provkey
))
666 OSSL_CORE_MAKE_FUNC(int, signature_verify
, (void *ctx
,
667 const unsigned char *sig
,
669 const unsigned char *tbs
,
671 OSSL_CORE_MAKE_FUNC(int, signature_verify_recover_init
, (void *ctx
,
673 OSSL_CORE_MAKE_FUNC(int, signature_verify_recover
, (void *ctx
,
677 const unsigned char *sig
,
679 OSSL_CORE_MAKE_FUNC(int, signature_digest_sign_init
,
680 (void *ctx
, const char *mdname
, void *provkey
))
681 OSSL_CORE_MAKE_FUNC(int, signature_digest_sign_update
,
682 (void *ctx
, const unsigned char *data
, size_t datalen
))
683 OSSL_CORE_MAKE_FUNC(int, signature_digest_sign_final
,
684 (void *ctx
, unsigned char *sig
, size_t *siglen
,
686 OSSL_CORE_MAKE_FUNC(int, signature_digest_sign
,
687 (void *ctx
, unsigned char *sigret
, size_t *siglen
,
688 size_t sigsize
, const unsigned char *tbs
, size_t tbslen
))
689 OSSL_CORE_MAKE_FUNC(int, signature_digest_verify_init
,
690 (void *ctx
, const char *mdname
, void *provkey
))
691 OSSL_CORE_MAKE_FUNC(int, signature_digest_verify_update
,
692 (void *ctx
, const unsigned char *data
, size_t datalen
))
693 OSSL_CORE_MAKE_FUNC(int, signature_digest_verify_final
,
694 (void *ctx
, const unsigned char *sig
, size_t siglen
))
695 OSSL_CORE_MAKE_FUNC(int, signature_digest_verify
,
696 (void *ctx
, const unsigned char *sig
, size_t siglen
,
697 const unsigned char *tbs
, size_t tbslen
))
698 OSSL_CORE_MAKE_FUNC(void, signature_freectx
, (void *ctx
))
699 OSSL_CORE_MAKE_FUNC(void *, signature_dupctx
, (void *ctx
))
700 OSSL_CORE_MAKE_FUNC(int, signature_get_ctx_params
,
701 (void *ctx
, OSSL_PARAM params
[]))
702 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, signature_gettable_ctx_params
,
704 OSSL_CORE_MAKE_FUNC(int, signature_set_ctx_params
,
705 (void *ctx
, const OSSL_PARAM params
[]))
706 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, signature_settable_ctx_params
,
708 OSSL_CORE_MAKE_FUNC(int, signature_get_ctx_md_params
,
709 (void *ctx
, OSSL_PARAM params
[]))
710 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, signature_gettable_ctx_md_params
,
712 OSSL_CORE_MAKE_FUNC(int, signature_set_ctx_md_params
,
713 (void *ctx
, const OSSL_PARAM params
[]))
714 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, signature_settable_ctx_md_params
,
718 /* Asymmetric Ciphers */
720 # define OSSL_FUNC_ASYM_CIPHER_NEWCTX 1
721 # define OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT 2
722 # define OSSL_FUNC_ASYM_CIPHER_ENCRYPT 3
723 # define OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT 4
724 # define OSSL_FUNC_ASYM_CIPHER_DECRYPT 5
725 # define OSSL_FUNC_ASYM_CIPHER_FREECTX 6
726 # define OSSL_FUNC_ASYM_CIPHER_DUPCTX 7
727 # define OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS 8
728 # define OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS 9
729 # define OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS 10
730 # define OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS 11
732 OSSL_CORE_MAKE_FUNC(void *, asym_cipher_newctx
, (void *provctx
))
733 OSSL_CORE_MAKE_FUNC(int, asym_cipher_encrypt_init
, (void *ctx
, void *provkey
))
734 OSSL_CORE_MAKE_FUNC(int, asym_cipher_encrypt
, (void *ctx
, unsigned char *out
,
737 const unsigned char *in
,
739 OSSL_CORE_MAKE_FUNC(int, asym_cipher_decrypt_init
, (void *ctx
, void *provkey
))
740 OSSL_CORE_MAKE_FUNC(int, asym_cipher_decrypt
, (void *ctx
, unsigned char *out
,
743 const unsigned char *in
,
745 OSSL_CORE_MAKE_FUNC(void, asym_cipher_freectx
, (void *ctx
))
746 OSSL_CORE_MAKE_FUNC(void *, asym_cipher_dupctx
, (void *ctx
))
747 OSSL_CORE_MAKE_FUNC(int, asym_cipher_get_ctx_params
,
748 (void *ctx
, OSSL_PARAM params
[]))
749 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, asym_cipher_gettable_ctx_params
,
751 OSSL_CORE_MAKE_FUNC(int, asym_cipher_set_ctx_params
,
752 (void *ctx
, const OSSL_PARAM params
[]))
753 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, asym_cipher_settable_ctx_params
,
756 /* Asymmetric Key encapsulation */
757 # define OSSL_FUNC_KEM_NEWCTX 1
758 # define OSSL_FUNC_KEM_ENCAPSULATE_INIT 2
759 # define OSSL_FUNC_KEM_ENCAPSULATE 3
760 # define OSSL_FUNC_KEM_DECAPSULATE_INIT 4
761 # define OSSL_FUNC_KEM_DECAPSULATE 5
762 # define OSSL_FUNC_KEM_FREECTX 6
763 # define OSSL_FUNC_KEM_DUPCTX 7
764 # define OSSL_FUNC_KEM_GET_CTX_PARAMS 8
765 # define OSSL_FUNC_KEM_GETTABLE_CTX_PARAMS 9
766 # define OSSL_FUNC_KEM_SET_CTX_PARAMS 10
767 # define OSSL_FUNC_KEM_SETTABLE_CTX_PARAMS 11
769 OSSL_CORE_MAKE_FUNC(void *, kem_newctx
, (void *provctx
))
770 OSSL_CORE_MAKE_FUNC(int, kem_encapsulate_init
, (void *ctx
, void *provkey
))
771 OSSL_CORE_MAKE_FUNC(int, kem_encapsulate
, (void *ctx
,
772 unsigned char *out
, size_t *outlen
,
773 unsigned char *secret
,
775 OSSL_CORE_MAKE_FUNC(int, kem_decapsulate_init
, (void *ctx
, void *provkey
))
776 OSSL_CORE_MAKE_FUNC(int, kem_decapsulate
, (void *ctx
,
777 unsigned char *out
, size_t *outlen
,
778 const unsigned char *in
, size_t inlen
))
779 OSSL_CORE_MAKE_FUNC(void, kem_freectx
, (void *ctx
))
780 OSSL_CORE_MAKE_FUNC(void *, kem_dupctx
, (void *ctx
))
781 OSSL_CORE_MAKE_FUNC(int, kem_get_ctx_params
, (void *ctx
, OSSL_PARAM params
[]))
782 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, kem_gettable_ctx_params
, (void *provctx
))
783 OSSL_CORE_MAKE_FUNC(int, kem_set_ctx_params
,
784 (void *ctx
, const OSSL_PARAM params
[]))
785 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, kem_settable_ctx_params
, (void *provctx
))
787 /* Encoders and decoders */
788 # define OSSL_FUNC_ENCODER_NEWCTX 1
789 # define OSSL_FUNC_ENCODER_FREECTX 2
790 # define OSSL_FUNC_ENCODER_GET_PARAMS 3
791 # define OSSL_FUNC_ENCODER_GETTABLE_PARAMS 4
792 # define OSSL_FUNC_ENCODER_SET_CTX_PARAMS 5
793 # define OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS 6
794 # define OSSL_FUNC_ENCODER_DOES_SELECTION 10
795 # define OSSL_FUNC_ENCODER_ENCODE 11
796 # define OSSL_FUNC_ENCODER_IMPORT_OBJECT 20
797 # define OSSL_FUNC_ENCODER_FREE_OBJECT 21
798 OSSL_CORE_MAKE_FUNC(void *, encoder_newctx
, (void *provctx
))
799 OSSL_CORE_MAKE_FUNC(void, encoder_freectx
, (void *ctx
))
800 OSSL_CORE_MAKE_FUNC(int, encoder_get_params
, (OSSL_PARAM params
[]))
801 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, encoder_gettable_params
,
803 OSSL_CORE_MAKE_FUNC(int, encoder_set_ctx_params
,
804 (void *ctx
, const OSSL_PARAM params
[]))
805 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, encoder_settable_ctx_params
,
808 OSSL_CORE_MAKE_FUNC(int, encoder_does_selection
,
809 (void *provctx
, int selection
))
810 OSSL_CORE_MAKE_FUNC(int, encoder_encode
,
811 (void *ctx
, OSSL_CORE_BIO
*out
,
812 const void *obj_raw
, const OSSL_PARAM obj_abstract
[],
814 OSSL_PASSPHRASE_CALLBACK
*cb
, void *cbarg
))
816 OSSL_CORE_MAKE_FUNC(void *, encoder_import_object
,
817 (void *ctx
, int selection
, const OSSL_PARAM params
[]))
818 OSSL_CORE_MAKE_FUNC(void, encoder_free_object
, (void *obj
))
820 # define OSSL_FUNC_DECODER_NEWCTX 1
821 # define OSSL_FUNC_DECODER_FREECTX 2
822 # define OSSL_FUNC_DECODER_GET_PARAMS 3
823 # define OSSL_FUNC_DECODER_GETTABLE_PARAMS 4
824 # define OSSL_FUNC_DECODER_SET_CTX_PARAMS 5
825 # define OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS 6
826 # define OSSL_FUNC_DECODER_DOES_SELECTION 10
827 # define OSSL_FUNC_DECODER_DECODE 11
828 # define OSSL_FUNC_DECODER_EXPORT_OBJECT 20
829 OSSL_CORE_MAKE_FUNC(void *, decoder_newctx
, (void *provctx
))
830 OSSL_CORE_MAKE_FUNC(void, decoder_freectx
, (void *ctx
))
831 OSSL_CORE_MAKE_FUNC(int, decoder_get_params
, (OSSL_PARAM params
[]))
832 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, decoder_gettable_params
,
834 OSSL_CORE_MAKE_FUNC(int, decoder_set_ctx_params
,
835 (void *ctx
, const OSSL_PARAM params
[]))
836 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, decoder_settable_ctx_params
,
839 OSSL_CORE_MAKE_FUNC(int, decoder_does_selection
,
840 (void *provctx
, int selection
))
841 OSSL_CORE_MAKE_FUNC(int, decoder_decode
,
842 (void *ctx
, OSSL_CORE_BIO
*in
, int selection
,
843 OSSL_CALLBACK
*metadata_cb
, void *metadata_cbarg
,
844 OSSL_PASSPHRASE_CALLBACK
*pw_cb
, void *pw_cbarg
))
845 OSSL_CORE_MAKE_FUNC(int, decoder_export_object
,
846 (void *ctx
, const void *objref
, size_t objref_sz
,
847 OSSL_CALLBACK
*export_cb
, void *export_cbarg
))
852 * Objects are scanned by using the 'open', 'load', 'eof' and 'close'
853 * functions, which implement an OSSL_STORE loader.
855 * store_load() works in a way that's very similar to the decoders, in
856 * that they pass an abstract object through a callback, either as a DER
857 * octet string or as an object reference, which libcrypto will have to
861 #define OSSL_FUNC_STORE_OPEN 1
862 #define OSSL_FUNC_STORE_ATTACH 2
863 #define OSSL_FUNC_STORE_SETTABLE_CTX_PARAMS 3
864 #define OSSL_FUNC_STORE_SET_CTX_PARAMS 4
865 #define OSSL_FUNC_STORE_LOAD 5
866 #define OSSL_FUNC_STORE_EOF 6
867 #define OSSL_FUNC_STORE_CLOSE 7
868 #define OSSL_FUNC_STORE_EXPORT_OBJECT 8
869 OSSL_CORE_MAKE_FUNC(void *, store_open
, (void *provctx
, const char *uri
))
870 OSSL_CORE_MAKE_FUNC(void *, store_attach
, (void *provctx
, OSSL_CORE_BIO
*in
))
871 OSSL_CORE_MAKE_FUNC(const OSSL_PARAM
*, store_settable_ctx_params
,
873 OSSL_CORE_MAKE_FUNC(int, store_set_ctx_params
,
874 (void *loaderctx
, const OSSL_PARAM params
[]))
875 OSSL_CORE_MAKE_FUNC(int, store_load
,
877 OSSL_CALLBACK
*object_cb
, void *object_cbarg
,
878 OSSL_PASSPHRASE_CALLBACK
*pw_cb
, void *pw_cbarg
))
879 OSSL_CORE_MAKE_FUNC(int, store_eof
, (void *loaderctx
))
880 OSSL_CORE_MAKE_FUNC(int, store_close
, (void *loaderctx
))
881 OSSL_CORE_MAKE_FUNC(int, store_export_object
,
882 (void *loaderctx
, const void *objref
, size_t objref_sz
,
883 OSSL_CALLBACK
*export_cb
, void *export_cbarg
))