Fix mem error handling in PKCS7_simple_smimecap
[openssl.git] / engines / e_ossltest_err.c
1 /*
2  * Copyright 1995-2016 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 /*
11  * NOTE: this file was auto generated by the mkerr.pl script: any changes
12  * made to it will be overwritten when the script next updates this file,
13  * only reason strings will be preserved.
14  */
15
16 #include <stdio.h>
17 #include <openssl/err.h>
18 #include "e_ossltest_err.h"
19
20 /* BEGIN ERROR CODES */
21 #ifndef OPENSSL_NO_ERR
22
23 # define ERR_FUNC(func) ERR_PACK(0,func,0)
24 # define ERR_REASON(reason) ERR_PACK(0,0,reason)
25
26 static ERR_STRING_DATA OSSLTEST_str_functs[] = {
27     {ERR_FUNC(OSSLTEST_F_BIND_OSSLTEST), "BIND_OSSLTEST"},
28     {ERR_FUNC(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY),
29      "OSSLTEST_AES128_INIT_KEY"},
30     {0, NULL}
31 };
32
33 static ERR_STRING_DATA OSSLTEST_str_reasons[] = {
34     {ERR_REASON(OSSLTEST_R_INIT_FAILED), "init failed"},
35     {0, NULL}
36 };
37
38 #endif
39
40 #ifdef OSSLTEST_LIB_NAME
41 static ERR_STRING_DATA OSSLTEST_lib_name[] = {
42     {0, OSSLTEST_LIB_NAME},
43     {0, NULL}
44 };
45 #endif
46
47 static int OSSLTEST_lib_error_code = 0;
48 static int OSSLTEST_error_init = 1;
49
50 static void ERR_load_OSSLTEST_strings(void)
51 {
52     if (OSSLTEST_lib_error_code == 0)
53         OSSLTEST_lib_error_code = ERR_get_next_error_library();
54
55     if (OSSLTEST_error_init) {
56         OSSLTEST_error_init = 0;
57 #ifndef OPENSSL_NO_ERR
58         ERR_load_strings(OSSLTEST_lib_error_code, OSSLTEST_str_functs);
59         ERR_load_strings(OSSLTEST_lib_error_code, OSSLTEST_str_reasons);
60 #endif
61
62 #ifdef OSSLTEST_LIB_NAME
63         OSSLTEST_lib_name->error = ERR_PACK(OSSLTEST_lib_error_code, 0, 0);
64         ERR_load_strings(0, OSSLTEST_lib_name);
65 #endif
66     }
67 }
68
69 static void ERR_unload_OSSLTEST_strings(void)
70 {
71     if (OSSLTEST_error_init == 0) {
72 #ifndef OPENSSL_NO_ERR
73         ERR_unload_strings(OSSLTEST_lib_error_code, OSSLTEST_str_functs);
74         ERR_unload_strings(OSSLTEST_lib_error_code, OSSLTEST_str_reasons);
75 #endif
76
77 #ifdef OSSLTEST_LIB_NAME
78         ERR_unload_strings(0, OSSLTEST_lib_name);
79 #endif
80         OSSLTEST_error_init = 1;
81     }
82 }
83
84 static void ERR_OSSLTEST_error(int function, int reason, char *file, int line)
85 {
86     if (OSSLTEST_lib_error_code == 0)
87         OSSLTEST_lib_error_code = ERR_get_next_error_library();
88     ERR_PUT_error(OSSLTEST_lib_error_code, function, reason, file, line);
89 }