make error tables const and separate header file
[openssl.git] / engines / e_ossltest_err.c
1 /*
2  * Generated by util/mkerr.pl DO NOT EDIT
3  * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
4  *
5  * Licensed under the OpenSSL license (the "License").  You may not use
6  * this file except in compliance with the License.  You can obtain a copy
7  * in the file LICENSE in the source distribution or at
8  * https://www.openssl.org/source/license.html
9  */
10
11 #include <openssl/err.h>
12 #include "e_ossltest_err.h"
13
14 #ifndef OPENSSL_NO_ERR
15
16 static ERR_STRING_DATA OSSLTEST_str_functs[] = {
17     {ERR_PACK(0, OSSLTEST_F_BIND_OSSLTEST, 0), "bind_ossltest"},
18     {ERR_PACK(0, OSSLTEST_F_OSSLTEST_AES128_INIT_KEY, 0),
19      "OSSLTEST_AES128_INIT_KEY"},
20     {0, NULL}
21 };
22
23 static ERR_STRING_DATA OSSLTEST_str_reasons[] = {
24     {ERR_PACK(0, 0, OSSLTEST_R_INIT_FAILED), "init failed"},
25     {0, NULL}
26 };
27
28 #endif
29
30 static int lib_code = 0;
31 static int error_loaded = 0;
32
33 static int ERR_load_OSSLTEST_strings(void)
34 {
35     if (lib_code == 0)
36         lib_code = ERR_get_next_error_library();
37
38     if (!error_loaded) {
39 #ifndef OPENSSL_NO_ERR
40         ERR_load_strings(lib_code, OSSLTEST_str_functs);
41         ERR_load_strings(lib_code, OSSLTEST_str_reasons);
42 #endif
43         error_loaded = 1;
44     }
45     return 1;
46 }
47
48 static void ERR_unload_OSSLTEST_strings(void)
49 {
50     if (error_loaded) {
51 #ifndef OPENSSL_NO_ERR
52         ERR_unload_strings(lib_code, OSSLTEST_str_functs);
53         ERR_unload_strings(lib_code, OSSLTEST_str_reasons);
54 #endif
55         error_loaded = 0;
56     }
57 }
58
59 static void ERR_OSSLTEST_error(int function, int reason, char *file, int line)
60 {
61     if (lib_code == 0)
62         lib_code = ERR_get_next_error_library();
63     ERR_PUT_error(lib_code, function, reason, file, line);
64 }