--- /dev/null
+/* crypto/err/err.h */\r
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\r
+ * All rights reserved.\r
+ *\r
+ * This package is an SSL implementation written\r
+ * by Eric Young (eay@cryptsoft.com).\r
+ * The implementation was written so as to conform with Netscapes SSL.\r
+ * \r
+ * This library is free for commercial and non-commercial use as long as\r
+ * the following conditions are aheared to. The following conditions\r
+ * apply to all code found in this distribution, be it the RC4, RSA,\r
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation\r
+ * included with this distribution is covered by the same copyright terms\r
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).\r
+ * \r
+ * Copyright remains Eric Young's, and as such any Copyright notices in\r
+ * the code are not to be removed.\r
+ * If this package is used in a product, Eric Young should be given attribution\r
+ * as the author of the parts of the library used.\r
+ * This can be in the form of a textual message at program startup or\r
+ * in documentation (online or textual) provided with the package.\r
+ * \r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. All advertising materials mentioning features or use of this software\r
+ * must display the following acknowledgement:\r
+ * "This product includes cryptographic software written by\r
+ * Eric Young (eay@cryptsoft.com)"\r
+ * The word 'cryptographic' can be left out if the rouines from the library\r
+ * being used are not cryptographic related :-).\r
+ * 4. If you include any Windows specific code (or a derivative thereof) from \r
+ * the apps directory (application code) you must include an acknowledgement:\r
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"\r
+ * \r
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ * \r
+ * The licence and distribution terms for any publically available version or\r
+ * derivative of this code cannot be changed. i.e. this code cannot simply be\r
+ * copied and put under another distribution licence\r
+ * [including the GNU Public Licence.]\r
+ */\r
+\r
+#ifndef HEADER_ERR_H\r
+#define HEADER_ERR_H\r
+\r
+#include <openssl/e_os2.h>\r
+\r
+#ifndef OPENSSL_NO_FP_API\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#endif\r
+\r
+#include <openssl/ossl_typ.h>\r
+#ifndef OPENSSL_NO_BIO\r
+#include <openssl/bio.h>\r
+#endif\r
+#ifndef OPENSSL_NO_LHASH\r
+#include <openssl/lhash.h>\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#ifndef OPENSSL_NO_ERR\r
+#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e)\r
+#else\r
+#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0)\r
+#endif\r
+\r
+#include <errno.h>\r
+\r
+#define ERR_TXT_MALLOCED 0x01\r
+#define ERR_TXT_STRING 0x02\r
+\r
+#define ERR_FLAG_MARK 0x01\r
+\r
+#define ERR_NUM_ERRORS 16\r
+typedef struct err_state_st\r
+ {\r
+ unsigned long pid;\r
+ int err_flags[ERR_NUM_ERRORS];\r
+ unsigned long err_buffer[ERR_NUM_ERRORS];\r
+ char *err_data[ERR_NUM_ERRORS];\r
+ int err_data_flags[ERR_NUM_ERRORS];\r
+ const char *err_file[ERR_NUM_ERRORS];\r
+ int err_line[ERR_NUM_ERRORS];\r
+ int top,bottom;\r
+ } ERR_STATE;\r
+\r
+/* library */\r
+#define ERR_LIB_NONE 1\r
+#define ERR_LIB_SYS 2\r
+#define ERR_LIB_BN 3\r
+#define ERR_LIB_RSA 4\r
+#define ERR_LIB_DH 5\r
+#define ERR_LIB_EVP 6\r
+#define ERR_LIB_BUF 7\r
+#define ERR_LIB_OBJ 8\r
+#define ERR_LIB_PEM 9\r
+#define ERR_LIB_DSA 10\r
+#define ERR_LIB_X509 11\r
+/* #define ERR_LIB_METH 12 */\r
+#define ERR_LIB_ASN1 13\r
+#define ERR_LIB_CONF 14\r
+#define ERR_LIB_CRYPTO 15\r
+#define ERR_LIB_EC 16\r
+#define ERR_LIB_SSL 20\r
+/* #define ERR_LIB_SSL23 21 */\r
+/* #define ERR_LIB_SSL2 22 */\r
+/* #define ERR_LIB_SSL3 23 */\r
+/* #define ERR_LIB_RSAREF 30 */\r
+/* #define ERR_LIB_PROXY 31 */\r
+#define ERR_LIB_BIO 32\r
+#define ERR_LIB_PKCS7 33\r
+#define ERR_LIB_X509V3 34\r
+#define ERR_LIB_PKCS12 35\r
+#define ERR_LIB_RAND 36\r
+#define ERR_LIB_DSO 37\r
+#define ERR_LIB_ENGINE 38\r
+#define ERR_LIB_OCSP 39\r
+#define ERR_LIB_UI 40\r
+#define ERR_LIB_COMP 41\r
+#define ERR_LIB_ECDSA 42\r
+#define ERR_LIB_ECDH 43\r
+#define ERR_LIB_STORE 44\r
+\r
+#define ERR_LIB_USER 128\r
+\r
+#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)\r
+#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)\r
+#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)\r
+#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)\r
+#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)\r
+#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)\r
+#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)\r
+#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)\r
+#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)\r
+#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)\r
+#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)\r
+#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)\r
+#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)\r
+#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)\r
+#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)\r
+#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)\r
+#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)\r
+#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)\r
+#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)\r
+#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)\r
+#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)\r
+#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)\r
+#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)\r
+#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)\r
+#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)\r
+#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)\r
+#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)\r
+#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)\r
+\r
+/* Borland C seems too stupid to be able to shift and do longs in\r
+ * the pre-processor :-( */\r
+#define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)*0x1000000)| \\r
+ ((((unsigned long)f)&0xfffL)*0x1000)| \\r
+ ((((unsigned long)r)&0xfffL)))\r
+#define ERR_GET_LIB(l) (int)((((unsigned long)l)>>24L)&0xffL)\r
+#define ERR_GET_FUNC(l) (int)((((unsigned long)l)>>12L)&0xfffL)\r
+#define ERR_GET_REASON(l) (int)((l)&0xfffL)\r
+#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL)\r
+\r
+\r
+/* OS functions */\r
+#define SYS_F_FOPEN 1\r
+#define SYS_F_CONNECT 2\r
+#define SYS_F_GETSERVBYNAME 3\r
+#define SYS_F_SOCKET 4\r
+#define SYS_F_IOCTLSOCKET 5\r
+#define SYS_F_BIND 6\r
+#define SYS_F_LISTEN 7\r
+#define SYS_F_ACCEPT 8\r
+#define SYS_F_WSASTARTUP 9 /* Winsock stuff */\r
+#define SYS_F_OPENDIR 10\r
+#define SYS_F_FREAD 11\r
+\r
+\r
+/* reasons */\r
+#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */\r
+#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */\r
+#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */\r
+#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */\r
+#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */\r
+#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */\r
+#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */\r
+#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */\r
+#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */\r
+#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */\r
+#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */\r
+#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */\r
+#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */\r
+#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */\r
+#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */\r
+#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */\r
+#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */\r
+#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */\r
+#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */\r
+#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */\r
+#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */\r
+#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */\r
+#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */\r
+#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */\r
+#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */\r
+#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */\r
+#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */\r
+#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */\r
+\r
+#define ERR_R_NESTED_ASN1_ERROR 58\r
+#define ERR_R_BAD_ASN1_OBJECT_HEADER 59\r
+#define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60\r
+#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61\r
+#define ERR_R_ASN1_LENGTH_MISMATCH 62\r
+#define ERR_R_MISSING_ASN1_EOS 63\r
+\r
+/* fatal error */\r
+#define ERR_R_FATAL 64\r
+#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)\r
+#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)\r
+#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)\r
+#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)\r
+#define ERR_R_DISABLED (5|ERR_R_FATAL)\r
+\r
+/* 99 is the maximum possible ERR_R_... code, higher values\r
+ * are reserved for the individual libraries */\r
+\r
+\r
+typedef struct ERR_string_data_st\r
+ {\r
+ unsigned long error;\r
+ const char *string;\r
+ } ERR_STRING_DATA;\r
+\r
+void ERR_put_error(int lib, int func,int reason,const char *file,int line);\r
+void ERR_set_error_data(char *data,int flags);\r
+\r
+unsigned long ERR_get_error(void);\r
+unsigned long ERR_get_error_line(const char **file,int *line);\r
+unsigned long ERR_get_error_line_data(const char **file,int *line,\r
+ const char **data, int *flags);\r
+unsigned long ERR_peek_error(void);\r
+unsigned long ERR_peek_error_line(const char **file,int *line);\r
+unsigned long ERR_peek_error_line_data(const char **file,int *line,\r
+ const char **data,int *flags);\r
+unsigned long ERR_peek_last_error(void);\r
+unsigned long ERR_peek_last_error_line(const char **file,int *line);\r
+unsigned long ERR_peek_last_error_line_data(const char **file,int *line,\r
+ const char **data,int *flags);\r
+void ERR_clear_error(void );\r
+char *ERR_error_string(unsigned long e,char *buf);\r
+void ERR_error_string_n(unsigned long e, char *buf, size_t len);\r
+const char *ERR_lib_error_string(unsigned long e);\r
+const char *ERR_func_error_string(unsigned long e);\r
+const char *ERR_reason_error_string(unsigned long e);\r
+void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),\r
+ void *u);\r
+#ifndef OPENSSL_NO_FP_API\r
+void ERR_print_errors_fp(FILE *fp);\r
+#endif\r
+#ifndef OPENSSL_NO_BIO\r
+void ERR_print_errors(BIO *bp);\r
+void ERR_add_error_data(int num, ...);\r
+#endif\r
+void ERR_load_strings(int lib,ERR_STRING_DATA str[]);\r
+void ERR_unload_strings(int lib,ERR_STRING_DATA str[]);\r
+void ERR_load_ERR_strings(void);\r
+void ERR_load_crypto_strings(void);\r
+void ERR_free_strings(void);\r
+\r
+void ERR_remove_state(unsigned long pid); /* if zero we look it up */\r
+ERR_STATE *ERR_get_state(void);\r
+\r
+#ifndef OPENSSL_NO_LHASH\r
+LHASH *ERR_get_string_table(void);\r
+LHASH *ERR_get_err_state_table(void);\r
+void ERR_release_err_state_table(LHASH **hash);\r
+#endif\r
+\r
+int ERR_get_next_error_library(void);\r
+\r
+int ERR_set_mark(void);\r
+int ERR_pop_to_mark(void);\r
+\r
+/* Already defined in ossl_typ.h */\r
+/* typedef struct st_ERR_FNS ERR_FNS; */\r
+/* An application can use this function and provide the return value to loaded\r
+ * modules that should use the application's ERR state/functionality */\r
+const ERR_FNS *ERR_get_implementation(void);\r
+/* A loaded module should call this function prior to any ERR operations using\r
+ * the application's "ERR_FNS". */\r
+int ERR_set_implementation(const ERR_FNS *fns);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif\r