113 # define HEADER_ERR_H
115 # include <openssl/e_os2.h>
117 # ifndef OPENSSL_NO_FP_API
122 # include <openssl/ossl_typ.h>
123 # ifndef OPENSSL_NO_BIO
124 # include <openssl/bio.h>
126 # ifndef OPENSSL_NO_LHASH
127 # include <openssl/lhash.h>
134 # ifndef OPENSSL_NO_ERR
135 # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e)
137 # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0)
142 # define ERR_TXT_MALLOCED 0x01
143 # define ERR_TXT_STRING 0x02
145 # define ERR_FLAG_MARK 0x01
147 # define ERR_NUM_ERRORS 16
148 typedef struct err_state_st {
150 int err_flags[ERR_NUM_ERRORS];
151 unsigned long err_buffer[ERR_NUM_ERRORS];
152 char *err_data[ERR_NUM_ERRORS];
153 int err_data_flags[ERR_NUM_ERRORS];
154 const char *err_file[ERR_NUM_ERRORS];
155 int err_line[ERR_NUM_ERRORS];
160 # define ERR_LIB_NONE 1
161 # define ERR_LIB_SYS 2
162 # define ERR_LIB_BN 3
163 # define ERR_LIB_RSA 4
164 # define ERR_LIB_DH 5
165 # define ERR_LIB_EVP 6
166 # define ERR_LIB_BUF 7
167 # define ERR_LIB_OBJ 8
168 # define ERR_LIB_PEM 9
169 # define ERR_LIB_DSA 10
170 # define ERR_LIB_X509 11
172 # define ERR_LIB_ASN1 13
173 # define ERR_LIB_CONF 14
174 # define ERR_LIB_CRYPTO 15
175 # define ERR_LIB_EC 16
176 # define ERR_LIB_SSL 20
182 # define ERR_LIB_BIO 32
183 # define ERR_LIB_PKCS7 33
184 # define ERR_LIB_X509V3 34
185 # define ERR_LIB_PKCS12 35
186 # define ERR_LIB_RAND 36
187 # define ERR_LIB_DSO 37
188 # define ERR_LIB_ENGINE 38
189 # define ERR_LIB_OCSP 39
190 # define ERR_LIB_UI 40
191 # define ERR_LIB_COMP 41
192 # define ERR_LIB_ECDSA 42
193 # define ERR_LIB_ECDH 43
194 # define ERR_LIB_STORE 44
195 # define ERR_LIB_FIPS 45
196 # define ERR_LIB_CMS 46
197 # define ERR_LIB_TS 47
198 # define ERR_LIB_HMAC 48
199 # define ERR_LIB_JPAKE 49
201 # define ERR_LIB_USER 128
203 # define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
204 # define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
205 # define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
206 # define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
207 # define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
208 # define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
209 # define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
210 # define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
211 # define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
212 # define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
213 # define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
214 # define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
215 # define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
216 # define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
217 # define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
218 # define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
219 # define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
220 # define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
221 # define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
222 # define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
223 # define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
224 # define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
225 # define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
226 # define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
227 # define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
228 # define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
229 # define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
230 # define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
231 # define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
232 # define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
233 # define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
234 # define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
235 # define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
241 # define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)*0x1000000)| \
242 ((((unsigned long)f)&0xfffL)*0x1000)| \
243 ((((unsigned long)r)&0xfffL)))
244 # define ERR_GET_LIB(l) (int)((((unsigned long)l)>>24L)&0xffL)
245 # define ERR_GET_FUNC(l) (int)((((unsigned long)l)>>12L)&0xfffL)
246 # define ERR_GET_REASON(l) (int)((l)&0xfffL)
247 # define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL)
250 # define SYS_F_FOPEN 1
251 # define SYS_F_CONNECT 2
252 # define SYS_F_GETSERVBYNAME 3
253 # define SYS_F_SOCKET 4
254 # define SYS_F_IOCTLSOCKET 5
255 # define SYS_F_BIND 6
256 # define SYS_F_LISTEN 7
257 # define SYS_F_ACCEPT 8
258 # define SYS_F_WSASTARTUP 9
259 # define SYS_F_OPENDIR 10
260 # define SYS_F_FREAD 11
263 # define ERR_R_SYS_LIB ERR_LIB_SYS
264 # define ERR_R_BN_LIB ERR_LIB_BN
265 # define ERR_R_RSA_LIB ERR_LIB_RSA
266 # define ERR_R_DH_LIB ERR_LIB_DH
267 # define ERR_R_EVP_LIB ERR_LIB_EVP
268 # define ERR_R_BUF_LIB ERR_LIB_BUF
269 # define ERR_R_OBJ_LIB ERR_LIB_OBJ
270 # define ERR_R_PEM_LIB ERR_LIB_PEM
271 # define ERR_R_DSA_LIB ERR_LIB_DSA
272 # define ERR_R_X509_LIB ERR_LIB_X509
273 # define ERR_R_ASN1_LIB ERR_LIB_ASN1
274 # define ERR_R_CONF_LIB ERR_LIB_CONF
275 # define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO
276 # define ERR_R_EC_LIB ERR_LIB_EC
277 # define ERR_R_SSL_LIB ERR_LIB_SSL
278 # define ERR_R_BIO_LIB ERR_LIB_BIO
279 # define ERR_R_PKCS7_LIB ERR_LIB_PKCS7
280 # define ERR_R_X509V3_LIB ERR_LIB_X509V3
281 # define ERR_R_PKCS12_LIB ERR_LIB_PKCS12
282 # define ERR_R_RAND_LIB ERR_LIB_RAND
283 # define ERR_R_DSO_LIB ERR_LIB_DSO
284 # define ERR_R_ENGINE_LIB ERR_LIB_ENGINE
285 # define ERR_R_OCSP_LIB ERR_LIB_OCSP
286 # define ERR_R_UI_LIB ERR_LIB_UI
287 # define ERR_R_COMP_LIB ERR_LIB_COMP
288 # define ERR_R_ECDSA_LIB ERR_LIB_ECDSA
289 # define ERR_R_ECDH_LIB ERR_LIB_ECDH
290 # define ERR_R_STORE_LIB ERR_LIB_STORE
291 # define ERR_R_TS_LIB ERR_LIB_TS
293 # define ERR_R_NESTED_ASN1_ERROR 58
294 # define ERR_R_BAD_ASN1_OBJECT_HEADER 59
295 # define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60
296 # define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61
297 # define ERR_R_ASN1_LENGTH_MISMATCH 62
298 # define ERR_R_MISSING_ASN1_EOS 63
301 # define ERR_R_FATAL 64
302 # define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
303 # define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
304 # define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
305 # define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
306 # define ERR_R_DISABLED (5|ERR_R_FATAL)
313 typedef struct ERR_string_data_st {
318 void ERR_put_error(
int lib,
int func,
int reason,
const char *file,
int line);
319 void ERR_set_error_data(
char *data,
int flags);
321 unsigned long ERR_get_error(
void);
322 unsigned long ERR_get_error_line(
const char **file,
int *line);
323 unsigned long ERR_get_error_line_data(
const char **file,
int *line,
324 const char **data,
int *flags);
325 unsigned long ERR_peek_error(
void);
326 unsigned long ERR_peek_error_line(
const char **file,
int *line);
327 unsigned long ERR_peek_error_line_data(
const char **file,
int *line,
328 const char **data,
int *flags);
329 unsigned long ERR_peek_last_error(
void);
330 unsigned long ERR_peek_last_error_line(
const char **file,
int *line);
331 unsigned long ERR_peek_last_error_line_data(
const char **file,
int *line,
332 const char **data,
int *flags);
333 void ERR_clear_error(
void);
334 char *ERR_error_string(
unsigned long e,
char *buf);
335 void ERR_error_string_n(
unsigned long e,
char *buf,
size_t len);
336 const char *ERR_lib_error_string(
unsigned long e);
337 const char *ERR_func_error_string(
unsigned long e);
338 const char *ERR_reason_error_string(
unsigned long e);
339 void ERR_print_errors_cb(
int (*cb) (
const char *str,
size_t len,
void *u),
341 # ifndef OPENSSL_NO_FP_API
342 void ERR_print_errors_fp(FILE *fp);
344 # ifndef OPENSSL_NO_BIO
345 void ERR_print_errors(BIO *bp);
347 void ERR_add_error_data(
int num, ...);
348 void ERR_add_error_vdata(
int num, va_list args);
349 void ERR_load_strings(
int lib, ERR_STRING_DATA str[]);
350 void ERR_unload_strings(
int lib, ERR_STRING_DATA str[]);
351 void ERR_load_ERR_strings(
void);
352 void ERR_load_crypto_strings(
void);
353 void ERR_free_strings(
void);
355 void ERR_remove_thread_state(
const CRYPTO_THREADID *tid);
356 # ifndef OPENSSL_NO_DEPRECATED
357 void ERR_remove_state(
unsigned long pid);
359 ERR_STATE *ERR_get_state(
void);
361 # ifndef OPENSSL_NO_LHASH
362 LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(
void);
363 LHASH_OF(ERR_STATE) *ERR_get_err_state_table(
void);
364 void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash);
367 int ERR_get_next_error_library(
void);
369 int ERR_set_mark(
void);
370 int ERR_pop_to_mark(
void);
378 const ERR_FNS *ERR_get_implementation(
void);
383 int ERR_set_implementation(
const ERR_FNS *fns);