1*de0e0e4dSAntonio Huete Jimenez /* $OpenBSD: crypto.h,v 1.57 2022/09/11 17:26:51 tb Exp $ */
2f5b1c8a1SJohn Marino /* ====================================================================
3f5b1c8a1SJohn Marino  * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
4f5b1c8a1SJohn Marino  *
5f5b1c8a1SJohn Marino  * Redistribution and use in source and binary forms, with or without
6f5b1c8a1SJohn Marino  * modification, are permitted provided that the following conditions
7f5b1c8a1SJohn Marino  * are met:
8f5b1c8a1SJohn Marino  *
9f5b1c8a1SJohn Marino  * 1. Redistributions of source code must retain the above copyright
10f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer.
11f5b1c8a1SJohn Marino  *
12f5b1c8a1SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
13f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer in
14f5b1c8a1SJohn Marino  *    the documentation and/or other materials provided with the
15f5b1c8a1SJohn Marino  *    distribution.
16f5b1c8a1SJohn Marino  *
17f5b1c8a1SJohn Marino  * 3. All advertising materials mentioning features or use of this
18f5b1c8a1SJohn Marino  *    software must display the following acknowledgment:
19f5b1c8a1SJohn Marino  *    "This product includes software developed by the OpenSSL Project
20f5b1c8a1SJohn Marino  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21f5b1c8a1SJohn Marino  *
22f5b1c8a1SJohn Marino  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23f5b1c8a1SJohn Marino  *    endorse or promote products derived from this software without
24f5b1c8a1SJohn Marino  *    prior written permission. For written permission, please contact
25f5b1c8a1SJohn Marino  *    openssl-core@openssl.org.
26f5b1c8a1SJohn Marino  *
27f5b1c8a1SJohn Marino  * 5. Products derived from this software may not be called "OpenSSL"
28f5b1c8a1SJohn Marino  *    nor may "OpenSSL" appear in their names without prior written
29f5b1c8a1SJohn Marino  *    permission of the OpenSSL Project.
30f5b1c8a1SJohn Marino  *
31f5b1c8a1SJohn Marino  * 6. Redistributions of any form whatsoever must retain the following
32f5b1c8a1SJohn Marino  *    acknowledgment:
33f5b1c8a1SJohn Marino  *    "This product includes software developed by the OpenSSL Project
34f5b1c8a1SJohn Marino  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35f5b1c8a1SJohn Marino  *
36f5b1c8a1SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37f5b1c8a1SJohn Marino  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38f5b1c8a1SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39f5b1c8a1SJohn Marino  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40f5b1c8a1SJohn Marino  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41f5b1c8a1SJohn Marino  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42f5b1c8a1SJohn Marino  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43f5b1c8a1SJohn Marino  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44f5b1c8a1SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45f5b1c8a1SJohn Marino  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46f5b1c8a1SJohn Marino  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47f5b1c8a1SJohn Marino  * OF THE POSSIBILITY OF SUCH DAMAGE.
48f5b1c8a1SJohn Marino  * ====================================================================
49f5b1c8a1SJohn Marino  *
50f5b1c8a1SJohn Marino  * This product includes cryptographic software written by Eric Young
51f5b1c8a1SJohn Marino  * (eay@cryptsoft.com).  This product includes software written by Tim
52f5b1c8a1SJohn Marino  * Hudson (tjh@cryptsoft.com).
53f5b1c8a1SJohn Marino  *
54f5b1c8a1SJohn Marino  */
55f5b1c8a1SJohn Marino /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
56f5b1c8a1SJohn Marino  * All rights reserved.
57f5b1c8a1SJohn Marino  *
58f5b1c8a1SJohn Marino  * This package is an SSL implementation written
59f5b1c8a1SJohn Marino  * by Eric Young (eay@cryptsoft.com).
60f5b1c8a1SJohn Marino  * The implementation was written so as to conform with Netscapes SSL.
61f5b1c8a1SJohn Marino  *
62f5b1c8a1SJohn Marino  * This library is free for commercial and non-commercial use as long as
63f5b1c8a1SJohn Marino  * the following conditions are aheared to.  The following conditions
64f5b1c8a1SJohn Marino  * apply to all code found in this distribution, be it the RC4, RSA,
65f5b1c8a1SJohn Marino  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
66f5b1c8a1SJohn Marino  * included with this distribution is covered by the same copyright terms
67f5b1c8a1SJohn Marino  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
68f5b1c8a1SJohn Marino  *
69f5b1c8a1SJohn Marino  * Copyright remains Eric Young's, and as such any Copyright notices in
70f5b1c8a1SJohn Marino  * the code are not to be removed.
71f5b1c8a1SJohn Marino  * If this package is used in a product, Eric Young should be given attribution
72f5b1c8a1SJohn Marino  * as the author of the parts of the library used.
73f5b1c8a1SJohn Marino  * This can be in the form of a textual message at program startup or
74f5b1c8a1SJohn Marino  * in documentation (online or textual) provided with the package.
75f5b1c8a1SJohn Marino  *
76f5b1c8a1SJohn Marino  * Redistribution and use in source and binary forms, with or without
77f5b1c8a1SJohn Marino  * modification, are permitted provided that the following conditions
78f5b1c8a1SJohn Marino  * are met:
79f5b1c8a1SJohn Marino  * 1. Redistributions of source code must retain the copyright
80f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer.
81f5b1c8a1SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
82f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
83f5b1c8a1SJohn Marino  *    documentation and/or other materials provided with the distribution.
84f5b1c8a1SJohn Marino  * 3. All advertising materials mentioning features or use of this software
85f5b1c8a1SJohn Marino  *    must display the following acknowledgement:
86f5b1c8a1SJohn Marino  *    "This product includes cryptographic software written by
87f5b1c8a1SJohn Marino  *     Eric Young (eay@cryptsoft.com)"
88f5b1c8a1SJohn Marino  *    The word 'cryptographic' can be left out if the rouines from the library
89f5b1c8a1SJohn Marino  *    being used are not cryptographic related :-).
90f5b1c8a1SJohn Marino  * 4. If you include any Windows specific code (or a derivative thereof) from
91f5b1c8a1SJohn Marino  *    the apps directory (application code) you must include an acknowledgement:
92f5b1c8a1SJohn Marino  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
93f5b1c8a1SJohn Marino  *
94f5b1c8a1SJohn Marino  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
95f5b1c8a1SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
96f5b1c8a1SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
97f5b1c8a1SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
98f5b1c8a1SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
99f5b1c8a1SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
100f5b1c8a1SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
101f5b1c8a1SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
102f5b1c8a1SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
103f5b1c8a1SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
104f5b1c8a1SJohn Marino  * SUCH DAMAGE.
105f5b1c8a1SJohn Marino  *
106f5b1c8a1SJohn Marino  * The licence and distribution terms for any publically available version or
107f5b1c8a1SJohn Marino  * derivative of this code cannot be changed.  i.e. this code cannot simply be
108f5b1c8a1SJohn Marino  * copied and put under another distribution licence
109f5b1c8a1SJohn Marino  * [including the GNU Public Licence.]
110f5b1c8a1SJohn Marino  */
111f5b1c8a1SJohn Marino /* ====================================================================
112f5b1c8a1SJohn Marino  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
113f5b1c8a1SJohn Marino  * ECDH support in OpenSSL originally developed by
114f5b1c8a1SJohn Marino  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
115f5b1c8a1SJohn Marino  */
116f5b1c8a1SJohn Marino 
117f5b1c8a1SJohn Marino #include <stdint.h>
118f5b1c8a1SJohn Marino #include <stdio.h>
119f5b1c8a1SJohn Marino #include <stdlib.h>
120f5b1c8a1SJohn Marino 
121f5b1c8a1SJohn Marino #ifndef HEADER_CRYPTO_H
122f5b1c8a1SJohn Marino #define HEADER_CRYPTO_H
123f5b1c8a1SJohn Marino 
124f5b1c8a1SJohn Marino #include <openssl/opensslconf.h>
125f5b1c8a1SJohn Marino 
126f5b1c8a1SJohn Marino #include <openssl/stack.h>
127f5b1c8a1SJohn Marino #include <openssl/safestack.h>
128f5b1c8a1SJohn Marino #include <openssl/opensslv.h>
129f5b1c8a1SJohn Marino #include <openssl/ossl_typ.h>
130f5b1c8a1SJohn Marino 
131f5b1c8a1SJohn Marino #ifdef  __cplusplus
132f5b1c8a1SJohn Marino extern "C" {
133f5b1c8a1SJohn Marino #endif
134f5b1c8a1SJohn Marino 
135f5b1c8a1SJohn Marino /* Backward compatibility to SSLeay */
136f5b1c8a1SJohn Marino /* This is more to be used to check the correct DLL is being used
137f5b1c8a1SJohn Marino  * in the MS world. */
138f5b1c8a1SJohn Marino #define SSLEAY_VERSION_NUMBER	OPENSSL_VERSION_NUMBER
139f5b1c8a1SJohn Marino #define SSLEAY_VERSION		0
140f5b1c8a1SJohn Marino /* #define SSLEAY_OPTIONS	1 no longer supported */
141f5b1c8a1SJohn Marino #define SSLEAY_CFLAGS		2
142f5b1c8a1SJohn Marino #define SSLEAY_BUILT_ON		3
143f5b1c8a1SJohn Marino #define SSLEAY_PLATFORM		4
144f5b1c8a1SJohn Marino #define SSLEAY_DIR		5
145f5b1c8a1SJohn Marino 
146f5b1c8a1SJohn Marino /* When changing the CRYPTO_LOCK_* list, be sure to maintain the text lock
147f5b1c8a1SJohn Marino  * names in cryptlib.c
148f5b1c8a1SJohn Marino  */
149f5b1c8a1SJohn Marino 
150f5b1c8a1SJohn Marino #define	CRYPTO_LOCK_ERR			1
151f5b1c8a1SJohn Marino #define	CRYPTO_LOCK_EX_DATA		2
152f5b1c8a1SJohn Marino #define	CRYPTO_LOCK_X509		3
153f5b1c8a1SJohn Marino #define	CRYPTO_LOCK_X509_INFO		4
154f5b1c8a1SJohn Marino #define	CRYPTO_LOCK_X509_PKEY		5
155f5b1c8a1SJohn Marino #define CRYPTO_LOCK_X509_CRL		6
156f5b1c8a1SJohn Marino #define CRYPTO_LOCK_X509_REQ		7
157f5b1c8a1SJohn Marino #define CRYPTO_LOCK_DSA			8
158f5b1c8a1SJohn Marino #define CRYPTO_LOCK_RSA			9
159f5b1c8a1SJohn Marino #define CRYPTO_LOCK_EVP_PKEY		10
160f5b1c8a1SJohn Marino #define CRYPTO_LOCK_X509_STORE		11
161f5b1c8a1SJohn Marino #define CRYPTO_LOCK_SSL_CTX		12
162f5b1c8a1SJohn Marino #define CRYPTO_LOCK_SSL_CERT		13
163f5b1c8a1SJohn Marino #define CRYPTO_LOCK_SSL_SESSION		14
164f5b1c8a1SJohn Marino #define CRYPTO_LOCK_SSL_SESS_CERT	15
165f5b1c8a1SJohn Marino #define CRYPTO_LOCK_SSL			16
166f5b1c8a1SJohn Marino #define CRYPTO_LOCK_SSL_METHOD		17
167f5b1c8a1SJohn Marino #define CRYPTO_LOCK_RAND		18
168f5b1c8a1SJohn Marino #define CRYPTO_LOCK_RAND2		19
169f5b1c8a1SJohn Marino #define CRYPTO_LOCK_MALLOC		20
170f5b1c8a1SJohn Marino #define CRYPTO_LOCK_BIO			21
171f5b1c8a1SJohn Marino #define CRYPTO_LOCK_GETHOSTBYNAME	22
172f5b1c8a1SJohn Marino #define CRYPTO_LOCK_GETSERVBYNAME	23
173f5b1c8a1SJohn Marino #define CRYPTO_LOCK_READDIR		24
174f5b1c8a1SJohn Marino #define CRYPTO_LOCK_RSA_BLINDING	25
175f5b1c8a1SJohn Marino #define CRYPTO_LOCK_DH			26
176f5b1c8a1SJohn Marino #define CRYPTO_LOCK_MALLOC2		27
177f5b1c8a1SJohn Marino #define CRYPTO_LOCK_DSO			28
178f5b1c8a1SJohn Marino #define CRYPTO_LOCK_DYNLOCK		29
179f5b1c8a1SJohn Marino #define CRYPTO_LOCK_ENGINE		30
180f5b1c8a1SJohn Marino #define CRYPTO_LOCK_UI			31
181f5b1c8a1SJohn Marino #define CRYPTO_LOCK_ECDSA               32
182f5b1c8a1SJohn Marino #define CRYPTO_LOCK_EC			33
183f5b1c8a1SJohn Marino #define CRYPTO_LOCK_ECDH		34
184f5b1c8a1SJohn Marino #define CRYPTO_LOCK_BN  		35
185f5b1c8a1SJohn Marino #define CRYPTO_LOCK_EC_PRE_COMP		36
186f5b1c8a1SJohn Marino #define CRYPTO_LOCK_STORE		37
187f5b1c8a1SJohn Marino #define CRYPTO_LOCK_COMP		38
188f5b1c8a1SJohn Marino #define CRYPTO_LOCK_FIPS		39
189f5b1c8a1SJohn Marino #define CRYPTO_LOCK_FIPS2		40
190f5b1c8a1SJohn Marino #define CRYPTO_NUM_LOCKS		41
191f5b1c8a1SJohn Marino 
192f5b1c8a1SJohn Marino #define CRYPTO_LOCK		1
193f5b1c8a1SJohn Marino #define CRYPTO_UNLOCK		2
194f5b1c8a1SJohn Marino #define CRYPTO_READ		4
195f5b1c8a1SJohn Marino #define CRYPTO_WRITE		8
196f5b1c8a1SJohn Marino 
197f5b1c8a1SJohn Marino #ifndef CRYPTO_w_lock
198f5b1c8a1SJohn Marino #define CRYPTO_w_lock(type)	\
199*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0)
200f5b1c8a1SJohn Marino #define CRYPTO_w_unlock(type)	\
201*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0)
202f5b1c8a1SJohn Marino #define CRYPTO_r_lock(type)	\
203*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0)
204f5b1c8a1SJohn Marino #define CRYPTO_r_unlock(type)	\
205*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0)
206f5b1c8a1SJohn Marino #define CRYPTO_add(addr,amount,type)	\
207*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_add_lock(addr,amount,type,NULL,0)
208f5b1c8a1SJohn Marino #endif
209f5b1c8a1SJohn Marino 
210f5b1c8a1SJohn Marino /* Some applications as well as some parts of OpenSSL need to allocate
211f5b1c8a1SJohn Marino    and deallocate locks in a dynamic fashion.  The following typedef
212f5b1c8a1SJohn Marino    makes this possible in a type-safe manner.  */
213f5b1c8a1SJohn Marino /* struct CRYPTO_dynlock_value has to be defined by the application. */
214f5b1c8a1SJohn Marino typedef struct {
215f5b1c8a1SJohn Marino 	int references;
216f5b1c8a1SJohn Marino 	struct CRYPTO_dynlock_value *data;
217f5b1c8a1SJohn Marino } CRYPTO_dynlock;
218f5b1c8a1SJohn Marino 
219f5b1c8a1SJohn Marino 
220f5b1c8a1SJohn Marino /* The following can be used to detect memory leaks in the SSLeay library.
221f5b1c8a1SJohn Marino  * It used, it turns on malloc checking */
222f5b1c8a1SJohn Marino 
223f5b1c8a1SJohn Marino #define CRYPTO_MEM_CHECK_OFF	0x0	/* an enume */
224f5b1c8a1SJohn Marino #define CRYPTO_MEM_CHECK_ON	0x1	/* a bit */
225f5b1c8a1SJohn Marino #define CRYPTO_MEM_CHECK_ENABLE	0x2	/* a bit */
226f5b1c8a1SJohn Marino #define CRYPTO_MEM_CHECK_DISABLE 0x3	/* an enume */
227f5b1c8a1SJohn Marino 
228f5b1c8a1SJohn Marino /* The following are bit values to turn on or off options connected to the
229f5b1c8a1SJohn Marino  * malloc checking functionality */
230f5b1c8a1SJohn Marino 
231f5b1c8a1SJohn Marino /* Adds time to the memory checking information */
232f5b1c8a1SJohn Marino #define V_CRYPTO_MDEBUG_TIME	0x1 /* a bit */
233f5b1c8a1SJohn Marino /* Adds thread number to the memory checking information */
234f5b1c8a1SJohn Marino #define V_CRYPTO_MDEBUG_THREAD	0x2 /* a bit */
235f5b1c8a1SJohn Marino 
236f5b1c8a1SJohn Marino #define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
237f5b1c8a1SJohn Marino 
238f5b1c8a1SJohn Marino 
239f5b1c8a1SJohn Marino /* predec of the BIO type */
240f5b1c8a1SJohn Marino typedef struct bio_st BIO_dummy;
241f5b1c8a1SJohn Marino 
242f5b1c8a1SJohn Marino struct crypto_ex_data_st {
243f5b1c8a1SJohn Marino 	STACK_OF(void) *sk;
244f5b1c8a1SJohn Marino };
245f5b1c8a1SJohn Marino DECLARE_STACK_OF(void)
246f5b1c8a1SJohn Marino 
247f5b1c8a1SJohn Marino /* This stuff is basically class callback functions
248f5b1c8a1SJohn Marino  * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
249f5b1c8a1SJohn Marino 
250f5b1c8a1SJohn Marino typedef struct crypto_ex_data_func_st {
251f5b1c8a1SJohn Marino 	long argl;	/* Arbitary long */
252f5b1c8a1SJohn Marino 	void *argp;	/* Arbitary void * */
253f5b1c8a1SJohn Marino 	CRYPTO_EX_new *new_func;
254f5b1c8a1SJohn Marino 	CRYPTO_EX_free *free_func;
255f5b1c8a1SJohn Marino 	CRYPTO_EX_dup *dup_func;
256f5b1c8a1SJohn Marino } CRYPTO_EX_DATA_FUNCS;
257f5b1c8a1SJohn Marino 
258f5b1c8a1SJohn Marino DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
259f5b1c8a1SJohn Marino 
260f5b1c8a1SJohn Marino /* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
261f5b1c8a1SJohn Marino  * entry.
262f5b1c8a1SJohn Marino  */
263f5b1c8a1SJohn Marino 
264f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_BIO		0
265f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_SSL		1
266f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_SSL_CTX		2
267f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_SSL_SESSION	3
268f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_X509_STORE	4
269f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_X509_STORE_CTX	5
270f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_RSA		6
271f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_DSA		7
272f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_DH		8
273f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_ENGINE		9
274f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_X509		10
275f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_UI		11
276f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_ECDSA		12
277f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_ECDH		13
278f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_COMP		14
279f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_STORE		15
28072c33676SMaxim Ag #define CRYPTO_EX_INDEX_EC_KEY		16
281f5b1c8a1SJohn Marino 
282f5b1c8a1SJohn Marino /* Dynamically assigned indexes start from this value (don't use directly, use
283f5b1c8a1SJohn Marino  * via CRYPTO_ex_data_new_class). */
284f5b1c8a1SJohn Marino #define CRYPTO_EX_INDEX_USER		100
285f5b1c8a1SJohn Marino 
28672c33676SMaxim Ag #ifndef LIBRESSL_INTERNAL
287f5b1c8a1SJohn Marino #define CRYPTO_malloc_init()		(0)
288f5b1c8a1SJohn Marino #define CRYPTO_malloc_debug_init()	(0)
289f5b1c8a1SJohn Marino 
290f5b1c8a1SJohn Marino #if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
291f5b1c8a1SJohn Marino # ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
292f5b1c8a1SJohn Marino #  define CRYPTO_MDEBUG
293f5b1c8a1SJohn Marino # endif
294f5b1c8a1SJohn Marino #endif
295f5b1c8a1SJohn Marino 
296f5b1c8a1SJohn Marino int CRYPTO_mem_ctrl(int mode);
297f5b1c8a1SJohn Marino int CRYPTO_is_mem_check_on(void);
298f5b1c8a1SJohn Marino 
299f5b1c8a1SJohn Marino /* for applications */
300f5b1c8a1SJohn Marino #define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
301f5b1c8a1SJohn Marino #define MemCheck_stop()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
302f5b1c8a1SJohn Marino 
303*de0e0e4dSAntonio Huete Jimenez #define OPENSSL_malloc(num)	CRYPTO_malloc((int)num,NULL,0)
304*de0e0e4dSAntonio Huete Jimenez #define OPENSSL_strdup(str)	CRYPTO_strdup((str),NULL,0)
305f5b1c8a1SJohn Marino #define OPENSSL_realloc(addr,num) \
306*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_realloc((char *)addr,(int)num,NULL,0)
307f5b1c8a1SJohn Marino #define OPENSSL_realloc_clean(addr,old_num,num) \
308*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_realloc_clean(addr,old_num,num,NULL,0)
309f5b1c8a1SJohn Marino #define OPENSSL_remalloc(addr,num) \
310*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_remalloc((char **)addr,(int)num,NULL,0)
311f5b1c8a1SJohn Marino #define OPENSSL_freeFunc	CRYPTO_free
312f5b1c8a1SJohn Marino #define OPENSSL_free(addr)	CRYPTO_free(addr)
313f5b1c8a1SJohn Marino 
314f5b1c8a1SJohn Marino #define OPENSSL_malloc_locked(num) \
315*de0e0e4dSAntonio Huete Jimenez 	CRYPTO_malloc_locked((int)num,NULL,0)
316f5b1c8a1SJohn Marino #define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
31772c33676SMaxim Ag #endif
318f5b1c8a1SJohn Marino 
31972c33676SMaxim Ag const char *OpenSSL_version(int type);
32072c33676SMaxim Ag #define OPENSSL_VERSION		0
32172c33676SMaxim Ag #define OPENSSL_CFLAGS		1
32272c33676SMaxim Ag #define OPENSSL_BUILT_ON	2
32372c33676SMaxim Ag #define OPENSSL_PLATFORM	3
32472c33676SMaxim Ag #define OPENSSL_DIR		4
32572c33676SMaxim Ag #define OPENSSL_ENGINES_DIR	5
32672c33676SMaxim Ag unsigned long OpenSSL_version_num(void);
327f5b1c8a1SJohn Marino 
328f5b1c8a1SJohn Marino const char *SSLeay_version(int type);
329f5b1c8a1SJohn Marino unsigned long SSLeay(void);
330f5b1c8a1SJohn Marino 
331f5b1c8a1SJohn Marino /* An opaque type representing an implementation of "ex_data" support */
332f5b1c8a1SJohn Marino typedef struct st_CRYPTO_EX_DATA_IMPL	CRYPTO_EX_DATA_IMPL;
333f5b1c8a1SJohn Marino /* Return an opaque pointer to the current "ex_data" implementation */
334f5b1c8a1SJohn Marino const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
335f5b1c8a1SJohn Marino /* Sets the "ex_data" implementation to be used (if it's not too late) */
336f5b1c8a1SJohn Marino int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
337f5b1c8a1SJohn Marino /* Get a new "ex_data" class, and return the corresponding "class_index" */
338f5b1c8a1SJohn Marino int CRYPTO_ex_data_new_class(void);
339f5b1c8a1SJohn Marino /* Within a given class, get/register a new index */
340f5b1c8a1SJohn Marino int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
341f5b1c8a1SJohn Marino     CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
342f5b1c8a1SJohn Marino     CRYPTO_EX_free *free_func);
343f5b1c8a1SJohn Marino /* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given
344f5b1c8a1SJohn Marino  * class (invokes whatever per-class callbacks are applicable) */
345f5b1c8a1SJohn Marino int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
346f5b1c8a1SJohn Marino int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
347f5b1c8a1SJohn Marino     CRYPTO_EX_DATA *from);
348f5b1c8a1SJohn Marino void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
349f5b1c8a1SJohn Marino /* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index
350f5b1c8a1SJohn Marino  * (relative to the class type involved) */
351f5b1c8a1SJohn Marino int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
352f5b1c8a1SJohn Marino void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
353f5b1c8a1SJohn Marino /* This function cleans up all "ex_data" state. It mustn't be called under
354f5b1c8a1SJohn Marino  * potential race-conditions. */
355f5b1c8a1SJohn Marino void CRYPTO_cleanup_all_ex_data(void);
356f5b1c8a1SJohn Marino 
357f5b1c8a1SJohn Marino void CRYPTO_lock(int mode, int type, const char *file, int line);
35872c33676SMaxim Ag int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
35972c33676SMaxim Ag     int line);
36072c33676SMaxim Ag 
36172c33676SMaxim Ag /* Don't use this structure directly. */
36272c33676SMaxim Ag typedef struct crypto_threadid_st {
36372c33676SMaxim Ag 	void *ptr;
36472c33676SMaxim Ag 	unsigned long val;
36572c33676SMaxim Ag } CRYPTO_THREADID;
36672c33676SMaxim Ag void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
36772c33676SMaxim Ag int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
36872c33676SMaxim Ag void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
36972c33676SMaxim Ag unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
37072c33676SMaxim Ag 
37172c33676SMaxim Ag #ifndef LIBRESSL_INTERNAL
37272c33676SMaxim Ag /* These functions are deprecated no-op stubs */
37372c33676SMaxim Ag void CRYPTO_set_id_callback(unsigned long (*func)(void));
37472c33676SMaxim Ag unsigned long (*CRYPTO_get_id_callback(void))(void);
37572c33676SMaxim Ag unsigned long CRYPTO_thread_id(void);
37672c33676SMaxim Ag 
37772c33676SMaxim Ag int CRYPTO_get_new_lockid(char *name);
37872c33676SMaxim Ag const char *CRYPTO_get_lock_name(int type);
37972c33676SMaxim Ag 
38072c33676SMaxim Ag int CRYPTO_num_locks(void);
381f5b1c8a1SJohn Marino void CRYPTO_set_locking_callback(void (*func)(int mode, int type,
382f5b1c8a1SJohn Marino     const char *file, int line));
383f5b1c8a1SJohn Marino void (*CRYPTO_get_locking_callback(void))(int mode, int type,
384f5b1c8a1SJohn Marino     const char *file, int line);
385f5b1c8a1SJohn Marino void CRYPTO_set_add_lock_callback(int (*func)(int *num, int mount, int type,
386f5b1c8a1SJohn Marino     const char *file, int line));
387f5b1c8a1SJohn Marino int (*CRYPTO_get_add_lock_callback(void))(int *num, int mount, int type,
388f5b1c8a1SJohn Marino     const char *file, int line);
389f5b1c8a1SJohn Marino 
390f5b1c8a1SJohn Marino void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
391f5b1c8a1SJohn Marino void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
392f5b1c8a1SJohn Marino int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *));
393f5b1c8a1SJohn Marino void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);
394f5b1c8a1SJohn Marino 
395f5b1c8a1SJohn Marino int CRYPTO_get_new_dynlockid(void);
396f5b1c8a1SJohn Marino void CRYPTO_destroy_dynlockid(int i);
397f5b1c8a1SJohn Marino struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
398f5b1c8a1SJohn Marino void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));
399f5b1c8a1SJohn Marino void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));
400f5b1c8a1SJohn Marino void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));
401f5b1c8a1SJohn Marino struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file, int line);
402f5b1c8a1SJohn Marino void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line);
403f5b1c8a1SJohn Marino void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file, int line);
40472c33676SMaxim Ag #endif
405f5b1c8a1SJohn Marino 
406f5b1c8a1SJohn Marino /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
407f5b1c8a1SJohn Marino  * call the latter last if you need different functions */
408f5b1c8a1SJohn Marino int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
409f5b1c8a1SJohn Marino int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
410f5b1c8a1SJohn Marino int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int),
411f5b1c8a1SJohn Marino     void *(*r)(void *, size_t, const char *, int), void (*f)(void *));
412f5b1c8a1SJohn Marino int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int),
413f5b1c8a1SJohn Marino     void (*free_func)(void *));
414f5b1c8a1SJohn Marino int CRYPTO_set_mem_debug_functions(
415f5b1c8a1SJohn Marino     void (*m)(void *, int, const char *, int, int),
416f5b1c8a1SJohn Marino     void (*r)(void *, void *, int, const char *, int, int),
417f5b1c8a1SJohn Marino     void (*f)(void *, int), void (*so)(long), long (*go)(void));
418f5b1c8a1SJohn Marino void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
419f5b1c8a1SJohn Marino     void (**f)(void *));
420f5b1c8a1SJohn Marino void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
421f5b1c8a1SJohn Marino void CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int),
422f5b1c8a1SJohn Marino     void *(**r)(void *, size_t, const char *, int), void (**f)(void *));
423f5b1c8a1SJohn Marino void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int),
424f5b1c8a1SJohn Marino     void (**f)(void *));
425f5b1c8a1SJohn Marino void CRYPTO_get_mem_debug_functions(
426f5b1c8a1SJohn Marino     void (**m)(void *, int, const char *, int, int),
427f5b1c8a1SJohn Marino     void (**r)(void *, void *, int, const char *, int, int),
428f5b1c8a1SJohn Marino     void (**f)(void *, int), void (**so)(long), long (**go)(void));
429f5b1c8a1SJohn Marino 
430f5b1c8a1SJohn Marino #ifndef LIBRESSL_INTERNAL
431f5b1c8a1SJohn Marino void *CRYPTO_malloc_locked(int num, const char *file, int line);
432f5b1c8a1SJohn Marino void CRYPTO_free_locked(void *ptr);
433f5b1c8a1SJohn Marino void *CRYPTO_malloc(int num, const char *file, int line);
434f5b1c8a1SJohn Marino char *CRYPTO_strdup(const char *str, const char *file, int line);
435f5b1c8a1SJohn Marino void CRYPTO_free(void *ptr);
436f5b1c8a1SJohn Marino void *CRYPTO_realloc(void *addr, int num, const char *file, int line);
437f5b1c8a1SJohn Marino #endif
438f5b1c8a1SJohn Marino 
439f5b1c8a1SJohn Marino void *CRYPTO_realloc_clean(void *addr, int old_num, int num,
440f5b1c8a1SJohn Marino     const char *file, int line);
441f5b1c8a1SJohn Marino void *CRYPTO_remalloc(void *addr, int num, const char *file, int line);
442f5b1c8a1SJohn Marino 
443f5b1c8a1SJohn Marino #ifndef LIBRESSL_INTERNAL
444f5b1c8a1SJohn Marino void OPENSSL_cleanse(void *ptr, size_t len);
445f5b1c8a1SJohn Marino #endif
446f5b1c8a1SJohn Marino 
447f5b1c8a1SJohn Marino void CRYPTO_set_mem_debug_options(long bits);
448f5b1c8a1SJohn Marino long CRYPTO_get_mem_debug_options(void);
449f5b1c8a1SJohn Marino 
450f5b1c8a1SJohn Marino #define CRYPTO_push_info(info) \
451*de0e0e4dSAntonio Huete Jimenez         CRYPTO_push_info_(info, NULL, 0);
452f5b1c8a1SJohn Marino int CRYPTO_push_info_(const char *info, const char *file, int line);
453f5b1c8a1SJohn Marino int CRYPTO_pop_info(void);
454f5b1c8a1SJohn Marino int CRYPTO_remove_all_info(void);
455f5b1c8a1SJohn Marino 
456f5b1c8a1SJohn Marino 
457f5b1c8a1SJohn Marino /* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
458f5b1c8a1SJohn Marino  * used as default in CRYPTO_MDEBUG compilations): */
459f5b1c8a1SJohn Marino /* The last argument has the following significance:
460f5b1c8a1SJohn Marino  *
461f5b1c8a1SJohn Marino  * 0:	called before the actual memory allocation has taken place
462f5b1c8a1SJohn Marino  * 1:	called after the actual memory allocation has taken place
463f5b1c8a1SJohn Marino  */
464f5b1c8a1SJohn Marino void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, int before_p)
465f5b1c8a1SJohn Marino 	__attribute__ ((deprecated));
466f5b1c8a1SJohn Marino void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, int line, int before_p)
467f5b1c8a1SJohn Marino 	__attribute__ ((deprecated));
468f5b1c8a1SJohn Marino void CRYPTO_dbg_free(void *addr, int before_p)
469f5b1c8a1SJohn Marino 	__attribute__ ((deprecated));
470f5b1c8a1SJohn Marino /* Tell the debugging code about options.  By default, the following values
471f5b1c8a1SJohn Marino  * apply:
472f5b1c8a1SJohn Marino  *
473f5b1c8a1SJohn Marino  * 0:                           Clear all options.
474f5b1c8a1SJohn Marino  * V_CRYPTO_MDEBUG_TIME (1):    Set the "Show Time" option.
475f5b1c8a1SJohn Marino  * V_CRYPTO_MDEBUG_THREAD (2):  Set the "Show Thread Number" option.
476f5b1c8a1SJohn Marino  * V_CRYPTO_MDEBUG_ALL (3):     1 + 2
477f5b1c8a1SJohn Marino  */
478f5b1c8a1SJohn Marino void CRYPTO_dbg_set_options(long bits)
479f5b1c8a1SJohn Marino 	__attribute__ ((deprecated));
480f5b1c8a1SJohn Marino long CRYPTO_dbg_get_options(void)
481f5b1c8a1SJohn Marino 	__attribute__ ((deprecated));
482f5b1c8a1SJohn Marino 
483f5b1c8a1SJohn Marino 
48472c33676SMaxim Ag int CRYPTO_mem_leaks_fp(FILE *);
48572c33676SMaxim Ag int CRYPTO_mem_leaks(struct bio_st *bio);
486f5b1c8a1SJohn Marino /* unsigned long order, char *file, int line, int num_bytes, char *addr */
48772c33676SMaxim Ag typedef int *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
48872c33676SMaxim Ag int CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
489f5b1c8a1SJohn Marino 
490f5b1c8a1SJohn Marino /* die if we have to */
491f5b1c8a1SJohn Marino void OpenSSLDie(const char *file, int line, const char *assertion);
492f5b1c8a1SJohn Marino #define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
493f5b1c8a1SJohn Marino 
494f5b1c8a1SJohn Marino uint64_t OPENSSL_cpu_caps(void);
495f5b1c8a1SJohn Marino 
496f5b1c8a1SJohn Marino int OPENSSL_isservice(void);
497f5b1c8a1SJohn Marino 
49872c33676SMaxim Ag #ifndef LIBRESSL_INTERNAL
499*de0e0e4dSAntonio Huete Jimenez int FIPS_mode(void);
500*de0e0e4dSAntonio Huete Jimenez int FIPS_mode_set(int r);
501*de0e0e4dSAntonio Huete Jimenez 
502f5b1c8a1SJohn Marino void OPENSSL_init(void);
503f5b1c8a1SJohn Marino 
504f5b1c8a1SJohn Marino /* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
505f5b1c8a1SJohn Marino  * takes an amount of time dependent on |len|, but independent of the contents
506f5b1c8a1SJohn Marino  * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
507f5b1c8a1SJohn Marino  * defined order as the return value when a != b is undefined, other than to be
508f5b1c8a1SJohn Marino  * non-zero. */
509f5b1c8a1SJohn Marino int CRYPTO_memcmp(const void *a, const void *b, size_t len);
510f5b1c8a1SJohn Marino #endif
511f5b1c8a1SJohn Marino 
512f5b1c8a1SJohn Marino void ERR_load_CRYPTO_strings(void);
513f5b1c8a1SJohn Marino 
514f5b1c8a1SJohn Marino /* Error codes for the CRYPTO functions. */
515f5b1c8a1SJohn Marino 
516f5b1c8a1SJohn Marino /* Function codes. */
517f5b1c8a1SJohn Marino #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX		 100
518f5b1c8a1SJohn Marino #define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID		 103
519f5b1c8a1SJohn Marino #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID			 101
520f5b1c8a1SJohn Marino #define CRYPTO_F_CRYPTO_SET_EX_DATA			 102
521f5b1c8a1SJohn Marino #define CRYPTO_F_DEF_ADD_INDEX				 104
522f5b1c8a1SJohn Marino #define CRYPTO_F_DEF_GET_CLASS				 105
523f5b1c8a1SJohn Marino #define CRYPTO_F_FIPS_MODE_SET				 109
524f5b1c8a1SJohn Marino #define CRYPTO_F_INT_DUP_EX_DATA			 106
525f5b1c8a1SJohn Marino #define CRYPTO_F_INT_FREE_EX_DATA			 107
526f5b1c8a1SJohn Marino #define CRYPTO_F_INT_NEW_EX_DATA			 108
527f5b1c8a1SJohn Marino 
528f5b1c8a1SJohn Marino /* Reason codes. */
529f5b1c8a1SJohn Marino #define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED		 101
530f5b1c8a1SJohn Marino #define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK		 100
531f5b1c8a1SJohn Marino 
53272c33676SMaxim Ag /*
53372c33676SMaxim Ag  * OpenSSL compatible OPENSSL_INIT options.
53472c33676SMaxim Ag  */
53572c33676SMaxim Ag 
53672c33676SMaxim Ag #define OPENSSL_INIT_NO_LOAD_CONFIG		0x00000001L
53772c33676SMaxim Ag #define OPENSSL_INIT_LOAD_CONFIG		0x00000002L
53872c33676SMaxim Ag 
53972c33676SMaxim Ag /* LibreSSL specific */
54072c33676SMaxim Ag #define _OPENSSL_INIT_FLAG_NOOP			0x80000000L
54172c33676SMaxim Ag 
54272c33676SMaxim Ag /*
54372c33676SMaxim Ag  * These are provided for compatibiliy, but have no effect
54472c33676SMaxim Ag  * on how LibreSSL is initialized.
54572c33676SMaxim Ag  */
54672c33676SMaxim Ag #define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS	_OPENSSL_INIT_FLAG_NOOP
54772c33676SMaxim Ag #define OPENSSL_INIT_LOAD_CRYPTO_STRINGS	_OPENSSL_INIT_FLAG_NOOP
54872c33676SMaxim Ag #define OPENSSL_INIT_ADD_ALL_CIPHERS		_OPENSSL_INIT_FLAG_NOOP
54972c33676SMaxim Ag #define OPENSSL_INIT_ADD_ALL_DIGESTS		_OPENSSL_INIT_FLAG_NOOP
55072c33676SMaxim Ag #define OPENSSL_INIT_NO_ADD_ALL_CIPHERS		_OPENSSL_INIT_FLAG_NOOP
55172c33676SMaxim Ag #define OPENSSL_INIT_NO_ADD_ALL_DIGESTS		_OPENSSL_INIT_FLAG_NOOP
55272c33676SMaxim Ag #define OPENSSL_INIT_ASYNC			_OPENSSL_INIT_FLAG_NOOP
55372c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_RDRAND		_OPENSSL_INIT_FLAG_NOOP
55472c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_DYNAMIC		_OPENSSL_INIT_FLAG_NOOP
55572c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_OPENSSL		_OPENSSL_INIT_FLAG_NOOP
55672c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_CRYPTODEV		_OPENSSL_INIT_FLAG_NOOP
55772c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_CAPI		_OPENSSL_INIT_FLAG_NOOP
55872c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_PADLOCK		_OPENSSL_INIT_FLAG_NOOP
55972c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_AFALG		_OPENSSL_INIT_FLAG_NOOP
56072c33676SMaxim Ag #define OPENSSL_INIT_reserved_internal		_OPENSSL_INIT_FLAG_NOOP
56172c33676SMaxim Ag #define OPENSSL_INIT_ATFORK			_OPENSSL_INIT_FLAG_NOOP
56272c33676SMaxim Ag #define OPENSSL_INIT_ENGINE_ALL_BUILTIN		_OPENSSL_INIT_FLAG_NOOP
56372c33676SMaxim Ag 
56472c33676SMaxim Ag int OPENSSL_init_crypto(uint64_t opts, const void *settings);
565*de0e0e4dSAntonio Huete Jimenez void OPENSSL_cleanup(void);
56672c33676SMaxim Ag 
567f5b1c8a1SJohn Marino #ifdef  __cplusplus
568f5b1c8a1SJohn Marino }
569f5b1c8a1SJohn Marino #endif
570f5b1c8a1SJohn Marino #endif
571