| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/include/openssl/err.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 1 | /* | - |
| 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. | - |
| 3 | * | - |
| 4 | * Licensed under the OpenSSL license (the "License"). You may not use | - |
| 5 | * this file except in compliance with the License. You can obtain a copy | - |
| 6 | * in the file LICENSE in the source distribution or at | - |
| 7 | * https://www.openssl.org/source/license.html | - |
| 8 | */ | - |
| 9 | - | |
| 10 | #ifndef HEADER_ERR_H | - |
| 11 | # define HEADER_ERR_H | - |
| 12 | - | |
| 13 | # include <openssl/e_os2.h> | - |
| 14 | - | |
| 15 | # ifndef OPENSSL_NO_STDIO | - |
| 16 | # include <stdio.h> | - |
| 17 | # include <stdlib.h> | - |
| 18 | # endif | - |
| 19 | - | |
| 20 | # include <openssl/ossl_typ.h> | - |
| 21 | # include <openssl/bio.h> | - |
| 22 | # include <openssl/lhash.h> | - |
| 23 | - | |
| 24 | #ifdef __cplusplus | - |
| 25 | extern "C" { | - |
| 26 | #endif | - |
| 27 | - | |
| 28 | # ifndef OPENSSL_NO_ERR | - |
| 29 | # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) | - |
| 30 | # else | - |
| 31 | # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) | - |
| 32 | # endif | - |
| 33 | - | |
| 34 | # include <errno.h> | - |
| 35 | - | |
| 36 | # define ERR_TXT_MALLOCED 0x01 | - |
| 37 | # define ERR_TXT_STRING 0x02 | - |
| 38 | - | |
| 39 | # define ERR_FLAG_MARK 0x01 | - |
| 40 | - | |
| 41 | # define ERR_NUM_ERRORS 16 | - |
| 42 | typedef struct err_state_st { | - |
| 43 | int err_flags[ERR_NUM_ERRORS]; | - |
| 44 | unsigned long err_buffer[ERR_NUM_ERRORS]; | - |
| 45 | char *err_data[ERR_NUM_ERRORS]; | - |
| 46 | int err_data_flags[ERR_NUM_ERRORS]; | - |
| 47 | const char *err_file[ERR_NUM_ERRORS]; | - |
| 48 | int err_line[ERR_NUM_ERRORS]; | - |
| 49 | int top, bottom; | - |
| 50 | } ERR_STATE; | - |
| 51 | - | |
| 52 | /* library */ | - |
| 53 | # define ERR_LIB_NONE 1 | - |
| 54 | # define ERR_LIB_SYS 2 | - |
| 55 | # define ERR_LIB_BN 3 | - |
| 56 | # define ERR_LIB_RSA 4 | - |
| 57 | # define ERR_LIB_DH 5 | - |
| 58 | # define ERR_LIB_EVP 6 | - |
| 59 | # define ERR_LIB_BUF 7 | - |
| 60 | # define ERR_LIB_OBJ 8 | - |
| 61 | # define ERR_LIB_PEM 9 | - |
| 62 | # define ERR_LIB_DSA 10 | - |
| 63 | # define ERR_LIB_X509 11 | - |
| 64 | /* #define ERR_LIB_METH 12 */ | - |
| 65 | # define ERR_LIB_ASN1 13 | - |
| 66 | # define ERR_LIB_CONF 14 | - |
| 67 | # define ERR_LIB_CRYPTO 15 | - |
| 68 | # define ERR_LIB_EC 16 | - |
| 69 | # define ERR_LIB_SSL 20 | - |
| 70 | /* #define ERR_LIB_SSL23 21 */ | - |
| 71 | /* #define ERR_LIB_SSL2 22 */ | - |
| 72 | /* #define ERR_LIB_SSL3 23 */ | - |
| 73 | /* #define ERR_LIB_RSAREF 30 */ | - |
| 74 | /* #define ERR_LIB_PROXY 31 */ | - |
| 75 | # define ERR_LIB_BIO 32 | - |
| 76 | # define ERR_LIB_PKCS7 33 | - |
| 77 | # define ERR_LIB_X509V3 34 | - |
| 78 | # define ERR_LIB_PKCS12 35 | - |
| 79 | # define ERR_LIB_RAND 36 | - |
| 80 | # define ERR_LIB_DSO 37 | - |
| 81 | # define ERR_LIB_ENGINE 38 | - |
| 82 | # define ERR_LIB_OCSP 39 | - |
| 83 | # define ERR_LIB_UI 40 | - |
| 84 | # define ERR_LIB_COMP 41 | - |
| 85 | # define ERR_LIB_ECDSA 42 | - |
| 86 | # define ERR_LIB_ECDH 43 | - |
| 87 | # define ERR_LIB_OSSL_STORE 44 | - |
| 88 | # define ERR_LIB_FIPS 45 | - |
| 89 | # define ERR_LIB_CMS 46 | - |
| 90 | # define ERR_LIB_TS 47 | - |
| 91 | # define ERR_LIB_HMAC 48 | - |
| 92 | /* # define ERR_LIB_JPAKE 49 */ | - |
| 93 | # define ERR_LIB_CT 50 | - |
| 94 | # define ERR_LIB_ASYNC 51 | - |
| 95 | # define ERR_LIB_KDF 52 | - |
| 96 | # define ERR_LIB_SM2 53 | - |
| 97 | - | |
| 98 | # define ERR_LIB_USER 128 | - |
| 99 | - | |
| 100 | # define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 101 | # define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 102 | # define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 103 | # define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 104 | # define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 105 | # define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 106 | # define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 107 | # define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 108 | # define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 109 | # define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 110 | # define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 111 | # define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 112 | # define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 113 | # define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 114 | # define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 115 | # define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 116 | # define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 117 | # define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 118 | # define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 119 | # define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 120 | # define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 121 | # define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 122 | # define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 123 | # define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 124 | # define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 125 | # define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 126 | # define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 127 | # define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 128 | # define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 129 | # define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 130 | # define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 131 | # define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 132 | # define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 133 | # define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 134 | # define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 135 | # define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) | - |
| 136 | - | |
| 137 | # define ERR_PACK(l,f,r) ( \ | - |
| 138 | (((unsigned int)(l) & 0x0FF) << 24L) | \ | - |
| 139 | (((unsigned int)(f) & 0xFFF) << 12L) | \ | - |
| 140 | (((unsigned int)(r) & 0xFFF) ) ) | - |
| 141 | # define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) | - |
| 142 | # define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) | - |
| 143 | # define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) | - |
| 144 | # define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) | - |
| 145 | - | |
| 146 | /* OS functions */ | - |
| 147 | # define SYS_F_FOPEN 1 | - |
| 148 | # define SYS_F_CONNECT 2 | - |
| 149 | # define SYS_F_GETSERVBYNAME 3 | - |
| 150 | # define SYS_F_SOCKET 4 | - |
| 151 | # define SYS_F_IOCTLSOCKET 5 | - |
| 152 | # define SYS_F_BIND 6 | - |
| 153 | # define SYS_F_LISTEN 7 | - |
| 154 | # define SYS_F_ACCEPT 8 | - |
| 155 | # define SYS_F_WSASTARTUP 9/* Winsock stuff */ | - |
| 156 | # define SYS_F_OPENDIR 10 | - |
| 157 | # define SYS_F_FREAD 11 | - |
| 158 | # define SYS_F_GETADDRINFO 12 | - |
| 159 | # define SYS_F_GETNAMEINFO 13 | - |
| 160 | # define SYS_F_SETSOCKOPT 14 | - |
| 161 | # define SYS_F_GETSOCKOPT 15 | - |
| 162 | # define SYS_F_GETSOCKNAME 16 | - |
| 163 | # define SYS_F_GETHOSTBYNAME 17 | - |
| 164 | # define SYS_F_FFLUSH 18 | - |
| 165 | # define SYS_F_OPEN 19 | - |
| 166 | # define SYS_F_CLOSE 20 | - |
| 167 | # define SYS_F_IOCTL 21 | - |
| 168 | # define SYS_F_STAT 22 | - |
| 169 | # define SYS_F_FCNTL 23 | - |
| 170 | # define SYS_F_FSTAT 24 | - |
| 171 | - | |
| 172 | /* reasons */ | - |
| 173 | # define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ | - |
| 174 | # define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ | - |
| 175 | # define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ | - |
| 176 | # define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ | - |
| 177 | # define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ | - |
| 178 | # define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ | - |
| 179 | # define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ | - |
| 180 | # define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ | - |
| 181 | # define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ | - |
| 182 | # define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ | - |
| 183 | # define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ | - |
| 184 | # define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ | - |
| 185 | # define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ | - |
| 186 | # define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ | - |
| 187 | # define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ | - |
| 188 | # define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ | - |
| 189 | # define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ | - |
| 190 | # define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ | - |
| 191 | # define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ | - |
| 192 | - | |
| 193 | # define ERR_R_NESTED_ASN1_ERROR 58 | - |
| 194 | # define ERR_R_MISSING_ASN1_EOS 63 | - |
| 195 | - | |
| 196 | /* fatal error */ | - |
| 197 | # define ERR_R_FATAL 64 | - |
| 198 | # define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) | - |
| 199 | # define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) | - |
| 200 | # define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) | - |
| 201 | # define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) | - |
| 202 | # define ERR_R_DISABLED (5|ERR_R_FATAL) | - |
| 203 | # define ERR_R_INIT_FAIL (6|ERR_R_FATAL) | - |
| 204 | # define ERR_R_PASSED_INVALID_ARGUMENT (7) | - |
| 205 | # define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) | - |
| 206 | - | |
| 207 | /* | - |
| 208 | * 99 is the maximum possible ERR_R_... code, higher values are reserved for | - |
| 209 | * the individual libraries | - |
| 210 | */ | - |
| 211 | - | |
| 212 | typedef struct ERR_string_data_st { | - |
| 213 | unsigned long error; | - |
| 214 | const char *string; | - |
| 215 | } ERR_STRING_DATA; | - |
| 216 | - | |
| 217 | DEFINE_LHASH_OF(ERR_STRING_DATA); executed 2076 times by 12 tests: end of blockExecuted by:
never executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blocknever executed: end of blockexecuted 2074 times by 11 tests: return (struct lhash_st_ERR_STRING_DATA *) OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn);Executed by:
executed 16141763 times by 11 tests: return (ERR_STRING_DATA *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d);Executed by:
executed 1119 times by 1 test: return (ERR_STRING_DATA *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d);Executed by:
executed 73868 times by 11 tests: return (ERR_STRING_DATA *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d);Executed by:
never executed: return OPENSSL_LH_error((OPENSSL_LHASH *)lh);never executed: return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh);never executed: return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); | 0-16141763 |
| 218 | - | |
| 219 | void ERR_put_error(int lib, int func, int reason, const char *file, int line); | - |
| 220 | void ERR_set_error_data(char *data, int flags); | - |
| 221 | - | |
| 222 | unsigned long ERR_get_error(void); | - |
| 223 | unsigned long ERR_get_error_line(const char **file, int *line); | - |
| 224 | unsigned long ERR_get_error_line_data(const char **file, int *line, | - |
| 225 | const char **data, int *flags); | - |
| 226 | unsigned long ERR_peek_error(void); | - |
| 227 | unsigned long ERR_peek_error_line(const char **file, int *line); | - |
| 228 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | - |
| 229 | const char **data, int *flags); | - |
| 230 | unsigned long ERR_peek_last_error(void); | - |
| 231 | unsigned long ERR_peek_last_error_line(const char **file, int *line); | - |
| 232 | unsigned long ERR_peek_last_error_line_data(const char **file, int *line, | - |
| 233 | const char **data, int *flags); | - |
| 234 | void ERR_clear_error(void); | - |
| 235 | char *ERR_error_string(unsigned long e, char *buf); | - |
| 236 | void ERR_error_string_n(unsigned long e, char *buf, size_t len); | - |
| 237 | const char *ERR_lib_error_string(unsigned long e); | - |
| 238 | const char *ERR_func_error_string(unsigned long e); | - |
| 239 | const char *ERR_reason_error_string(unsigned long e); | - |
| 240 | void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), | - |
| 241 | void *u); | - |
| 242 | # ifndef OPENSSL_NO_STDIO | - |
| 243 | void ERR_print_errors_fp(FILE *fp); | - |
| 244 | # endif | - |
| 245 | void ERR_print_errors(BIO *bp); | - |
| 246 | void ERR_add_error_data(int num, ...); | - |
| 247 | void ERR_add_error_vdata(int num, va_list args); | - |
| 248 | int ERR_load_strings(int lib, ERR_STRING_DATA *str); | - |
| 249 | int ERR_load_strings_const(const ERR_STRING_DATA *str); | - |
| 250 | int ERR_unload_strings(int lib, ERR_STRING_DATA *str); | - |
| 251 | int ERR_load_ERR_strings(void); | - |
| 252 | - | |
| 253 | #if OPENSSL_API_COMPAT < 0x10100000L | - |
| 254 | # define ERR_load_crypto_strings() \ | - |
| 255 | OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) | - |
| 256 | # define ERR_free_strings() while(0) continue | - |
| 257 | #endif | - |
| 258 | - | |
| 259 | DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) | - |
| 260 | DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) | - |
| 261 | ERR_STATE *ERR_get_state(void); | - |
| 262 | - | |
| 263 | int ERR_get_next_error_library(void); | - |
| 264 | - | |
| 265 | int ERR_set_mark(void); | - |
| 266 | int ERR_pop_to_mark(void); | - |
| 267 | int ERR_clear_last_mark(void); | - |
| 268 | - | |
| 269 | #ifdef __cplusplus | - |
| 270 | } | - |
| 271 | #endif | - |
| 272 | - | |
| 273 | #endif | - |
| Source code | Switch to Preprocessed file |