155714Skris/* crypto/err/err.h */
255714Skris/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
355714Skris * All rights reserved.
455714Skris *
555714Skris * This package is an SSL implementation written
655714Skris * by Eric Young (eay@cryptsoft.com).
755714Skris * The implementation was written so as to conform with Netscapes SSL.
855714Skris *
955714Skris * This library is free for commercial and non-commercial use as long as
1055714Skris * the following conditions are aheared to.  The following conditions
1155714Skris * apply to all code found in this distribution, be it the RC4, RSA,
1255714Skris * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
1355714Skris * included with this distribution is covered by the same copyright terms
1455714Skris * except that the holder is Tim Hudson (tjh@cryptsoft.com).
1555714Skris *
1655714Skris * Copyright remains Eric Young's, and as such any Copyright notices in
1755714Skris * the code are not to be removed.
1855714Skris * If this package is used in a product, Eric Young should be given attribution
1955714Skris * as the author of the parts of the library used.
2055714Skris * This can be in the form of a textual message at program startup or
2155714Skris * in documentation (online or textual) provided with the package.
2255714Skris *
2355714Skris * Redistribution and use in source and binary forms, with or without
2455714Skris * modification, are permitted provided that the following conditions
2555714Skris * are met:
2655714Skris * 1. Redistributions of source code must retain the copyright
2755714Skris *    notice, this list of conditions and the following disclaimer.
2855714Skris * 2. Redistributions in binary form must reproduce the above copyright
2955714Skris *    notice, this list of conditions and the following disclaimer in the
3055714Skris *    documentation and/or other materials provided with the distribution.
3155714Skris * 3. All advertising materials mentioning features or use of this software
3255714Skris *    must display the following acknowledgement:
3355714Skris *    "This product includes cryptographic software written by
3455714Skris *     Eric Young (eay@cryptsoft.com)"
3555714Skris *    The word 'cryptographic' can be left out if the rouines from the library
3655714Skris *    being used are not cryptographic related :-).
3755714Skris * 4. If you include any Windows specific code (or a derivative thereof) from
3855714Skris *    the apps directory (application code) you must include an acknowledgement:
3955714Skris *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
4055714Skris *
4155714Skris * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
4255714Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4355714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4455714Skris * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
4555714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4655714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4755714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4855714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4955714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5055714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5155714Skris * SUCH DAMAGE.
5255714Skris *
5355714Skris * The licence and distribution terms for any publically available version or
5455714Skris * derivative of this code cannot be changed.  i.e. this code cannot simply be
5555714Skris * copied and put under another distribution licence
5655714Skris * [including the GNU Public Licence.]
5755714Skris */
58238405Sjkim/* ====================================================================
59238405Sjkim * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
60238405Sjkim *
61238405Sjkim * Redistribution and use in source and binary forms, with or without
62238405Sjkim * modification, are permitted provided that the following conditions
63238405Sjkim * are met:
64238405Sjkim *
65238405Sjkim * 1. Redistributions of source code must retain the above copyright
66238405Sjkim *    notice, this list of conditions and the following disclaimer.
67238405Sjkim *
68238405Sjkim * 2. Redistributions in binary form must reproduce the above copyright
69238405Sjkim *    notice, this list of conditions and the following disclaimer in
70238405Sjkim *    the documentation and/or other materials provided with the
71238405Sjkim *    distribution.
72238405Sjkim *
73238405Sjkim * 3. All advertising materials mentioning features or use of this
74238405Sjkim *    software must display the following acknowledgment:
75238405Sjkim *    "This product includes software developed by the OpenSSL Project
76238405Sjkim *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77238405Sjkim *
78238405Sjkim * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79238405Sjkim *    endorse or promote products derived from this software without
80238405Sjkim *    prior written permission. For written permission, please contact
81238405Sjkim *    openssl-core@openssl.org.
82238405Sjkim *
83238405Sjkim * 5. Products derived from this software may not be called "OpenSSL"
84238405Sjkim *    nor may "OpenSSL" appear in their names without prior written
85238405Sjkim *    permission of the OpenSSL Project.
86238405Sjkim *
87238405Sjkim * 6. Redistributions of any form whatsoever must retain the following
88238405Sjkim *    acknowledgment:
89238405Sjkim *    "This product includes software developed by the OpenSSL Project
90238405Sjkim *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91238405Sjkim *
92238405Sjkim * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93238405Sjkim * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94238405Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95238405Sjkim * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
96238405Sjkim * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97238405Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98238405Sjkim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99238405Sjkim * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100238405Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101238405Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102238405Sjkim * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103238405Sjkim * OF THE POSSIBILITY OF SUCH DAMAGE.
104238405Sjkim * ====================================================================
105238405Sjkim *
106238405Sjkim * This product includes cryptographic software written by Eric Young
107238405Sjkim * (eay@cryptsoft.com).  This product includes software written by Tim
108238405Sjkim * Hudson (tjh@cryptsoft.com).
109238405Sjkim *
110238405Sjkim */
11155714Skris
11255714Skris#ifndef HEADER_ERR_H
11355714Skris#define HEADER_ERR_H
11455714Skris
115160814Ssimon#include <openssl/e_os2.h>
116160814Ssimon
117109998Smarkm#ifndef OPENSSL_NO_FP_API
11868651Skris#include <stdio.h>
11968651Skris#include <stdlib.h>
12068651Skris#endif
12168651Skris
122160814Ssimon#include <openssl/ossl_typ.h>
123109998Smarkm#ifndef OPENSSL_NO_BIO
12468651Skris#include <openssl/bio.h>
12568651Skris#endif
126109998Smarkm#ifndef OPENSSL_NO_LHASH
12768651Skris#include <openssl/lhash.h>
12868651Skris#endif
12968651Skris
13055714Skris#ifdef	__cplusplus
13155714Skrisextern "C" {
13255714Skris#endif
13355714Skris
134109998Smarkm#ifndef OPENSSL_NO_ERR
13555714Skris#define ERR_PUT_error(a,b,c,d,e)	ERR_put_error(a,b,c,d,e)
13655714Skris#else
13755714Skris#define ERR_PUT_error(a,b,c,d,e)	ERR_put_error(a,b,c,NULL,0)
13855714Skris#endif
13955714Skris
14055714Skris#include <errno.h>
14155714Skris
14255714Skris#define ERR_TXT_MALLOCED	0x01
14355714Skris#define ERR_TXT_STRING		0x02
14455714Skris
145160814Ssimon#define ERR_FLAG_MARK		0x01
146160814Ssimon
14755714Skris#define ERR_NUM_ERRORS	16
14855714Skristypedef struct err_state_st
14955714Skris	{
150238405Sjkim	CRYPTO_THREADID tid;
151160814Ssimon	int err_flags[ERR_NUM_ERRORS];
15255714Skris	unsigned long err_buffer[ERR_NUM_ERRORS];
15355714Skris	char *err_data[ERR_NUM_ERRORS];
15455714Skris	int err_data_flags[ERR_NUM_ERRORS];
15555714Skris	const char *err_file[ERR_NUM_ERRORS];
15655714Skris	int err_line[ERR_NUM_ERRORS];
15755714Skris	int top,bottom;
15855714Skris	} ERR_STATE;
15955714Skris
16055714Skris/* library */
16155714Skris#define ERR_LIB_NONE		1
16255714Skris#define ERR_LIB_SYS		2
16355714Skris#define ERR_LIB_BN		3
16455714Skris#define ERR_LIB_RSA		4
16555714Skris#define ERR_LIB_DH		5
16655714Skris#define ERR_LIB_EVP		6
16755714Skris#define ERR_LIB_BUF		7
16855714Skris#define ERR_LIB_OBJ		8
16955714Skris#define ERR_LIB_PEM		9
17055714Skris#define ERR_LIB_DSA		10
17155714Skris#define ERR_LIB_X509		11
172109998Smarkm/* #define ERR_LIB_METH         12 */
17355714Skris#define ERR_LIB_ASN1		13
17455714Skris#define ERR_LIB_CONF		14
17555714Skris#define ERR_LIB_CRYPTO		15
176109998Smarkm#define ERR_LIB_EC		16
17755714Skris#define ERR_LIB_SSL		20
178109998Smarkm/* #define ERR_LIB_SSL23        21 */
179109998Smarkm/* #define ERR_LIB_SSL2         22 */
180109998Smarkm/* #define ERR_LIB_SSL3         23 */
181109998Smarkm/* #define ERR_LIB_RSAREF       30 */
182109998Smarkm/* #define ERR_LIB_PROXY        31 */
18355714Skris#define ERR_LIB_BIO		32
18455714Skris#define ERR_LIB_PKCS7		33
18555714Skris#define ERR_LIB_X509V3		34
18655714Skris#define ERR_LIB_PKCS12		35
18759191Skris#define ERR_LIB_RAND		36
18868651Skris#define ERR_LIB_DSO		37
189109998Smarkm#define ERR_LIB_ENGINE		38
190109998Smarkm#define ERR_LIB_OCSP            39
191109998Smarkm#define ERR_LIB_UI              40
192109998Smarkm#define ERR_LIB_COMP            41
193160814Ssimon#define ERR_LIB_ECDSA		42
194160814Ssimon#define ERR_LIB_ECDH		43
195160814Ssimon#define ERR_LIB_STORE           44
196194206Ssimon#define ERR_LIB_FIPS		45
197194206Ssimon#define ERR_LIB_CMS		46
198238405Sjkim#define ERR_LIB_TS		47
199238405Sjkim#define ERR_LIB_HMAC		48
200238405Sjkim#define ERR_LIB_JPAKE		49
20155714Skris
20255714Skris#define ERR_LIB_USER		128
20355714Skris
204109998Smarkm#define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
205109998Smarkm#define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
206109998Smarkm#define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
207109998Smarkm#define DHerr(f,r)   ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
208109998Smarkm#define EVPerr(f,r)  ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
209109998Smarkm#define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
210109998Smarkm#define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
211109998Smarkm#define PEMerr(f,r)  ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
212109998Smarkm#define DSAerr(f,r)  ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
213109998Smarkm#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
214109998Smarkm#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
215109998Smarkm#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
216109998Smarkm#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
217109998Smarkm#define ECerr(f,r)   ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
218109998Smarkm#define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
219109998Smarkm#define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
220109998Smarkm#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
221109998Smarkm#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
222109998Smarkm#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
223109998Smarkm#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
224109998Smarkm#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
225109998Smarkm#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
226109998Smarkm#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
227109998Smarkm#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
228109998Smarkm#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
229160814Ssimon#define ECDSAerr(f,r)  ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
230160814Ssimon#define ECDHerr(f,r)  ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
231160814Ssimon#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
232194206Ssimon#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
233194206Ssimon#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
234238405Sjkim#define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
235238405Sjkim#define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
236194206Ssimon#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
23755714Skris
23855714Skris/* Borland C seems too stupid to be able to shift and do longs in
23955714Skris * the pre-processor :-( */
24055714Skris#define ERR_PACK(l,f,r)		(((((unsigned long)l)&0xffL)*0x1000000)| \
24155714Skris				((((unsigned long)f)&0xfffL)*0x1000)| \
24255714Skris				((((unsigned long)r)&0xfffL)))
24355714Skris#define ERR_GET_LIB(l)		(int)((((unsigned long)l)>>24L)&0xffL)
24455714Skris#define ERR_GET_FUNC(l)		(int)((((unsigned long)l)>>12L)&0xfffL)
24555714Skris#define ERR_GET_REASON(l)	(int)((l)&0xfffL)
24655714Skris#define ERR_FATAL_ERROR(l)	(int)((l)&ERR_R_FATAL)
24755714Skris
248109998Smarkm
24959191Skris/* OS functions */
25055714Skris#define SYS_F_FOPEN		1
25155714Skris#define SYS_F_CONNECT		2
25255714Skris#define SYS_F_GETSERVBYNAME	3
25355714Skris#define SYS_F_SOCKET		4
25455714Skris#define SYS_F_IOCTLSOCKET	5
25555714Skris#define SYS_F_BIND		6
25655714Skris#define SYS_F_LISTEN		7
25755714Skris#define SYS_F_ACCEPT		8
25855714Skris#define SYS_F_WSASTARTUP	9 /* Winsock stuff */
25955714Skris#define SYS_F_OPENDIR		10
260109998Smarkm#define SYS_F_FREAD		11
26155714Skris
262109998Smarkm
26355714Skris/* reasons */
264109998Smarkm#define ERR_R_SYS_LIB	ERR_LIB_SYS       /* 2 */
265109998Smarkm#define ERR_R_BN_LIB	ERR_LIB_BN        /* 3 */
266109998Smarkm#define ERR_R_RSA_LIB	ERR_LIB_RSA       /* 4 */
267109998Smarkm#define ERR_R_DH_LIB	ERR_LIB_DH        /* 5 */
268109998Smarkm#define ERR_R_EVP_LIB	ERR_LIB_EVP       /* 6 */
269109998Smarkm#define ERR_R_BUF_LIB	ERR_LIB_BUF       /* 7 */
270109998Smarkm#define ERR_R_OBJ_LIB	ERR_LIB_OBJ       /* 8 */
271109998Smarkm#define ERR_R_PEM_LIB	ERR_LIB_PEM       /* 9 */
272109998Smarkm#define ERR_R_DSA_LIB	ERR_LIB_DSA      /* 10 */
273109998Smarkm#define ERR_R_X509_LIB	ERR_LIB_X509     /* 11 */
274109998Smarkm#define ERR_R_ASN1_LIB	ERR_LIB_ASN1     /* 13 */
275109998Smarkm#define ERR_R_CONF_LIB	ERR_LIB_CONF     /* 14 */
276109998Smarkm#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO  /* 15 */
277109998Smarkm#define ERR_R_EC_LIB	ERR_LIB_EC       /* 16 */
278109998Smarkm#define ERR_R_SSL_LIB	ERR_LIB_SSL      /* 20 */
279109998Smarkm#define ERR_R_BIO_LIB	ERR_LIB_BIO      /* 32 */
280109998Smarkm#define ERR_R_PKCS7_LIB	ERR_LIB_PKCS7    /* 33 */
281109998Smarkm#define ERR_R_X509V3_LIB ERR_LIB_X509V3  /* 34 */
282109998Smarkm#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12  /* 35 */
283109998Smarkm#define ERR_R_RAND_LIB	ERR_LIB_RAND     /* 36 */
284109998Smarkm#define ERR_R_DSO_LIB	ERR_LIB_DSO      /* 37 */
285109998Smarkm#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE  /* 38 */
286109998Smarkm#define ERR_R_OCSP_LIB  ERR_LIB_OCSP     /* 39 */
287109998Smarkm#define ERR_R_UI_LIB    ERR_LIB_UI       /* 40 */
288109998Smarkm#define ERR_R_COMP_LIB	ERR_LIB_COMP     /* 41 */
289160814Ssimon#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA	 /* 42 */
290160814Ssimon#define ERR_R_ECDH_LIB  ERR_LIB_ECDH	 /* 43 */
291160814Ssimon#define ERR_R_STORE_LIB ERR_LIB_STORE    /* 44 */
292238405Sjkim#define ERR_R_TS_LIB	ERR_LIB_TS       /* 45 */
29355714Skris
294109998Smarkm#define ERR_R_NESTED_ASN1_ERROR			58
295109998Smarkm#define ERR_R_BAD_ASN1_OBJECT_HEADER		59
296109998Smarkm#define ERR_R_BAD_GET_ASN1_OBJECT_CALL		60
297109998Smarkm#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE	61
298109998Smarkm#define ERR_R_ASN1_LENGTH_MISMATCH		62
299109998Smarkm#define ERR_R_MISSING_ASN1_EOS			63
300109998Smarkm
30155714Skris/* fatal error */
302109998Smarkm#define ERR_R_FATAL				64
30355714Skris#define	ERR_R_MALLOC_FAILURE			(1|ERR_R_FATAL)
30455714Skris#define	ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED	(2|ERR_R_FATAL)
30555714Skris#define	ERR_R_PASSED_NULL_PARAMETER		(3|ERR_R_FATAL)
306109998Smarkm#define	ERR_R_INTERNAL_ERROR			(4|ERR_R_FATAL)
307160814Ssimon#define	ERR_R_DISABLED				(5|ERR_R_FATAL)
30855714Skris
309109998Smarkm/* 99 is the maximum possible ERR_R_... code, higher values
310109998Smarkm * are reserved for the individual libraries */
311109998Smarkm
312109998Smarkm
31355714Skristypedef struct ERR_string_data_st
31455714Skris	{
31555714Skris	unsigned long error;
31655714Skris	const char *string;
31755714Skris	} ERR_STRING_DATA;
31855714Skris
31955714Skrisvoid ERR_put_error(int lib, int func,int reason,const char *file,int line);
32055714Skrisvoid ERR_set_error_data(char *data,int flags);
32155714Skris
322109998Smarkmunsigned long ERR_get_error(void);
32355714Skrisunsigned long ERR_get_error_line(const char **file,int *line);
32455714Skrisunsigned long ERR_get_error_line_data(const char **file,int *line,
32555714Skris				      const char **data, int *flags);
326109998Smarkmunsigned long ERR_peek_error(void);
32755714Skrisunsigned long ERR_peek_error_line(const char **file,int *line);
32855714Skrisunsigned long ERR_peek_error_line_data(const char **file,int *line,
32955714Skris				       const char **data,int *flags);
330109998Smarkmunsigned long ERR_peek_last_error(void);
331109998Smarkmunsigned long ERR_peek_last_error_line(const char **file,int *line);
332109998Smarkmunsigned long ERR_peek_last_error_line_data(const char **file,int *line,
333109998Smarkm				       const char **data,int *flags);
33455714Skrisvoid ERR_clear_error(void );
33555714Skrischar *ERR_error_string(unsigned long e,char *buf);
33668651Skrisvoid ERR_error_string_n(unsigned long e, char *buf, size_t len);
33755714Skrisconst char *ERR_lib_error_string(unsigned long e);
33855714Skrisconst char *ERR_func_error_string(unsigned long e);
33955714Skrisconst char *ERR_reason_error_string(unsigned long e);
340109998Smarkmvoid ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
341109998Smarkm			 void *u);
342109998Smarkm#ifndef OPENSSL_NO_FP_API
34355714Skrisvoid ERR_print_errors_fp(FILE *fp);
34455714Skris#endif
345109998Smarkm#ifndef OPENSSL_NO_BIO
34655714Skrisvoid ERR_print_errors(BIO *bp);
347238405Sjkim#endif
34855714Skrisvoid ERR_add_error_data(int num, ...);
349238405Sjkimvoid ERR_add_error_vdata(int num, va_list args);
35055714Skrisvoid ERR_load_strings(int lib,ERR_STRING_DATA str[]);
351109998Smarkmvoid ERR_unload_strings(int lib,ERR_STRING_DATA str[]);
35259191Skrisvoid ERR_load_ERR_strings(void);
35359191Skrisvoid ERR_load_crypto_strings(void);
35459191Skrisvoid ERR_free_strings(void);
35555714Skris
356238405Sjkimvoid ERR_remove_thread_state(const CRYPTO_THREADID *tid);
357238405Sjkim#ifndef OPENSSL_NO_DEPRECATED
35855714Skrisvoid ERR_remove_state(unsigned long pid); /* if zero we look it up */
359238405Sjkim#endif
36055714SkrisERR_STATE *ERR_get_state(void);
36155714Skris
362109998Smarkm#ifndef OPENSSL_NO_LHASH
363238405SjkimLHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
364238405SjkimLHASH_OF(ERR_STATE) *ERR_get_err_state_table(void);
365238405Sjkimvoid ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash);
36655714Skris#endif
36755714Skris
36868651Skrisint ERR_get_next_error_library(void);
36955714Skris
370160814Ssimonint ERR_set_mark(void);
371160814Ssimonint ERR_pop_to_mark(void);
372160814Ssimon
373160814Ssimon/* Already defined in ossl_typ.h */
374160814Ssimon/* typedef struct st_ERR_FNS ERR_FNS; */
375109998Smarkm/* An application can use this function and provide the return value to loaded
376109998Smarkm * modules that should use the application's ERR state/functionality */
377109998Smarkmconst ERR_FNS *ERR_get_implementation(void);
378109998Smarkm/* A loaded module should call this function prior to any ERR operations using
379109998Smarkm * the application's "ERR_FNS". */
380109998Smarkmint ERR_set_implementation(const ERR_FNS *fns);
381109998Smarkm
38255714Skris#ifdef	__cplusplus
38355714Skris}
38455714Skris#endif
38555714Skris
38655714Skris#endif
387