summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/err/err.h
diff options
context:
space:
mode:
authormarkus <>2002-09-05 12:51:50 +0000
committermarkus <>2002-09-05 12:51:50 +0000
commit15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch)
treebf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/err/err.h
parent027351f729b9e837200dae6e1520cda6577ab930 (diff)
downloadopenbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz
openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2
openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/err/err.h')
-rw-r--r--src/lib/libcrypto/err/err.h260
1 files changed, 135 insertions, 125 deletions
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index 75f931be11..cc9bb649ea 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -59,17 +59,23 @@
59#ifndef HEADER_ERR_H 59#ifndef HEADER_ERR_H
60#define HEADER_ERR_H 60#define HEADER_ERR_H
61 61
62#ifdef __cplusplus 62#ifndef OPENSSL_NO_FP_API
63extern "C" { 63#include <stdio.h>
64#include <stdlib.h>
64#endif 65#endif
65 66
66/* The following is a bit of a trick to help the object files only contain 67#ifndef OPENSSL_NO_BIO
67 * the 'name of the file' string once. Since 'err.h' is protected by the 68#include <openssl/bio.h>
68 * HEADER_ERR_H stuff, this should be included only once per file. */ 69#endif
70#ifndef OPENSSL_NO_LHASH
71#include <openssl/lhash.h>
72#endif
69 73
70#define ERR_file_name __FILE__ 74#ifdef __cplusplus
75extern "C" {
76#endif
71 77
72#ifndef NO_ERR 78#ifndef OPENSSL_NO_ERR
73#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)
74#else 80#else
75#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)
@@ -87,7 +93,7 @@ typedef struct err_state_st
87 unsigned long err_buffer[ERR_NUM_ERRORS]; 93 unsigned long err_buffer[ERR_NUM_ERRORS];
88 char *err_data[ERR_NUM_ERRORS]; 94 char *err_data[ERR_NUM_ERRORS];
89 int err_data_flags[ERR_NUM_ERRORS]; 95 int err_data_flags[ERR_NUM_ERRORS];
90 char *err_file[ERR_NUM_ERRORS]; 96 const char *err_file[ERR_NUM_ERRORS];
91 int err_line[ERR_NUM_ERRORS]; 97 int err_line[ERR_NUM_ERRORS];
92 int top,bottom; 98 int top,bottom;
93 } ERR_STATE; 99 } ERR_STATE;
@@ -104,43 +110,55 @@ typedef struct err_state_st
104#define ERR_LIB_PEM 9 110#define ERR_LIB_PEM 9
105#define ERR_LIB_DSA 10 111#define ERR_LIB_DSA 10
106#define ERR_LIB_X509 11 112#define ERR_LIB_X509 11
107#define ERR_LIB_METH 12 113/* #define ERR_LIB_METH 12 */
108#define ERR_LIB_ASN1 13 114#define ERR_LIB_ASN1 13
109#define ERR_LIB_CONF 14 115#define ERR_LIB_CONF 14
110#define ERR_LIB_CRYPTO 15 116#define ERR_LIB_CRYPTO 15
117#define ERR_LIB_EC 16
111#define ERR_LIB_SSL 20 118#define ERR_LIB_SSL 20
112#define ERR_LIB_SSL23 21 119/* #define ERR_LIB_SSL23 21 */
113#define ERR_LIB_SSL2 22 120/* #define ERR_LIB_SSL2 22 */
114#define ERR_LIB_SSL3 23 121/* #define ERR_LIB_SSL3 23 */
115#define ERR_LIB_RSAREF 30 122/* #define ERR_LIB_RSAREF 30 */
116#define ERR_LIB_PROXY 31 123/* #define ERR_LIB_PROXY 31 */
117#define ERR_LIB_BIO 32 124#define ERR_LIB_BIO 32
118#define ERR_LIB_PKCS7 33 125#define ERR_LIB_PKCS7 33
126#define ERR_LIB_X509V3 34
127#define ERR_LIB_PKCS12 35
128#define ERR_LIB_RAND 36
129#define ERR_LIB_DSO 37
130#define ERR_LIB_ENGINE 38
131#define ERR_LIB_OCSP 39
132#define ERR_LIB_UI 40
133#define ERR_LIB_COMP 41
119 134
120#define ERR_LIB_USER 128 135#define ERR_LIB_USER 128
121 136
122#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__)
123#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__)
124#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__)
125#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__)
126#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__)
127#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__)
128#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__)
129#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__)
130#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__)
131#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__)
132#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__)
133#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__)
134#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__)
135#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__)
136#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__)
137#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__)
138#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__)
139#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__)
140#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__)
141#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__)
142#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__)
143#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__)
159#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
160#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
161#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
144 162
145/* 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
146 * the pre-processor :-( */ 164 * the pre-processor :-( */
@@ -152,7 +170,8 @@ typedef struct err_state_st
152#define ERR_GET_REASON(l) (int)((l)&0xfffL) 170#define ERR_GET_REASON(l) (int)((l)&0xfffL)
153#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL) 171#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL)
154 172
155/* OS fuctions */ 173
174/* OS functions */
156#define SYS_F_FOPEN 1 175#define SYS_F_FOPEN 1
157#define SYS_F_CONNECT 2 176#define SYS_F_CONNECT 2
158#define SYS_F_GETSERVBYNAME 3 177#define SYS_F_GETSERVBYNAME 3
@@ -162,123 +181,114 @@ typedef struct err_state_st
162#define SYS_F_LISTEN 7 181#define SYS_F_LISTEN 7
163#define SYS_F_ACCEPT 8 182#define SYS_F_ACCEPT 8
164#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ 183#define SYS_F_WSASTARTUP 9 /* Winsock stuff */
184#define SYS_F_OPENDIR 10
185
165 186
166#define ERR_R_FATAL 32
167/* reasons */ 187/* reasons */
168#define ERR_R_SYS_LIB ERR_LIB_SYS 188#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */
169#define ERR_R_BN_LIB ERR_LIB_BN 189#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */
170#define ERR_R_RSA_LIB ERR_LIB_RSA 190#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */
171#define ERR_R_DSA_LIB ERR_LIB_DSA 191#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */
172#define ERR_R_DH_LIB ERR_LIB_DH 192#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */
173#define ERR_R_EVP_LIB ERR_LIB_EVP 193#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */
174#define ERR_R_BUF_LIB ERR_LIB_BUF 194#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */
175#define ERR_R_BIO_LIB ERR_LIB_BIO 195#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */
176#define ERR_R_OBJ_LIB ERR_LIB_OBJ 196#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */
177#define ERR_R_PEM_LIB ERR_LIB_PEM 197#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */
178#define ERR_R_X509_LIB ERR_LIB_X509 198#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */
179#define ERR_R_METH_LIB ERR_LIB_METH 199#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */
180#define ERR_R_ASN1_LIB ERR_LIB_ASN1 200#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */
181#define ERR_R_CONF_LIB ERR_LIB_CONF 201#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */
182#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO 202#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */
183#define ERR_R_SSL_LIB ERR_LIB_SSL 203#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */
184#define ERR_R_SSL23_LIB ERR_LIB_SSL23 204#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */
185#define ERR_R_SSL2_LIB ERR_LIB_SSL2 205#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */
186#define ERR_R_SSL3_LIB ERR_LIB_SSL3 206#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */
187#define ERR_R_PROXY_LIB ERR_LIB_PROXY 207#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */
188#define ERR_R_BIO_LIB ERR_LIB_BIO 208#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */
189#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 209#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */
210#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */
211#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */
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
190 220
191/* fatal error */ 221/* fatal error */
222#define ERR_R_FATAL 64
192#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) 223#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
193#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)
194#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) 225#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
226#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
227
228/* 99 is the maximum possible ERR_R_... code, higher values
229 * are reserved for the individual libraries */
230
195 231
196typedef struct ERR_string_data_st 232typedef struct ERR_string_data_st
197 { 233 {
198 unsigned long error; 234 unsigned long error;
199 char *string; 235 const char *string;
200 } ERR_STRING_DATA; 236 } ERR_STRING_DATA;
201 237
202#ifndef NOPROTO 238void ERR_put_error(int lib, int func,int reason,const char *file,int line);
203void ERR_put_error(int lib, int func,int reason,char *file,int line);
204void ERR_set_error_data(char *data,int flags); 239void ERR_set_error_data(char *data,int flags);
205 240
206unsigned long ERR_get_error(void ); 241unsigned long ERR_get_error(void);
207unsigned long ERR_get_error_line(char **file,int *line); 242unsigned long ERR_get_error_line(const char **file,int *line);
208unsigned long ERR_get_error_line_data(char **file,int *line, 243unsigned long ERR_get_error_line_data(const char **file,int *line,
209 char **data, int *flags); 244 const char **data, int *flags);
210unsigned long ERR_peek_error(void ); 245unsigned long ERR_peek_error(void);
211unsigned long ERR_peek_error_line(char **file,int *line); 246unsigned long ERR_peek_error_line(const char **file,int *line);
212unsigned long ERR_peek_error_line_data(char **file,int *line, 247unsigned long ERR_peek_error_line_data(const char **file,int *line,
213 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);
214void ERR_clear_error(void ); 253void ERR_clear_error(void );
215char *ERR_error_string(unsigned long e,char *buf); 254char *ERR_error_string(unsigned long e,char *buf);
216char *ERR_lib_error_string(unsigned long e); 255void ERR_error_string_n(unsigned long e, char *buf, size_t len);
217char *ERR_func_error_string(unsigned long e); 256const char *ERR_lib_error_string(unsigned long e);
218char *ERR_reason_error_string(unsigned long e); 257const char *ERR_func_error_string(unsigned long e);
219#ifndef NO_FP_API 258const char *ERR_reason_error_string(unsigned long e);
259void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
260 void *u);
261#ifndef OPENSSL_NO_FP_API
220void ERR_print_errors_fp(FILE *fp); 262void ERR_print_errors_fp(FILE *fp);
221#endif 263#endif
222#ifdef HEADER_BIO_H 264#ifndef OPENSSL_NO_BIO
223void ERR_print_errors(BIO *bp); 265void ERR_print_errors(BIO *bp);
224void ERR_add_error_data( VAR_PLIST( int, num ) ); 266void ERR_add_error_data(int num, ...);
225#endif 267#endif
226void ERR_load_strings(int lib,ERR_STRING_DATA str[]); 268void ERR_load_strings(int lib,ERR_STRING_DATA str[]);
227void ERR_load_ERR_strings(void ); 269void ERR_unload_strings(int lib,ERR_STRING_DATA str[]);
228void ERR_load_crypto_strings(void ); 270void ERR_load_ERR_strings(void);
229void ERR_free_strings(void ); 271void ERR_load_crypto_strings(void);
272void ERR_free_strings(void);
230 273
231void 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 */
232ERR_STATE *ERR_get_state(void); 275ERR_STATE *ERR_get_state(void);
233 276
234#ifdef HEADER_LHASH_H 277#ifndef OPENSSL_NO_LHASH
235LHASH *ERR_get_string_table(void ); 278LHASH *ERR_get_string_table(void);
236LHASH *ERR_get_err_state_table(void ); 279LHASH *ERR_get_err_state_table(void);
237#else
238char *ERR_get_string_table(void );
239char *ERR_get_err_state_table(void );
240#endif
241
242int ERR_get_next_error_library(void );
243
244#else
245
246void ERR_put_error();
247void ERR_set_error_data();
248
249unsigned long ERR_get_error();
250unsigned long ERR_get_error_line();
251unsigned long ERR_peek_error();
252unsigned long ERR_peek_error_line();
253void ERR_clear_error();
254char *ERR_error_string();
255char *ERR_lib_error_string();
256char *ERR_func_error_string();
257char *ERR_reason_error_string();
258#ifndef NO_FP_API
259void ERR_print_errors_fp();
260#endif
261void ERR_print_errors();
262void ERR_add_error_data();
263void ERR_load_strings();
264void ERR_load_ERR_strings();
265void ERR_load_crypto_strings();
266void ERR_free_strings();
267
268void ERR_remove_state();
269ERR_STATE *ERR_get_state();
270
271#ifdef HEADER_LHASH_H
272LHASH *ERR_get_string_table();
273LHASH *ERR_get_err_state_table();
274#else
275char *ERR_get_string_table();
276char *ERR_get_err_state_table();
277#endif 280#endif
278 281
279int ERR_get_next_error_library(); 282int ERR_get_next_error_library(void);
280 283
281#endif 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);
282 292
283#ifdef __cplusplus 293#ifdef __cplusplus
284} 294}