summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/err/err.h
diff options
context:
space:
mode:
authorbeck <>2002-05-15 02:29:21 +0000
committerbeck <>2002-05-15 02:29:21 +0000
commitb64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch)
treefa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/err/err.h
parente471e1ea98d673597b182ea85f29e30c97cd08b5 (diff)
downloadopenbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/err/err.h')
-rw-r--r--src/lib/libcrypto/err/err.h183
1 files changed, 101 insertions, 82 deletions
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index 7388a4a937..cc9bb649ea 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -59,15 +59,15 @@
59#ifndef HEADER_ERR_H 59#ifndef HEADER_ERR_H
60#define HEADER_ERR_H 60#define HEADER_ERR_H
61 61
62#ifndef NO_FP_API 62#ifndef OPENSSL_NO_FP_API
63#include <stdio.h> 63#include <stdio.h>
64#include <stdlib.h> 64#include <stdlib.h>
65#endif 65#endif
66 66
67#ifndef NO_BIO 67#ifndef OPENSSL_NO_BIO
68#include <openssl/bio.h> 68#include <openssl/bio.h>
69#endif 69#endif
70#ifndef NO_LHASH 70#ifndef OPENSSL_NO_LHASH
71#include <openssl/lhash.h> 71#include <openssl/lhash.h>
72#endif 72#endif
73 73
@@ -75,13 +75,7 @@
75extern "C" { 75extern "C" {
76#endif 76#endif
77 77
78/* The following is a bit of a trick to help the object files only contain 78#ifndef OPENSSL_NO_ERR
79 * the 'name of the file' string once. Since 'err.h' is protected by the
80 * HEADER_ERR_H stuff, this should be included only once per file. */
81
82#define ERR_file_name __FILE__
83
84#ifndef NO_ERR
85#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) 79#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e)
86#else 80#else
87#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) 81#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0)
@@ -116,16 +110,17 @@ typedef struct err_state_st
116#define ERR_LIB_PEM 9 110#define ERR_LIB_PEM 9
117#define ERR_LIB_DSA 10 111#define ERR_LIB_DSA 10
118#define ERR_LIB_X509 11 112#define ERR_LIB_X509 11
119#define ERR_LIB_METH 12 113/* #define ERR_LIB_METH 12 */
120#define ERR_LIB_ASN1 13 114#define ERR_LIB_ASN1 13
121#define ERR_LIB_CONF 14 115#define ERR_LIB_CONF 14
122#define ERR_LIB_CRYPTO 15 116#define ERR_LIB_CRYPTO 15
117#define ERR_LIB_EC 16
123#define ERR_LIB_SSL 20 118#define ERR_LIB_SSL 20
124#define ERR_LIB_SSL23 21 119/* #define ERR_LIB_SSL23 21 */
125#define ERR_LIB_SSL2 22 120/* #define ERR_LIB_SSL2 22 */
126#define ERR_LIB_SSL3 23 121/* #define ERR_LIB_SSL3 23 */
127#define ERR_LIB_RSAREF 30 122/* #define ERR_LIB_RSAREF 30 */
128#define ERR_LIB_PROXY 31 123/* #define ERR_LIB_PROXY 31 */
129#define ERR_LIB_BIO 32 124#define ERR_LIB_BIO 32
130#define ERR_LIB_PKCS7 33 125#define ERR_LIB_PKCS7 33
131#define ERR_LIB_X509V3 34 126#define ERR_LIB_X509V3 34
@@ -133,36 +128,37 @@ typedef struct err_state_st
133#define ERR_LIB_RAND 36 128#define ERR_LIB_RAND 36
134#define ERR_LIB_DSO 37 129#define ERR_LIB_DSO 37
135#define ERR_LIB_ENGINE 38 130#define ERR_LIB_ENGINE 38
131#define ERR_LIB_OCSP 39
132#define ERR_LIB_UI 40
133#define ERR_LIB_COMP 41
136 134
137#define ERR_LIB_USER 128 135#define ERR_LIB_USER 128
138 136
139#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),ERR_file_name,__LINE__) 137#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
140#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),ERR_file_name,__LINE__) 138#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
141#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),ERR_file_name,__LINE__) 139#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
142#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),ERR_file_name,__LINE__) 140#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
143#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),ERR_file_name,__LINE__) 141#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
144#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),ERR_file_name,__LINE__) 142#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
145#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),ERR_file_name,__LINE__) 143#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
146#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),ERR_file_name,__LINE__) 144#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
147#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),ERR_file_name,__LINE__) 145#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
148#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),ERR_file_name,__LINE__) 146#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
149#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),ERR_file_name,__LINE__) 147#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
150#define METHerr(f,r) ERR_PUT_error(ERR_LIB_METH,(f),(r),ERR_file_name,__LINE__) 148#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
151#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),ERR_file_name,__LINE__) 149#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
152#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),ERR_file_name,__LINE__) 150#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
153#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),ERR_file_name,__LINE__) 151#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
154#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),ERR_file_name,__LINE__) 152#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
155#define SSL23err(f,r) ERR_PUT_error(ERR_LIB_SSL23,(f),(r),ERR_file_name,__LINE__) 153#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
156#define SSL2err(f,r) ERR_PUT_error(ERR_LIB_SSL2,(f),(r),ERR_file_name,__LINE__) 154#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
157#define SSL3err(f,r) ERR_PUT_error(ERR_LIB_SSL3,(f),(r),ERR_file_name,__LINE__) 155#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
158#define RSAREFerr(f,r) ERR_PUT_error(ERR_LIB_RSAREF,(f),(r),ERR_file_name,__LINE__) 156#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
159#define PROXYerr(f,r) ERR_PUT_error(ERR_LIB_PROXY,(f),(r),ERR_file_name,__LINE__) 157#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
160#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),ERR_file_name,__LINE__) 158#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
161#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),ERR_file_name,__LINE__) 159#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
162#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),ERR_file_name,__LINE__) 160#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
163#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),ERR_file_name,__LINE__) 161#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
164#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),ERR_file_name,__LINE__)
165#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),ERR_file_name,__LINE__)
166 162
167/* Borland C seems too stupid to be able to shift and do longs in 163/* Borland C seems too stupid to be able to shift and do longs in
168 * the pre-processor :-( */ 164 * the pre-processor :-( */
@@ -174,6 +170,7 @@ typedef struct err_state_st
174#define ERR_GET_REASON(l) (int)((l)&0xfffL) 170#define ERR_GET_REASON(l) (int)((l)&0xfffL)
175#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL) 171#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL)
176 172
173
177/* OS functions */ 174/* OS functions */
178#define SYS_F_FOPEN 1 175#define SYS_F_FOPEN 1
179#define SYS_F_CONNECT 2 176#define SYS_F_CONNECT 2
@@ -186,44 +183,51 @@ typedef struct err_state_st
186#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ 183#define SYS_F_WSASTARTUP 9 /* Winsock stuff */
187#define SYS_F_OPENDIR 10 184#define SYS_F_OPENDIR 10
188 185
189#define ERR_R_FATAL 32 186
190/* reasons */ 187/* reasons */
191#define ERR_R_SYS_LIB ERR_LIB_SYS 188#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */
192#define ERR_R_BN_LIB ERR_LIB_BN 189#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */
193#define ERR_R_RSA_LIB ERR_LIB_RSA 190#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */
194#define ERR_R_DSA_LIB ERR_LIB_DSA 191#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */
195#define ERR_R_DH_LIB ERR_LIB_DH 192#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */
196#define ERR_R_EVP_LIB ERR_LIB_EVP 193#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */
197#define ERR_R_BUF_LIB ERR_LIB_BUF 194#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */
198#define ERR_R_BIO_LIB ERR_LIB_BIO 195#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */
199#define ERR_R_OBJ_LIB ERR_LIB_OBJ 196#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */
200#define ERR_R_PEM_LIB ERR_LIB_PEM 197#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */
201#define ERR_R_X509_LIB ERR_LIB_X509 198#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */
202#define ERR_R_METH_LIB ERR_LIB_METH 199#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */
203#define ERR_R_ASN1_LIB ERR_LIB_ASN1 200#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */
204#define ERR_R_CONF_LIB ERR_LIB_CONF 201#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */
205#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO 202#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */
206#define ERR_R_SSL_LIB ERR_LIB_SSL 203#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */
207#define ERR_R_SSL23_LIB ERR_LIB_SSL23 204#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */
208#define ERR_R_SSL2_LIB ERR_LIB_SSL2 205#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */
209#define ERR_R_SSL3_LIB ERR_LIB_SSL3 206#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */
210#define ERR_R_PROXY_LIB ERR_LIB_PROXY 207#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */
211#define ERR_R_BIO_LIB ERR_LIB_BIO 208#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */
212#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 209#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */
213#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 210#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */
214#define ERR_R_DSO_LIB ERR_LIB_DSO 211#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */
215#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE 212#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */
213
214#define ERR_R_NESTED_ASN1_ERROR 58
215#define ERR_R_BAD_ASN1_OBJECT_HEADER 59
216#define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60
217#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61
218#define ERR_R_ASN1_LENGTH_MISMATCH 62
219#define ERR_R_MISSING_ASN1_EOS 63
216 220
217/* fatal error */ 221/* fatal error */
222#define ERR_R_FATAL 64
218#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) 223#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
219#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) 224#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
220#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) 225#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
221#define ERR_R_NESTED_ASN1_ERROR (4) 226#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
222#define ERR_R_BAD_ASN1_OBJECT_HEADER (5) 227
223#define ERR_R_BAD_GET_ASN1_OBJECT_CALL (6) 228/* 99 is the maximum possible ERR_R_... code, higher values
224#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE (7) 229 * are reserved for the individual libraries */
225#define ERR_R_ASN1_LENGTH_MISMATCH (8) 230
226#define ERR_R_MISSING_ASN1_EOS (9)
227 231
228typedef struct ERR_string_data_st 232typedef struct ERR_string_data_st
229 { 233 {
@@ -234,28 +238,35 @@ typedef struct ERR_string_data_st
234void ERR_put_error(int lib, int func,int reason,const char *file,int line); 238void ERR_put_error(int lib, int func,int reason,const char *file,int line);
235void ERR_set_error_data(char *data,int flags); 239void ERR_set_error_data(char *data,int flags);
236 240
237unsigned long ERR_get_error(void ); 241unsigned long ERR_get_error(void);
238unsigned long ERR_get_error_line(const char **file,int *line); 242unsigned long ERR_get_error_line(const char **file,int *line);
239unsigned long ERR_get_error_line_data(const char **file,int *line, 243unsigned long ERR_get_error_line_data(const char **file,int *line,
240 const char **data, int *flags); 244 const char **data, int *flags);
241unsigned long ERR_peek_error(void ); 245unsigned long ERR_peek_error(void);
242unsigned long ERR_peek_error_line(const char **file,int *line); 246unsigned long ERR_peek_error_line(const char **file,int *line);
243unsigned long ERR_peek_error_line_data(const char **file,int *line, 247unsigned long ERR_peek_error_line_data(const char **file,int *line,
244 const char **data,int *flags); 248 const char **data,int *flags);
249unsigned long ERR_peek_last_error(void);
250unsigned long ERR_peek_last_error_line(const char **file,int *line);
251unsigned long ERR_peek_last_error_line_data(const char **file,int *line,
252 const char **data,int *flags);
245void ERR_clear_error(void ); 253void ERR_clear_error(void );
246char *ERR_error_string(unsigned long e,char *buf); 254char *ERR_error_string(unsigned long e,char *buf);
247void ERR_error_string_n(unsigned long e, char *buf, size_t len); 255void ERR_error_string_n(unsigned long e, char *buf, size_t len);
248const char *ERR_lib_error_string(unsigned long e); 256const char *ERR_lib_error_string(unsigned long e);
249const char *ERR_func_error_string(unsigned long e); 257const char *ERR_func_error_string(unsigned long e);
250const char *ERR_reason_error_string(unsigned long e); 258const char *ERR_reason_error_string(unsigned long e);
251#ifndef NO_FP_API 259void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
260 void *u);
261#ifndef OPENSSL_NO_FP_API
252void ERR_print_errors_fp(FILE *fp); 262void ERR_print_errors_fp(FILE *fp);
253#endif 263#endif
254#ifndef NO_BIO 264#ifndef OPENSSL_NO_BIO
255void ERR_print_errors(BIO *bp); 265void ERR_print_errors(BIO *bp);
256void ERR_add_error_data(int num, ...); 266void ERR_add_error_data(int num, ...);
257#endif 267#endif
258void ERR_load_strings(int lib,ERR_STRING_DATA str[]); 268void ERR_load_strings(int lib,ERR_STRING_DATA str[]);
269void ERR_unload_strings(int lib,ERR_STRING_DATA str[]);
259void ERR_load_ERR_strings(void); 270void ERR_load_ERR_strings(void);
260void ERR_load_crypto_strings(void); 271void ERR_load_crypto_strings(void);
261void ERR_free_strings(void); 272void ERR_free_strings(void);
@@ -263,14 +274,22 @@ void ERR_free_strings(void);
263void ERR_remove_state(unsigned long pid); /* if zero we look it up */ 274void ERR_remove_state(unsigned long pid); /* if zero we look it up */
264ERR_STATE *ERR_get_state(void); 275ERR_STATE *ERR_get_state(void);
265 276
266#ifndef NO_LHASH 277#ifndef OPENSSL_NO_LHASH
267LHASH *ERR_get_string_table(void); 278LHASH *ERR_get_string_table(void);
268LHASH *ERR_get_err_state_table(void); /* even less thread-safe than 279LHASH *ERR_get_err_state_table(void);
269 * ERR_get_string_table :-) */
270#endif 280#endif
271 281
272int ERR_get_next_error_library(void); 282int ERR_get_next_error_library(void);
273 283
284/* This opaque type encapsulates the low-level error-state functions */
285typedef struct st_ERR_FNS ERR_FNS;
286/* An application can use this function and provide the return value to loaded
287 * modules that should use the application's ERR state/functionality */
288const ERR_FNS *ERR_get_implementation(void);
289/* A loaded module should call this function prior to any ERR operations using
290 * the application's "ERR_FNS". */
291int ERR_set_implementation(const ERR_FNS *fns);
292
274#ifdef __cplusplus 293#ifdef __cplusplus
275} 294}
276#endif 295#endif