Avoid truncating the pointer on x32 platform.
[openssl.git] / engines / e_chil_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_chil_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 HWCRHK_str_functs[] = {
27     {ERR_FUNC(HWCRHK_F_HWCRHK_CTRL), "HWCRHK_CTRL"},
28     {ERR_FUNC(HWCRHK_F_HWCRHK_FINISH), "HWCRHK_FINISH"},
29     {ERR_FUNC(HWCRHK_F_HWCRHK_GET_PASS), "HWCRHK_GET_PASS"},
30     {ERR_FUNC(HWCRHK_F_HWCRHK_INIT), "HWCRHK_INIT"},
31     {ERR_FUNC(HWCRHK_F_HWCRHK_INSERT_CARD), "HWCRHK_INSERT_CARD"},
32     {ERR_FUNC(HWCRHK_F_HWCRHK_LOAD_PRIVKEY), "HWCRHK_LOAD_PRIVKEY"},
33     {ERR_FUNC(HWCRHK_F_HWCRHK_LOAD_PUBKEY), "HWCRHK_LOAD_PUBKEY"},
34     {ERR_FUNC(HWCRHK_F_HWCRHK_MOD_EXP), "HWCRHK_MOD_EXP"},
35     {ERR_FUNC(HWCRHK_F_HWCRHK_RAND_BYTES), "HWCRHK_RAND_BYTES"},
36     {ERR_FUNC(HWCRHK_F_HWCRHK_RSA_MOD_EXP), "HWCRHK_RSA_MOD_EXP"},
37     {0, NULL}
38 };
39
40 static ERR_STRING_DATA HWCRHK_str_reasons[] = {
41     {ERR_REASON(HWCRHK_R_ALREADY_LOADED), "already loaded"},
42     {ERR_REASON(HWCRHK_R_BIO_WAS_FREED), "bio was freed"},
43     {ERR_REASON(HWCRHK_R_CHIL_ERROR), "chil error"},
44     {ERR_REASON(HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED),
45      "ctrl command not implemented"},
46     {ERR_REASON(HWCRHK_R_DSO_FAILURE), "dso failure"},
47     {ERR_REASON(HWCRHK_R_MISSING_KEY_COMPONENTS), "missing key components"},
48     {ERR_REASON(HWCRHK_R_NOT_INITIALISED), "not initialised"},
49     {ERR_REASON(HWCRHK_R_NOT_LOADED), "not loaded"},
50     {ERR_REASON(HWCRHK_R_NO_CALLBACK), "no callback"},
51     {ERR_REASON(HWCRHK_R_NO_KEY), "no key"},
52     {ERR_REASON(HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED),
53      "private key algorithms disabled"},
54     {ERR_REASON(HWCRHK_R_REQUEST_FAILED), "request failed"},
55     {ERR_REASON(HWCRHK_R_REQUEST_FALLBACK), "request fallback"},
56     {ERR_REASON(HWCRHK_R_UNIT_FAILURE), "unit failure"},
57     {0, NULL}
58 };
59
60 #endif
61
62 #ifdef HWCRHK_LIB_NAME
63 static ERR_STRING_DATA HWCRHK_lib_name[] = {
64     {0, HWCRHK_LIB_NAME},
65     {0, NULL}
66 };
67 #endif
68
69 static int HWCRHK_lib_error_code = 0;
70 static int HWCRHK_error_init = 1;
71
72 static void ERR_load_HWCRHK_strings(void)
73 {
74     if (HWCRHK_lib_error_code == 0)
75         HWCRHK_lib_error_code = ERR_get_next_error_library();
76
77     if (HWCRHK_error_init) {
78         HWCRHK_error_init = 0;
79 #ifndef OPENSSL_NO_ERR
80         ERR_load_strings(HWCRHK_lib_error_code, HWCRHK_str_functs);
81         ERR_load_strings(HWCRHK_lib_error_code, HWCRHK_str_reasons);
82 #endif
83
84 #ifdef HWCRHK_LIB_NAME
85         HWCRHK_lib_name->error = ERR_PACK(HWCRHK_lib_error_code, 0, 0);
86         ERR_load_strings(0, HWCRHK_lib_name);
87 #endif
88     }
89 }
90
91 static void ERR_unload_HWCRHK_strings(void)
92 {
93     if (HWCRHK_error_init == 0) {
94 #ifndef OPENSSL_NO_ERR
95         ERR_unload_strings(HWCRHK_lib_error_code, HWCRHK_str_functs);
96         ERR_unload_strings(HWCRHK_lib_error_code, HWCRHK_str_reasons);
97 #endif
98
99 #ifdef HWCRHK_LIB_NAME
100         ERR_unload_strings(0, HWCRHK_lib_name);
101 #endif
102         HWCRHK_error_init = 1;
103     }
104 }
105
106 static void ERR_HWCRHK_error(int function, int reason, char *file, int line)
107 {
108     if (HWCRHK_lib_error_code == 0)
109         HWCRHK_lib_error_code = ERR_get_next_error_library();
110     ERR_PUT_error(HWCRHK_lib_error_code, function, reason, file, line);
111 }