1 /* crypto/err/err.h */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3  * All rights reserved.
4  *
5  * This package is an SSL implementation written
6  * by Eric Young (eay@cryptsoft.com).
7  * The implementation was written so as to conform with Netscapes SSL.
8  *
9  * This library is free for commercial and non-commercial use as long as
10  * the following conditions are aheared to.  The following conditions
11  * apply to all code found in this distribution, be it the RC4, RSA,
12  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13  * included with this distribution is covered by the same copyright terms
14  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15  *
16  * Copyright remains Eric Young's, and as such any Copyright notices in
17  * the code are not to be removed.
18  * If this package is used in a product, Eric Young should be given attribution
19  * as the author of the parts of the library used.
20  * This can be in the form of a textual message at program startup or
21  * in documentation (online or textual) provided with the package.
22  *
23  * Redistribution and use in source and binary forms, with or without
24  * modification, are permitted provided that the following conditions
25  * are met:
26  * 1. Redistributions of source code must retain the copyright
27  *   notice, this list of conditions and the following disclaimer.
28  * 2. Redistributions in binary form must reproduce the above copyright
29  *   notice, this list of conditions and the following disclaimer in the
30  *   documentation and/or other materials provided with the distribution.
31  * 3. All advertising materials mentioning features or use of this software
32  *   must display the following acknowledgement:
33  *   "This product includes cryptographic software written by
34  *    Eric Young (eay@cryptsoft.com)"
35  *   The word 'cryptographic' can be left out if the rouines from the library
36  *   being used are not cryptographic related :-).
37  * 4. If you include any Windows specific code (or a derivative thereof) from
38  *   the apps directory (application code) you must include an acknowledgement:
39  *   "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40  *
41  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  *
53  * The licence and distribution terms for any publically available version or
54  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55  * copied and put under another distribution licence
56  * [including the GNU Public Licence.]
57  */
58 /* ====================================================================
59  * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
60  *
61  * Redistribution and use in source and binary forms, with or without
62  * modification, are permitted provided that the following conditions
63  * are met:
64  *
65  * 1. Redistributions of source code must retain the above copyright
66  *   notice, this list of conditions and the following disclaimer.
67  *
68  * 2. Redistributions in binary form must reproduce the above copyright
69  *   notice, this list of conditions and the following disclaimer in
70  *   the documentation and/or other materials provided with the
71  *   distribution.
72  *
73  * 3. All advertising materials mentioning features or use of this
74  *   software must display the following acknowledgment:
75  *   "This product includes software developed by the OpenSSL Project
76  *   for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77  *
78  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79  *   endorse or promote products derived from this software without
80  *   prior written permission. For written permission, please contact
81  *   openssl-core@openssl.org.
82  *
83  * 5. Products derived from this software may not be called "OpenSSL"
84  *   nor may "OpenSSL" appear in their names without prior written
85  *   permission of the OpenSSL Project.
86  *
87  * 6. Redistributions of any form whatsoever must retain the following
88  *   acknowledgment:
89  *   "This product includes software developed by the OpenSSL Project
90  *   for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91  *
92  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
96  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103  * OF THE POSSIBILITY OF SUCH DAMAGE.
104  * ====================================================================
105  *
106  * This product includes cryptographic software written by Eric Young
107  * (eay@cryptsoft.com).  This product includes software written by Tim
108  * Hudson (tjh@cryptsoft.com).
109  *
110  */
111 
112 module deimos.openssl.err;
113 
114 import deimos.openssl._d_util;
115 
116 public import deimos.openssl.e_os2;
117 
118 version(OPENSSL_NO_FP_API) {} else {
119 import core.stdc.stdio;
120 import core.stdc.stdlib;
121 }
122 
123 public import deimos.openssl.types;
124 version(OPENSSL_NO_BIO) {} else {
125 public import deimos.openssl.bio;
126 }
127 version(OPENSSL_NO_LHASH) {} else {
128 public import deimos.openssl.lhash;
129 }
130 
131 import core.vararg : va_list;
132 
133 extern (C):
134 nothrow:
135 
136 enum ERR_TXT_MALLOCED = 0x01;
137 enum ERR_TXT_STRING = 0x02;
138 
139 enum ERR_FLAG_MARK = 0x01;
140 
141 enum ERR_NUM_ERRORS = 16;
142 struct err_state_st {
143 	CRYPTO_THREADID tid;
144 	int[ERR_NUM_ERRORS] err_flags;
145 	c_ulong[ERR_NUM_ERRORS] err_buffer;
146 	char*[ERR_NUM_ERRORS] err_data;
147 	int[ERR_NUM_ERRORS] err_data_flags;
148 	const(char)*[ERR_NUM_ERRORS] err_file;
149 	int[ERR_NUM_ERRORS] err_line;
150 	int top,bottom;
151 	}
152 alias err_state_st ERR_STATE;
153 
154 /* library */
155 enum ERR_LIB_NONE = 1;
156 enum ERR_LIB_SYS = 2;
157 enum ERR_LIB_BN = 3;
158 enum ERR_LIB_RSA = 4;
159 enum ERR_LIB_DH = 5;
160 enum ERR_LIB_EVP = 6;
161 enum ERR_LIB_BUF = 7;
162 enum ERR_LIB_OBJ = 8;
163 enum ERR_LIB_PEM = 9;
164 enum ERR_LIB_DSA = 10;
165 enum ERR_LIB_X509 = 11;
166 /* enum ERR_LIB_METH = 12; */
167 enum ERR_LIB_ASN1 = 13;
168 enum ERR_LIB_CONF = 14;
169 enum ERR_LIB_CRYPTO = 15;
170 enum ERR_LIB_EC = 16;
171 enum ERR_LIB_SSL = 20;
172 /* enum ERR_LIB_SSL23 = 21; */
173 /* enum ERR_LIB_SSL2 = 22; */
174 /* enum ERR_LIB_SSL3 = 23; */
175 /* enum ERR_LIB_RSAREF = 30; */
176 /* enum ERR_LIB_PROXY = 31; */
177 enum ERR_LIB_BIO = 32;
178 enum ERR_LIB_PKCS7 = 33;
179 enum ERR_LIB_X509V3 = 34;
180 enum ERR_LIB_PKCS12 = 35;
181 enum ERR_LIB_RAND = 36;
182 enum ERR_LIB_DSO = 37;
183 enum ERR_LIB_ENGINE = 38;
184 enum ERR_LIB_OCSP = 39;
185 enum ERR_LIB_UI = 40;
186 enum ERR_LIB_COMP = 41;
187 enum ERR_LIB_ECDSA = 42;
188 enum ERR_LIB_ECDH = 43;
189 enum ERR_LIB_STORE = 44;
190 enum ERR_LIB_FIPS = 45;
191 enum ERR_LIB_CMS = 46;
192 enum ERR_LIB_TS = 47;
193 enum ERR_LIB_HMAC = 48;
194 enum ERR_LIB_JPAKE = 49;
195 
196 enum ERR_LIB_USER = 128;
197 
198 void SYSerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_SYS,f,r,file,line); }
199 void BNerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_BN,f,r,file,line); }
200 void RSAerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_RSA,f,r,file,line); }
201 void DHerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_DH,f,r,file,line); }
202 void EVPerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_EVP,f,r,file,line); }
203 void BUFerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_BUF,f,r,file,line); }
204 void OBJerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_OBJ,f,r,file,line); }
205 void PEMerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_PEM,f,r,file,line); }
206 void DSAerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_DSA,f,r,file,line); }
207 void X509err_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_X509,f,r,file,line); }
208 void ASN1err_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_ASN1,f,r,file,line); }
209 void CONFerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_CONF,f,r,file,line); }
210 void CRYPTOerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_CRYPTO,f,r,file,line); }
211 void ECerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_EC,f,r,file,line); }
212 void SSLerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_SSL,f,r,file,line); }
213 void BIOerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_BIO,f,r,file,line); }
214 void PKCS7err_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_PKCS7,f,r,file,line); }
215 void X509V3err_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_X509V3,f,r,file,line); }
216 void PKCS12err_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_PKCS12,f,r,file,line); }
217 void RANDerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_RAND,f,r,file,line); }
218 void DSOerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_DSO,f,r,file,line); }
219 void ENGINEerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_ENGINE,f,r,file,line); }
220 void OCSPerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_OCSP,f,r,file,line); }
221 void UIerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_UI,f,r,file,line); }
222 void COMPerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_COMP,f,r,file,line); }
223 void ECDSAerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_ECDSA,f,r,file,line); }
224 void ECDHerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_ECDH,f,r,file,line); }
225 void STOREerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_STORE,f,r,file,line); }
226 void FIPSerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_FIPS,f,r,file,line); }
227 void CMSerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_CMS,f,r,file,line); }
228 void TSerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_TS,f,r,file,line); }
229 void HMACerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_HMAC,f,r,file,line); }
230 void JPAKEerr_err(string file = __FILE__, size_t line = __LINE__)(int f, int r){ ERR_PUT_error(ERR_LIB_JPAKE,f,r,file,line); }
231 
232 /* Borland C seems too stupid to be able to shift and do longs in
233  * the pre-processor :-( */
234 auto ERR_PACK()(c_ulong l, c_ulong f, c_ulong r) {
235 	return ((((l)&0xffL)*0x1000000)|
236 					(((f)&0xfffL)*0x1000)|
237 					(((r)&0xfffL)));
238 }
239 auto ERR_GET_LIB()(c_ulong l) { return cast(int)(((l)>>24L)&0xffL); }
240 auto ERR_GET_FUNC()(c_ulong l) { return cast(int)(((l)>>12L)&0xfffL); }
241 auto ERR_GET_REASON()(c_ulong l) { return cast(int)((l)&0xfffL); }
242 auto ERR_FATAL_ERROR()(c_ulong l) { return cast(int)((l)&ERR_R_FATAL); }
243 
244 
245 /* OS functions */
246 enum SYS_F_FOPEN = 1;
247 enum SYS_F_CONNECT = 2;
248 enum SYS_F_GETSERVBYNAME = 3;
249 enum SYS_F_SOCKET = 4;
250 enum SYS_F_IOCTLSOCKET = 5;
251 enum SYS_F_BIND = 6;
252 enum SYS_F_LISTEN = 7;
253 enum SYS_F_ACCEPT = 8;
254 enum SYS_F_WSASTARTUP = 9; /* Winsock stuff */
255 enum SYS_F_OPENDIR = 10;
256 enum SYS_F_FREAD = 11;
257 
258 
259 /* reasons */
260 alias ERR_LIB_SYS ERR_R_SYS_LIB ; /* 2 */
261 alias ERR_LIB_BN ERR_R_BN_LIB ; /* 3 */
262 alias ERR_LIB_RSA ERR_R_RSA_LIB ; /* 4 */
263 alias ERR_LIB_DH ERR_R_DH_LIB ; /* 5 */
264 alias ERR_LIB_EVP ERR_R_EVP_LIB ; /* 6 */
265 alias ERR_LIB_BUF ERR_R_BUF_LIB ; /* 7 */
266 alias ERR_LIB_OBJ ERR_R_OBJ_LIB ; /* 8 */
267 alias ERR_LIB_PEM ERR_R_PEM_LIB ; /* 9 */
268 alias ERR_LIB_DSA ERR_R_DSA_LIB ; /* 10 */
269 alias ERR_LIB_X509 ERR_R_X509_LIB ; /* 11 */
270 alias ERR_LIB_ASN1 ERR_R_ASN1_LIB ; /* 13 */
271 alias ERR_LIB_CONF ERR_R_CONF_LIB ; /* 14 */
272 alias ERR_LIB_CRYPTO ERR_R_CRYPTO_LIB ; /* 15 */
273 alias ERR_LIB_EC ERR_R_EC_LIB ; /* 16 */
274 alias ERR_LIB_SSL ERR_R_SSL_LIB ; /* 20 */
275 alias ERR_LIB_BIO ERR_R_BIO_LIB ; /* 32 */
276 alias ERR_LIB_PKCS7 ERR_R_PKCS7_LIB ; /* 33 */
277 alias ERR_LIB_X509V3 ERR_R_X509V3_LIB ; /* 34 */
278 alias ERR_LIB_PKCS12 ERR_R_PKCS12_LIB ; /* 35 */
279 alias ERR_LIB_RAND ERR_R_RAND_LIB ; /* 36 */
280 alias ERR_LIB_DSO ERR_R_DSO_LIB ; /* 37 */
281 alias ERR_LIB_ENGINE ERR_R_ENGINE_LIB ; /* 38 */
282 alias ERR_LIB_OCSP ERR_R_OCSP_LIB ; /* 39 */
283 alias ERR_LIB_UI ERR_R_UI_LIB ; /* 40 */
284 alias ERR_LIB_COMP ERR_R_COMP_LIB ; /* 41 */
285 alias ERR_LIB_ECDSA ERR_R_ECDSA_LIB ; /* 42 */
286 alias ERR_LIB_ECDH ERR_R_ECDH_LIB ; /* 43 */
287 alias ERR_LIB_STORE ERR_R_STORE_LIB ; /* 44 */
288 alias ERR_LIB_TS ERR_R_TS_LIB ; /* 45 */
289 
290 enum ERR_R_NESTED_ASN1_ERROR = 58;
291 enum ERR_R_BAD_ASN1_OBJECT_HEADER = 59;
292 enum ERR_R_BAD_GET_ASN1_OBJECT_CALL = 60;
293 enum ERR_R_EXPECTING_AN_ASN1_SEQUENCE = 61;
294 enum ERR_R_ASN1_LENGTH_MISMATCH = 62;
295 enum ERR_R_MISSING_ASN1_EOS = 63;
296 
297 /* fatal error */
298 enum ERR_R_FATAL = 64;
299 enum ERR_R_MALLOC_FAILURE = (1|ERR_R_FATAL);
300 enum ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED = (2|ERR_R_FATAL);
301 enum ERR_R_PASSED_NULL_PARAMETER = (3|ERR_R_FATAL);
302 enum ERR_R_INTERNAL_ERROR = (4|ERR_R_FATAL);
303 enum ERR_R_DISABLED = (5|ERR_R_FATAL);
304 
305 /* 99 is the maximum possible ERR_R_... code, higher values
306  * are reserved for the individual libraries */
307 
308 
309 struct ERR_string_data_st {
310 	c_ulong error;
311 	const(char)* string;
312 	}
313 alias ERR_string_data_st ERR_STRING_DATA;
314 
315 static if (OPENSSL_VERSION_BEFORE(3, 0, 0))
316 {
317 	void ERR_put_error(int lib, int func,int reason,const(char)* file,int line);
318 	alias ERR_PUT_error = ERR_put_error;
319 }
320 else
321 {
322 	// New Error API
323 
324 	// 12 lines and some on an 80 column terminal
325 	enum ERR_MAX_DATA_SIZE = 1024;
326 
327 	/* Building blocks */
328 	void ERR_new();
329 	void ERR_set_debug(const(char)* file, int line, const(char)* func);
330 	void ERR_set_error(int lib, int reason, const(char)* fmt, ...);
331 	void ERR_vset_error(int lib, int reason, const(char)* fmt, va_list args);
332 
333 	// Due to the API of those macro, we are forced to use CT arguments for FILE/LINE/FUNC
334 	// This is not ideal as it creates lots of template instantiations
335 	// Prefer using individual functions.
336 	auto ERR_raise (string file = __FILE__, int line = __LINE__, string func = __FUNCTION__)
337 		(int lib, int reason)
338 	{
339 		return ERR_raise_data!(file, line, func)(lib, reason, null);
340 	}
341 
342 	auto ERR_raise_data (string file = __FILE__, int line = __LINE__, string func = __FUNCTION__)
343 		(int lib, int reason, const(char)* fmt, ...)
344 	{
345 		ERR_new();
346 		ERR_set_debug(file.ptr, line, func.ptr);
347 		ERR_set_error(lib, reason, fmt);
348 	}
349 
350 	// Deprecated in v3.0.0 and re-implemented as macro
351 	auto ERR_put_error () (int lib, int func, int reason, const(char)* file, int line)
352 	{
353 		ERR_new();
354 		ERR_set_debug(file, line, null);
355 		ERR_set_error(lib, reason, null);
356 	}
357 	alias ERR_PUT_error = ERR_put_error;
358 }
359 
360 void ERR_set_error_data(char* data,int flags);
361 
362 c_ulong ERR_get_error();
363 c_ulong ERR_get_error_line(const(char)** file,int* line);
364 c_ulong ERR_get_error_line_data(const(char)** file,int* line,
365 				      const(char)** data, int* flags);
366 c_ulong ERR_peek_error();
367 c_ulong ERR_peek_error_line(const(char)** file,int* line);
368 c_ulong ERR_peek_error_line_data(const(char)** file,int* line,
369 				       const(char)** data,int* flags);
370 c_ulong ERR_peek_last_error();
371 c_ulong ERR_peek_last_error_line(const(char)** file,int* line);
372 c_ulong ERR_peek_last_error_line_data(const(char)** file,int* line,
373 				       const(char)** data,int* flags);
374 void ERR_clear_error();
375 char* ERR_error_string(c_ulong e,char* buf);
376 void ERR_error_string_n(c_ulong e, char* buf, size_t len);
377 const(char)* ERR_lib_error_string(c_ulong e);
378 const(char)* ERR_func_error_string(c_ulong e);
379 const(char)* ERR_reason_error_string(c_ulong e);
380 void ERR_print_errors_cb(ExternC!(int function(const(char)* str, size_t len, void* u)) cb,
381 			 void* u);
382 version(OPENSSL_NO_FP_API) {} else {
383 void ERR_print_errors_fp(FILE* fp);
384 }
385 version(OPENSSL_NO_BIO) {} else {
386 void ERR_print_errors(BIO* bp);
387 }
388 void ERR_add_error_data(int num, ...);
389 void ERR_add_error_vdata(int num, va_list args);
390 static if (OPENSSL_VERSION_AT_LEAST(3, 0, 0))
391 {
392 	void ERR_add_error_txt(const(char)* sepr, const(char)* txt);
393 	void ERR_add_error_mem_bio(const(char)* sep, BIO* bio);
394 }
395 void ERR_load_strings(int lib,ERR_STRING_DATA[] str);
396 void ERR_unload_strings(int lib,ERR_STRING_DATA[] str);
397 void ERR_load_ERR_strings();
398 void ERR_load_crypto_strings();
399 void ERR_free_strings();
400 
401 void ERR_remove_thread_state(const(CRYPTO_THREADID)* tid);
402 version(OPENSSL_NO_DEPRECATED) {} else {
403 void ERR_remove_state(c_ulong pid); /* if zero we look it up */
404 }
405 ERR_STATE* ERR_get_state();
406 
407 version(OPENSSL_NO_LHASH) {} else {
408 LHASH_OF!(ERR_STRING_DATA) *ERR_get_string_table();
409 LHASH_OF!(ERR_STATE) *ERR_get_err_state_table();
410 void ERR_release_err_state_table(LHASH_OF!(ERR_STATE) **hash);
411 }
412 
413 int ERR_get_next_error_library();
414 
415 int ERR_set_mark();
416 int ERR_pop_to_mark();
417 
418 /* Already defined in types.h */
419 /* typedef st_ERR_FNS ERR_FNS; */
420 /* An application can use this function and provide the return value to loaded
421  * modules that should use the application's ERR state/functionality */
422 const(ERR_FNS)* ERR_get_implementation();
423 /* A loaded module should call this function prior to any ERR operations using
424  * the application's "ERR_FNS". */
425 int ERR_set_implementation(const(ERR_FNS)* fns);