Add checks on CRYPTO_set_ex_data return value
[openssl.git] / crypto / engine / eng_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 <openssl/engine.h>
19
20 /* BEGIN ERROR CODES */
21 #ifndef OPENSSL_NO_ERR
22
23 # define ERR_FUNC(func) ERR_PACK(ERR_LIB_ENGINE,func,0)
24 # define ERR_REASON(reason) ERR_PACK(ERR_LIB_ENGINE,0,reason)
25
26 static ERR_STRING_DATA ENGINE_str_functs[] = {
27     {ERR_FUNC(ENGINE_F_DYNAMIC_CTRL), "dynamic_ctrl"},
28     {ERR_FUNC(ENGINE_F_DYNAMIC_GET_DATA_CTX), "dynamic_get_data_ctx"},
29     {ERR_FUNC(ENGINE_F_DYNAMIC_LOAD), "dynamic_load"},
30     {ERR_FUNC(ENGINE_F_DYNAMIC_SET_DATA_CTX), "dynamic_set_data_ctx"},
31     {ERR_FUNC(ENGINE_F_ENGINE_ADD), "ENGINE_add"},
32     {ERR_FUNC(ENGINE_F_ENGINE_BY_ID), "ENGINE_by_id"},
33     {ERR_FUNC(ENGINE_F_ENGINE_CMD_IS_EXECUTABLE), "ENGINE_cmd_is_executable"},
34     {ERR_FUNC(ENGINE_F_ENGINE_CTRL), "ENGINE_ctrl"},
35     {ERR_FUNC(ENGINE_F_ENGINE_CTRL_CMD), "ENGINE_ctrl_cmd"},
36     {ERR_FUNC(ENGINE_F_ENGINE_CTRL_CMD_STRING), "ENGINE_ctrl_cmd_string"},
37     {ERR_FUNC(ENGINE_F_ENGINE_FINISH), "ENGINE_finish"},
38     {ERR_FUNC(ENGINE_F_ENGINE_FREE_UTIL), "ENGINE_FREE_UTIL"},
39     {ERR_FUNC(ENGINE_F_ENGINE_GET_CIPHER), "ENGINE_get_cipher"},
40     {ERR_FUNC(ENGINE_F_ENGINE_GET_DEFAULT_TYPE), "ENGINE_GET_DEFAULT_TYPE"},
41     {ERR_FUNC(ENGINE_F_ENGINE_GET_DIGEST), "ENGINE_get_digest"},
42     {ERR_FUNC(ENGINE_F_ENGINE_GET_NEXT), "ENGINE_get_next"},
43     {ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH),
44      "ENGINE_get_pkey_asn1_meth"},
45     {ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_METH), "ENGINE_get_pkey_meth"},
46     {ERR_FUNC(ENGINE_F_ENGINE_GET_PREV), "ENGINE_get_prev"},
47     {ERR_FUNC(ENGINE_F_ENGINE_INIT), "ENGINE_init"},
48     {ERR_FUNC(ENGINE_F_ENGINE_LIST_ADD), "engine_list_add"},
49     {ERR_FUNC(ENGINE_F_ENGINE_LIST_REMOVE), "engine_list_remove"},
50     {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY), "ENGINE_load_private_key"},
51     {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY), "ENGINE_load_public_key"},
52     {ERR_FUNC(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT),
53      "ENGINE_load_ssl_client_cert"},
54     {ERR_FUNC(ENGINE_F_ENGINE_NEW), "ENGINE_new"},
55     {ERR_FUNC(ENGINE_F_ENGINE_REMOVE), "ENGINE_remove"},
56     {ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_STRING),
57      "ENGINE_set_default_string"},
58     {ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_TYPE), "ENGINE_SET_DEFAULT_TYPE"},
59     {ERR_FUNC(ENGINE_F_ENGINE_SET_ID), "ENGINE_set_id"},
60     {ERR_FUNC(ENGINE_F_ENGINE_SET_NAME), "ENGINE_set_name"},
61     {ERR_FUNC(ENGINE_F_ENGINE_TABLE_REGISTER), "engine_table_register"},
62     {ERR_FUNC(ENGINE_F_ENGINE_UNLOAD_KEY), "ENGINE_UNLOAD_KEY"},
63     {ERR_FUNC(ENGINE_F_ENGINE_UNLOCKED_FINISH), "engine_unlocked_finish"},
64     {ERR_FUNC(ENGINE_F_ENGINE_UP_REF), "ENGINE_up_ref"},
65     {ERR_FUNC(ENGINE_F_INT_CTRL_HELPER), "int_ctrl_helper"},
66     {ERR_FUNC(ENGINE_F_INT_ENGINE_CONFIGURE), "int_engine_configure"},
67     {ERR_FUNC(ENGINE_F_INT_ENGINE_MODULE_INIT), "int_engine_module_init"},
68     {ERR_FUNC(ENGINE_F_LOG_MESSAGE), "LOG_MESSAGE"},
69     {0, NULL}
70 };
71
72 static ERR_STRING_DATA ENGINE_str_reasons[] = {
73     {ERR_REASON(ENGINE_R_ALREADY_LOADED), "already loaded"},
74     {ERR_REASON(ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER),
75      "argument is not a number"},
76     {ERR_REASON(ENGINE_R_CMD_NOT_EXECUTABLE), "cmd not executable"},
77     {ERR_REASON(ENGINE_R_COMMAND_TAKES_INPUT), "command takes input"},
78     {ERR_REASON(ENGINE_R_COMMAND_TAKES_NO_INPUT), "command takes no input"},
79     {ERR_REASON(ENGINE_R_CONFLICTING_ENGINE_ID), "conflicting engine id"},
80     {ERR_REASON(ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED),
81      "ctrl command not implemented"},
82     {ERR_REASON(ENGINE_R_DH_NOT_IMPLEMENTED), "dh not implemented"},
83     {ERR_REASON(ENGINE_R_DSA_NOT_IMPLEMENTED), "dsa not implemented"},
84     {ERR_REASON(ENGINE_R_DSO_FAILURE), "DSO failure"},
85     {ERR_REASON(ENGINE_R_DSO_NOT_FOUND), "dso not found"},
86     {ERR_REASON(ENGINE_R_ENGINES_SECTION_ERROR), "engines section error"},
87     {ERR_REASON(ENGINE_R_ENGINE_CONFIGURATION_ERROR),
88      "engine configuration error"},
89     {ERR_REASON(ENGINE_R_ENGINE_IS_NOT_IN_LIST), "engine is not in the list"},
90     {ERR_REASON(ENGINE_R_ENGINE_SECTION_ERROR), "engine section error"},
91     {ERR_REASON(ENGINE_R_FAILED_LOADING_PRIVATE_KEY),
92      "failed loading private key"},
93     {ERR_REASON(ENGINE_R_FAILED_LOADING_PUBLIC_KEY),
94      "failed loading public key"},
95     {ERR_REASON(ENGINE_R_FINISH_FAILED), "finish failed"},
96     {ERR_REASON(ENGINE_R_GET_HANDLE_FAILED),
97      "could not obtain hardware handle"},
98     {ERR_REASON(ENGINE_R_ID_OR_NAME_MISSING), "'id' or 'name' missing"},
99     {ERR_REASON(ENGINE_R_INIT_FAILED), "init failed"},
100     {ERR_REASON(ENGINE_R_INTERNAL_LIST_ERROR), "internal list error"},
101     {ERR_REASON(ENGINE_R_INVALID_ARGUMENT), "invalid argument"},
102     {ERR_REASON(ENGINE_R_INVALID_CMD_NAME), "invalid cmd name"},
103     {ERR_REASON(ENGINE_R_INVALID_CMD_NUMBER), "invalid cmd number"},
104     {ERR_REASON(ENGINE_R_INVALID_INIT_VALUE), "invalid init value"},
105     {ERR_REASON(ENGINE_R_INVALID_STRING), "invalid string"},
106     {ERR_REASON(ENGINE_R_NOT_INITIALISED), "not initialised"},
107     {ERR_REASON(ENGINE_R_NOT_LOADED), "not loaded"},
108     {ERR_REASON(ENGINE_R_NO_CONTROL_FUNCTION), "no control function"},
109     {ERR_REASON(ENGINE_R_NO_INDEX), "no index"},
110     {ERR_REASON(ENGINE_R_NO_LOAD_FUNCTION), "no load function"},
111     {ERR_REASON(ENGINE_R_NO_REFERENCE), "no reference"},
112     {ERR_REASON(ENGINE_R_NO_SUCH_ENGINE), "no such engine"},
113     {ERR_REASON(ENGINE_R_NO_UNLOAD_FUNCTION), "no unload function"},
114     {ERR_REASON(ENGINE_R_PROVIDE_PARAMETERS), "provide parameters"},
115     {ERR_REASON(ENGINE_R_RSA_NOT_IMPLEMENTED), "rsa not implemented"},
116     {ERR_REASON(ENGINE_R_UNIMPLEMENTED_CIPHER), "unimplemented cipher"},
117     {ERR_REASON(ENGINE_R_UNIMPLEMENTED_DIGEST), "unimplemented digest"},
118     {ERR_REASON(ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD),
119      "unimplemented public key method"},
120     {ERR_REASON(ENGINE_R_VERSION_INCOMPATIBILITY), "version incompatibility"},
121     {0, NULL}
122 };
123
124 #endif
125
126 void ERR_load_ENGINE_strings(void)
127 {
128 #ifndef OPENSSL_NO_ERR
129
130     if (ERR_func_error_string(ENGINE_str_functs[0].error) == NULL) {
131         ERR_load_strings(0, ENGINE_str_functs);
132         ERR_load_strings(0, ENGINE_str_reasons);
133     }
134 #endif
135 }