summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/engine')
-rw-r--r--src/lib/libcrypto/engine/eng_aesni.c4
-rw-r--r--src/lib/libcrypto/engine/eng_cnf.c14
-rw-r--r--src/lib/libcrypto/engine/eng_ctrl.c54
-rw-r--r--src/lib/libcrypto/engine/eng_err.c42
-rw-r--r--src/lib/libcrypto/engine/eng_fat.c5
-rw-r--r--src/lib/libcrypto/engine/eng_init.c11
-rw-r--r--src/lib/libcrypto/engine/eng_lib.c13
-rw-r--r--src/lib/libcrypto/engine/eng_list.c48
-rw-r--r--src/lib/libcrypto/engine/eng_pkey.c35
-rw-r--r--src/lib/libcrypto/engine/eng_table.c5
-rw-r--r--src/lib/libcrypto/engine/tb_asnmth.c5
-rw-r--r--src/lib/libcrypto/engine/tb_cipher.c5
-rw-r--r--src/lib/libcrypto/engine/tb_digest.c5
-rw-r--r--src/lib/libcrypto/engine/tb_pkmeth.c5
14 files changed, 80 insertions, 171 deletions
diff --git a/src/lib/libcrypto/engine/eng_aesni.c b/src/lib/libcrypto/engine/eng_aesni.c
index 92794f6086..cd14bbc8cd 100644
--- a/src/lib/libcrypto/engine/eng_aesni.c
+++ b/src/lib/libcrypto/engine/eng_aesni.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_aesni.c,v 1.9 2016/11/04 17:30:30 miod Exp $ */ 1/* $OpenBSD: eng_aesni.c,v 1.10 2017/01/29 17:49:23 beck Exp $ */
2/* 2/*
3 * Support for Intel AES-NI intruction set 3 * Support for Intel AES-NI intruction set
4 * Author: Huang Ying <ying.huang@intel.com> 4 * Author: Huang Ying <ying.huang@intel.com>
@@ -411,7 +411,7 @@ aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *user_key,
411 ret = aesni_set_decrypt_key(user_key, ctx->key_len * 8, key); 411 ret = aesni_set_decrypt_key(user_key, ctx->key_len * 8, key);
412 412
413 if (ret < 0) { 413 if (ret < 0) {
414 EVPerr(EVP_F_AESNI_INIT_KEY, EVP_R_AES_KEY_SETUP_FAILED); 414 EVPerror(EVP_R_AES_KEY_SETUP_FAILED);
415 return 0; 415 return 0;
416 } 416 }
417 417
diff --git a/src/lib/libcrypto/engine/eng_cnf.c b/src/lib/libcrypto/engine/eng_cnf.c
index acdebda6a6..2ac077d492 100644
--- a/src/lib/libcrypto/engine/eng_cnf.c
+++ b/src/lib/libcrypto/engine/eng_cnf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_cnf.c,v 1.13 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_cnf.c,v 1.14 2017/01/29 17:49:23 beck Exp $ */
2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL 2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -115,8 +115,7 @@ int_engine_configure(char *name, char *value, const CONF *cnf)
115 ecmds = NCONF_get_section(cnf, value); 115 ecmds = NCONF_get_section(cnf, value);
116 116
117 if (!ecmds) { 117 if (!ecmds) {
118 ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, 118 ENGINEerror(ENGINE_R_ENGINE_SECTION_ERROR);
119 ENGINE_R_ENGINE_SECTION_ERROR);
120 return 0; 119 return 0;
121 } 120 }
122 121
@@ -175,8 +174,7 @@ int_engine_configure(char *name, char *value, const CONF *cnf)
175 if (!int_engine_init(e)) 174 if (!int_engine_init(e))
176 goto err; 175 goto err;
177 } else if (do_init != 0) { 176 } else if (do_init != 0) {
178 ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, 177 ENGINEerror(ENGINE_R_INVALID_INIT_VALUE);
179 ENGINE_R_INVALID_INIT_VALUE);
180 goto err; 178 goto err;
181 } 179 }
182 } 180 }
@@ -196,8 +194,7 @@ int_engine_configure(char *name, char *value, const CONF *cnf)
196 194
197err: 195err:
198 if (ret != 1) { 196 if (ret != 1) {
199 ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, 197 ENGINEerror(ENGINE_R_ENGINE_CONFIGURATION_ERROR);
200 ENGINE_R_ENGINE_CONFIGURATION_ERROR);
201 if (ecmd) 198 if (ecmd)
202 ERR_asprintf_error_data( 199 ERR_asprintf_error_data(
203 "section=%s, name=%s, value=%s", 200 "section=%s, name=%s, value=%s",
@@ -224,8 +221,7 @@ int_engine_module_init(CONF_IMODULE *md, const CONF *cnf)
224 elist = NCONF_get_section(cnf, CONF_imodule_get_value(md)); 221 elist = NCONF_get_section(cnf, CONF_imodule_get_value(md));
225 222
226 if (!elist) { 223 if (!elist) {
227 ENGINEerr(ENGINE_F_INT_ENGINE_MODULE_INIT, 224 ENGINEerror(ENGINE_R_ENGINES_SECTION_ERROR);
228 ENGINE_R_ENGINES_SECTION_ERROR);
229 return 0; 225 return 0;
230 } 226 }
231 227
diff --git a/src/lib/libcrypto/engine/eng_ctrl.c b/src/lib/libcrypto/engine/eng_ctrl.c
index bf832dc626..1a3c25fbae 100644
--- a/src/lib/libcrypto/engine/eng_ctrl.c
+++ b/src/lib/libcrypto/engine/eng_ctrl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_ctrl.c,v 1.10 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_ctrl.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -125,8 +125,7 @@ int_ctrl_helper(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
125 (cmd == ENGINE_CTRL_GET_NAME_FROM_CMD) || 125 (cmd == ENGINE_CTRL_GET_NAME_FROM_CMD) ||
126 (cmd == ENGINE_CTRL_GET_DESC_FROM_CMD)) { 126 (cmd == ENGINE_CTRL_GET_DESC_FROM_CMD)) {
127 if (s == NULL) { 127 if (s == NULL) {
128 ENGINEerr(ENGINE_F_INT_CTRL_HELPER, 128 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
129 ERR_R_PASSED_NULL_PARAMETER);
130 return -1; 129 return -1;
131 } 130 }
132 } 131 }
@@ -134,8 +133,7 @@ int_ctrl_helper(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
134 if (cmd == ENGINE_CTRL_GET_CMD_FROM_NAME) { 133 if (cmd == ENGINE_CTRL_GET_CMD_FROM_NAME) {
135 if ((e->cmd_defns == NULL) || 134 if ((e->cmd_defns == NULL) ||
136 ((idx = int_ctrl_cmd_by_name(e->cmd_defns, s)) < 0)) { 135 ((idx = int_ctrl_cmd_by_name(e->cmd_defns, s)) < 0)) {
137 ENGINEerr(ENGINE_F_INT_CTRL_HELPER, 136 ENGINEerror(ENGINE_R_INVALID_CMD_NAME);
138 ENGINE_R_INVALID_CMD_NAME);
139 return -1; 137 return -1;
140 } 138 }
141 return e->cmd_defns[idx].cmd_num; 139 return e->cmd_defns[idx].cmd_num;
@@ -144,8 +142,7 @@ int_ctrl_helper(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
144 * valie command number - so we need to conduct a search. */ 142 * valie command number - so we need to conduct a search. */
145 if ((e->cmd_defns == NULL) || 143 if ((e->cmd_defns == NULL) ||
146 ((idx = int_ctrl_cmd_by_num(e->cmd_defns, (unsigned int)i)) < 0)) { 144 ((idx = int_ctrl_cmd_by_num(e->cmd_defns, (unsigned int)i)) < 0)) {
147 ENGINEerr(ENGINE_F_INT_CTRL_HELPER, 145 ENGINEerror(ENGINE_R_INVALID_CMD_NUMBER);
148 ENGINE_R_INVALID_CMD_NUMBER);
149 return -1; 146 return -1;
150 } 147 }
151 /* Now the logic splits depending on command type */ 148 /* Now the logic splits depending on command type */
@@ -188,7 +185,7 @@ int_ctrl_helper(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
188 } 185 }
189 186
190 /* Shouldn't really be here ... */ 187 /* Shouldn't really be here ... */
191 ENGINEerr(ENGINE_F_INT_CTRL_HELPER, ENGINE_R_INTERNAL_LIST_ERROR); 188 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
192 return -1; 189 return -1;
193} 190}
194 191
@@ -198,7 +195,7 @@ ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
198 int ctrl_exists, ref_exists; 195 int ctrl_exists, ref_exists;
199 196
200 if (e == NULL) { 197 if (e == NULL) {
201 ENGINEerr(ENGINE_F_ENGINE_CTRL, ERR_R_PASSED_NULL_PARAMETER); 198 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
202 return 0; 199 return 0;
203 } 200 }
204 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 201 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
@@ -206,7 +203,7 @@ ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
206 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 203 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
207 ctrl_exists = ((e->ctrl == NULL) ? 0 : 1); 204 ctrl_exists = ((e->ctrl == NULL) ? 0 : 1);
208 if (!ref_exists) { 205 if (!ref_exists) {
209 ENGINEerr(ENGINE_F_ENGINE_CTRL, ENGINE_R_NO_REFERENCE); 206 ENGINEerror(ENGINE_R_NO_REFERENCE);
210 return 0; 207 return 0;
211 } 208 }
212 /* Intercept any "root-level" commands before trying to hand them on to 209 /* Intercept any "root-level" commands before trying to hand them on to
@@ -225,8 +222,7 @@ ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
225 if (ctrl_exists && !(e->flags & ENGINE_FLAGS_MANUAL_CMD_CTRL)) 222 if (ctrl_exists && !(e->flags & ENGINE_FLAGS_MANUAL_CMD_CTRL))
226 return int_ctrl_helper(e, cmd, i, p, f); 223 return int_ctrl_helper(e, cmd, i, p, f);
227 if (!ctrl_exists) { 224 if (!ctrl_exists) {
228 ENGINEerr(ENGINE_F_ENGINE_CTRL, 225 ENGINEerror(ENGINE_R_NO_CONTROL_FUNCTION);
229 ENGINE_R_NO_CONTROL_FUNCTION);
230 /* For these cmd-related functions, failure is indicated 226 /* For these cmd-related functions, failure is indicated
231 * by a -1 return value (because 0 is used as a valid 227 * by a -1 return value (because 0 is used as a valid
232 * return in some places). */ 228 * return in some places). */
@@ -237,7 +233,7 @@ ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
237 } 233 }
238 /* Anything else requires a ctrl() handler to exist. */ 234 /* Anything else requires a ctrl() handler to exist. */
239 if (!ctrl_exists) { 235 if (!ctrl_exists) {
240 ENGINEerr(ENGINE_F_ENGINE_CTRL, ENGINE_R_NO_CONTROL_FUNCTION); 236 ENGINEerror(ENGINE_R_NO_CONTROL_FUNCTION);
241 return 0; 237 return 0;
242 } 238 }
243 return e->ctrl(e, cmd, i, p, f); 239 return e->ctrl(e, cmd, i, p, f);
@@ -250,8 +246,7 @@ ENGINE_cmd_is_executable(ENGINE *e, int cmd)
250 246
251 if ((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, cmd, 247 if ((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, cmd,
252 NULL, NULL)) < 0) { 248 NULL, NULL)) < 0) {
253 ENGINEerr(ENGINE_F_ENGINE_CMD_IS_EXECUTABLE, 249 ENGINEerror(ENGINE_R_INVALID_CMD_NUMBER);
254 ENGINE_R_INVALID_CMD_NUMBER);
255 return 0; 250 return 0;
256 } 251 }
257 if (!(flags & ENGINE_CMD_FLAG_NO_INPUT) && 252 if (!(flags & ENGINE_CMD_FLAG_NO_INPUT) &&
@@ -268,8 +263,7 @@ ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p,
268 int num; 263 int num;
269 264
270 if ((e == NULL) || (cmd_name == NULL)) { 265 if ((e == NULL) || (cmd_name == NULL)) {
271 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD, 266 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
272 ERR_R_PASSED_NULL_PARAMETER);
273 return 0; 267 return 0;
274 } 268 }
275 if ((e->ctrl == NULL) || 269 if ((e->ctrl == NULL) ||
@@ -285,7 +279,7 @@ ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p,
285 ERR_clear_error(); 279 ERR_clear_error();
286 return 1; 280 return 1;
287 } 281 }
288 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD, ENGINE_R_INVALID_CMD_NAME); 282 ENGINEerror(ENGINE_R_INVALID_CMD_NAME);
289 return 0; 283 return 0;
290 } 284 }
291 285
@@ -306,8 +300,7 @@ ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
306 char *ptr; 300 char *ptr;
307 301
308 if ((e == NULL) || (cmd_name == NULL)) { 302 if ((e == NULL) || (cmd_name == NULL)) {
309 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 303 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
310 ERR_R_PASSED_NULL_PARAMETER);
311 return 0; 304 return 0;
312 } 305 }
313 if ((e->ctrl == NULL) || 306 if ((e->ctrl == NULL) ||
@@ -323,29 +316,25 @@ ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
323 ERR_clear_error(); 316 ERR_clear_error();
324 return 1; 317 return 1;
325 } 318 }
326 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 319 ENGINEerror(ENGINE_R_INVALID_CMD_NAME);
327 ENGINE_R_INVALID_CMD_NAME);
328 return 0; 320 return 0;
329 } 321 }
330 if (!ENGINE_cmd_is_executable(e, num)) { 322 if (!ENGINE_cmd_is_executable(e, num)) {
331 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 323 ENGINEerror(ENGINE_R_CMD_NOT_EXECUTABLE);
332 ENGINE_R_CMD_NOT_EXECUTABLE);
333 return 0; 324 return 0;
334 } 325 }
335 if ((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, num, 326 if ((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, num,
336 NULL, NULL)) < 0) { 327 NULL, NULL)) < 0) {
337 /* Shouldn't happen, given that ENGINE_cmd_is_executable() 328 /* Shouldn't happen, given that ENGINE_cmd_is_executable()
338 * returned success. */ 329 * returned success. */
339 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 330 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
340 ENGINE_R_INTERNAL_LIST_ERROR);
341 return 0; 331 return 0;
342 } 332 }
343 /* If the command takes no input, there must be no input. And vice 333 /* If the command takes no input, there must be no input. And vice
344 * versa. */ 334 * versa. */
345 if (flags & ENGINE_CMD_FLAG_NO_INPUT) { 335 if (flags & ENGINE_CMD_FLAG_NO_INPUT) {
346 if (arg != NULL) { 336 if (arg != NULL) {
347 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 337 ENGINEerror(ENGINE_R_COMMAND_TAKES_NO_INPUT);
348 ENGINE_R_COMMAND_TAKES_NO_INPUT);
349 return 0; 338 return 0;
350 } 339 }
351 /* We deliberately force the result of ENGINE_ctrl() to 0 or 1 340 /* We deliberately force the result of ENGINE_ctrl() to 0 or 1
@@ -359,8 +348,7 @@ ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
359 } 348 }
360 /* So, we require input */ 349 /* So, we require input */
361 if (arg == NULL) { 350 if (arg == NULL) {
362 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 351 ENGINEerror(ENGINE_R_COMMAND_TAKES_INPUT);
363 ENGINE_R_COMMAND_TAKES_INPUT);
364 return 0; 352 return 0;
365 } 353 }
366 /* If it takes string input, that's easy */ 354 /* If it takes string input, that's easy */
@@ -375,14 +363,12 @@ ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
375 * should never happen though, because ENGINE_cmd_is_executable() was 363 * should never happen though, because ENGINE_cmd_is_executable() was
376 * used. */ 364 * used. */
377 if (!(flags & ENGINE_CMD_FLAG_NUMERIC)) { 365 if (!(flags & ENGINE_CMD_FLAG_NUMERIC)) {
378 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 366 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
379 ENGINE_R_INTERNAL_LIST_ERROR);
380 return 0; 367 return 0;
381 } 368 }
382 l = strtol(arg, &ptr, 10); 369 l = strtol(arg, &ptr, 10);
383 if ((arg == ptr) || (*ptr != '\0')) { 370 if ((arg == ptr) || (*ptr != '\0')) {
384 ENGINEerr(ENGINE_F_ENGINE_CTRL_CMD_STRING, 371 ENGINEerror(ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER);
385 ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER);
386 return 0; 372 return 0;
387 } 373 }
388 /* Force the result of the control command to 0 or 1, for the reasons 374 /* Force the result of the control command to 0 or 1, for the reasons
diff --git a/src/lib/libcrypto/engine/eng_err.c b/src/lib/libcrypto/engine/eng_err.c
index d65efde991..b604cbba9e 100644
--- a/src/lib/libcrypto/engine/eng_err.c
+++ b/src/lib/libcrypto/engine/eng_err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_err.c,v 1.10 2014/07/10 22:45:57 jsing Exp $ */ 1/* $OpenBSD: eng_err.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -72,45 +72,7 @@
72#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ENGINE,0,reason) 72#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ENGINE,0,reason)
73 73
74static ERR_STRING_DATA ENGINE_str_functs[] = { 74static ERR_STRING_DATA ENGINE_str_functs[] = {
75 {ERR_FUNC(ENGINE_F_DYNAMIC_CTRL), "DYNAMIC_CTRL"}, 75 {ERR_FUNC(0xfff), "CRYPTO_internal"},
76 {ERR_FUNC(ENGINE_F_DYNAMIC_GET_DATA_CTX), "DYNAMIC_GET_DATA_CTX"},
77 {ERR_FUNC(ENGINE_F_DYNAMIC_LOAD), "DYNAMIC_LOAD"},
78 {ERR_FUNC(ENGINE_F_DYNAMIC_SET_DATA_CTX), "DYNAMIC_SET_DATA_CTX"},
79 {ERR_FUNC(ENGINE_F_ENGINE_ADD), "ENGINE_add"},
80 {ERR_FUNC(ENGINE_F_ENGINE_BY_ID), "ENGINE_by_id"},
81 {ERR_FUNC(ENGINE_F_ENGINE_CMD_IS_EXECUTABLE), "ENGINE_cmd_is_executable"},
82 {ERR_FUNC(ENGINE_F_ENGINE_CTRL), "ENGINE_ctrl"},
83 {ERR_FUNC(ENGINE_F_ENGINE_CTRL_CMD), "ENGINE_ctrl_cmd"},
84 {ERR_FUNC(ENGINE_F_ENGINE_CTRL_CMD_STRING), "ENGINE_ctrl_cmd_string"},
85 {ERR_FUNC(ENGINE_F_ENGINE_FINISH), "ENGINE_finish"},
86 {ERR_FUNC(ENGINE_F_ENGINE_FREE_UTIL), "ENGINE_FREE_UTIL"},
87 {ERR_FUNC(ENGINE_F_ENGINE_GET_CIPHER), "ENGINE_get_cipher"},
88 {ERR_FUNC(ENGINE_F_ENGINE_GET_DEFAULT_TYPE), "ENGINE_GET_DEFAULT_TYPE"},
89 {ERR_FUNC(ENGINE_F_ENGINE_GET_DIGEST), "ENGINE_get_digest"},
90 {ERR_FUNC(ENGINE_F_ENGINE_GET_NEXT), "ENGINE_get_next"},
91 {ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH), "ENGINE_get_pkey_asn1_meth"},
92 {ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_METH), "ENGINE_get_pkey_meth"},
93 {ERR_FUNC(ENGINE_F_ENGINE_GET_PREV), "ENGINE_get_prev"},
94 {ERR_FUNC(ENGINE_F_ENGINE_INIT), "ENGINE_init"},
95 {ERR_FUNC(ENGINE_F_ENGINE_LIST_ADD), "ENGINE_LIST_ADD"},
96 {ERR_FUNC(ENGINE_F_ENGINE_LIST_REMOVE), "ENGINE_LIST_REMOVE"},
97 {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY), "ENGINE_load_private_key"},
98 {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY), "ENGINE_load_public_key"},
99 {ERR_FUNC(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT), "ENGINE_load_ssl_client_cert"},
100 {ERR_FUNC(ENGINE_F_ENGINE_NEW), "ENGINE_new"},
101 {ERR_FUNC(ENGINE_F_ENGINE_REMOVE), "ENGINE_remove"},
102 {ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_STRING), "ENGINE_set_default_string"},
103 {ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_TYPE), "ENGINE_SET_DEFAULT_TYPE"},
104 {ERR_FUNC(ENGINE_F_ENGINE_SET_ID), "ENGINE_set_id"},
105 {ERR_FUNC(ENGINE_F_ENGINE_SET_NAME), "ENGINE_set_name"},
106 {ERR_FUNC(ENGINE_F_ENGINE_TABLE_REGISTER), "ENGINE_TABLE_REGISTER"},
107 {ERR_FUNC(ENGINE_F_ENGINE_UNLOAD_KEY), "ENGINE_UNLOAD_KEY"},
108 {ERR_FUNC(ENGINE_F_ENGINE_UNLOCKED_FINISH), "ENGINE_UNLOCKED_FINISH"},
109 {ERR_FUNC(ENGINE_F_ENGINE_UP_REF), "ENGINE_up_ref"},
110 {ERR_FUNC(ENGINE_F_INT_CTRL_HELPER), "INT_CTRL_HELPER"},
111 {ERR_FUNC(ENGINE_F_INT_ENGINE_CONFIGURE), "INT_ENGINE_CONFIGURE"},
112 {ERR_FUNC(ENGINE_F_INT_ENGINE_MODULE_INIT), "INT_ENGINE_MODULE_INIT"},
113 {ERR_FUNC(ENGINE_F_LOG_MESSAGE), "LOG_MESSAGE"},
114 {0, NULL} 76 {0, NULL}
115}; 77};
116 78
diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c
index b54757d8ad..c97695a7d3 100644
--- a/src/lib/libcrypto/engine/eng_fat.c
+++ b/src/lib/libcrypto/engine/eng_fat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_fat.c,v 1.15 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_fat.c,v 1.16 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -147,8 +147,7 @@ ENGINE_set_default_string(ENGINE *e, const char *def_list)
147 unsigned int flags = 0; 147 unsigned int flags = 0;
148 148
149 if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) { 149 if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) {
150 ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING, 150 ENGINEerror(ENGINE_R_INVALID_STRING);
151 ENGINE_R_INVALID_STRING);
152 ERR_asprintf_error_data("str=%s",def_list); 151 ERR_asprintf_error_data("str=%s",def_list);
153 return 0; 152 return 0;
154 } 153 }
diff --git a/src/lib/libcrypto/engine/eng_init.c b/src/lib/libcrypto/engine/eng_init.c
index b50e22594c..75d6698c70 100644
--- a/src/lib/libcrypto/engine/eng_init.c
+++ b/src/lib/libcrypto/engine/eng_init.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_init.c,v 1.7 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_init.c,v 1.8 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -106,8 +106,7 @@ engine_unlocked_finish(ENGINE *e, int unlock_for_handlers)
106 106
107 /* Release the structural reference too */ 107 /* Release the structural reference too */
108 if (!engine_free_util(e, 0)) { 108 if (!engine_free_util(e, 0)) {
109 ENGINEerr(ENGINE_F_ENGINE_UNLOCKED_FINISH, 109 ENGINEerror(ENGINE_R_FINISH_FAILED);
110 ENGINE_R_FINISH_FAILED);
111 return 0; 110 return 0;
112 } 111 }
113 return to_return; 112 return to_return;
@@ -120,7 +119,7 @@ ENGINE_init(ENGINE *e)
120 int ret; 119 int ret;
121 120
122 if (e == NULL) { 121 if (e == NULL) {
123 ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER); 122 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
124 return 0; 123 return 0;
125 } 124 }
126 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 125 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
@@ -136,14 +135,14 @@ ENGINE_finish(ENGINE *e)
136 int to_return = 1; 135 int to_return = 1;
137 136
138 if (e == NULL) { 137 if (e == NULL) {
139 ENGINEerr(ENGINE_F_ENGINE_FINISH, ERR_R_PASSED_NULL_PARAMETER); 138 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
140 return 0; 139 return 0;
141 } 140 }
142 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 141 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
143 to_return = engine_unlocked_finish(e, 1); 142 to_return = engine_unlocked_finish(e, 1);
144 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 143 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
145 if (!to_return) { 144 if (!to_return) {
146 ENGINEerr(ENGINE_F_ENGINE_FINISH, ENGINE_R_FINISH_FAILED); 145 ENGINEerror(ENGINE_R_FINISH_FAILED);
147 return 0; 146 return 0;
148 } 147 }
149 return to_return; 148 return to_return;
diff --git a/src/lib/libcrypto/engine/eng_lib.c b/src/lib/libcrypto/engine/eng_lib.c
index f5f54fc657..d2da29fe69 100644
--- a/src/lib/libcrypto/engine/eng_lib.c
+++ b/src/lib/libcrypto/engine/eng_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_lib.c,v 1.11 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_lib.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -72,7 +72,7 @@ ENGINE_new(void)
72 72
73 ret = malloc(sizeof(ENGINE)); 73 ret = malloc(sizeof(ENGINE));
74 if (ret == NULL) { 74 if (ret == NULL) {
75 ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE); 75 ENGINEerror(ERR_R_MALLOC_FAILURE);
76 return NULL; 76 return NULL;
77 } 77 }
78 memset(ret, 0, sizeof(ENGINE)); 78 memset(ret, 0, sizeof(ENGINE));
@@ -113,8 +113,7 @@ engine_free_util(ENGINE *e, int locked)
113 int i; 113 int i;
114 114
115 if (e == NULL) { 115 if (e == NULL) {
116 ENGINEerr(ENGINE_F_ENGINE_FREE_UTIL, 116 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
117 ERR_R_PASSED_NULL_PARAMETER);
118 return 0; 117 return 0;
119 } 118 }
120 if (locked) 119 if (locked)
@@ -245,8 +244,7 @@ int
245ENGINE_set_id(ENGINE *e, const char *id) 244ENGINE_set_id(ENGINE *e, const char *id)
246{ 245{
247 if (id == NULL) { 246 if (id == NULL) {
248 ENGINEerr(ENGINE_F_ENGINE_SET_ID, 247 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
249 ERR_R_PASSED_NULL_PARAMETER);
250 return 0; 248 return 0;
251 } 249 }
252 e->id = id; 250 e->id = id;
@@ -257,8 +255,7 @@ int
257ENGINE_set_name(ENGINE *e, const char *name) 255ENGINE_set_name(ENGINE *e, const char *name)
258{ 256{
259 if (name == NULL) { 257 if (name == NULL) {
260 ENGINEerr(ENGINE_F_ENGINE_SET_NAME, 258 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
261 ERR_R_PASSED_NULL_PARAMETER);
262 return 0; 259 return 0;
263 } 260 }
264 e->name = name; 261 e->name = name;
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c
index fc1d16b183..8bb1bc58f2 100644
--- a/src/lib/libcrypto/engine/eng_list.c
+++ b/src/lib/libcrypto/engine/eng_list.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_list.c,v 1.21 2015/07/19 00:56:48 bcook Exp $ */ 1/* $OpenBSD: eng_list.c,v 1.22 2017/01/29 17:49:23 beck Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -105,8 +105,7 @@ engine_list_add(ENGINE *e)
105 ENGINE *iterator = NULL; 105 ENGINE *iterator = NULL;
106 106
107 if (e == NULL) { 107 if (e == NULL) {
108 ENGINEerr(ENGINE_F_ENGINE_LIST_ADD, 108 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
109 ERR_R_PASSED_NULL_PARAMETER);
110 return 0; 109 return 0;
111 } 110 }
112 iterator = engine_list_head; 111 iterator = engine_list_head;
@@ -115,15 +114,13 @@ engine_list_add(ENGINE *e)
115 iterator = iterator->next; 114 iterator = iterator->next;
116 } 115 }
117 if (conflict) { 116 if (conflict) {
118 ENGINEerr(ENGINE_F_ENGINE_LIST_ADD, 117 ENGINEerror(ENGINE_R_CONFLICTING_ENGINE_ID);
119 ENGINE_R_CONFLICTING_ENGINE_ID);
120 return 0; 118 return 0;
121 } 119 }
122 if (engine_list_head == NULL) { 120 if (engine_list_head == NULL) {
123 /* We are adding to an empty list. */ 121 /* We are adding to an empty list. */
124 if (engine_list_tail) { 122 if (engine_list_tail) {
125 ENGINEerr(ENGINE_F_ENGINE_LIST_ADD, 123 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
126 ENGINE_R_INTERNAL_LIST_ERROR);
127 return 0; 124 return 0;
128 } 125 }
129 engine_list_head = e; 126 engine_list_head = e;
@@ -135,8 +132,7 @@ engine_list_add(ENGINE *e)
135 /* We are adding to the tail of an existing list. */ 132 /* We are adding to the tail of an existing list. */
136 if ((engine_list_tail == NULL) || 133 if ((engine_list_tail == NULL) ||
137 (engine_list_tail->next != NULL)) { 134 (engine_list_tail->next != NULL)) {
138 ENGINEerr(ENGINE_F_ENGINE_LIST_ADD, 135 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
139 ENGINE_R_INTERNAL_LIST_ERROR);
140 return 0; 136 return 0;
141 } 137 }
142 engine_list_tail->next = e; 138 engine_list_tail->next = e;
@@ -158,8 +154,7 @@ engine_list_remove(ENGINE *e)
158 ENGINE *iterator; 154 ENGINE *iterator;
159 155
160 if (e == NULL) { 156 if (e == NULL) {
161 ENGINEerr(ENGINE_F_ENGINE_LIST_REMOVE, 157 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
162 ERR_R_PASSED_NULL_PARAMETER);
163 return 0; 158 return 0;
164 } 159 }
165 /* We need to check that e is in our linked list! */ 160 /* We need to check that e is in our linked list! */
@@ -167,8 +162,7 @@ engine_list_remove(ENGINE *e)
167 while (iterator && (iterator != e)) 162 while (iterator && (iterator != e))
168 iterator = iterator->next; 163 iterator = iterator->next;
169 if (iterator == NULL) { 164 if (iterator == NULL) {
170 ENGINEerr(ENGINE_F_ENGINE_LIST_REMOVE, 165 ENGINEerror(ENGINE_R_ENGINE_IS_NOT_IN_LIST);
171 ENGINE_R_ENGINE_IS_NOT_IN_LIST);
172 return 0; 166 return 0;
173 } 167 }
174 /* un-link e from the chain. */ 168 /* un-link e from the chain. */
@@ -223,8 +217,7 @@ ENGINE_get_next(ENGINE *e)
223 ENGINE *ret = NULL; 217 ENGINE *ret = NULL;
224 218
225 if (e == NULL) { 219 if (e == NULL) {
226 ENGINEerr(ENGINE_F_ENGINE_GET_NEXT, 220 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
227 ERR_R_PASSED_NULL_PARAMETER);
228 return 0; 221 return 0;
229 } 222 }
230 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 223 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
@@ -246,8 +239,7 @@ ENGINE_get_prev(ENGINE *e)
246 ENGINE *ret = NULL; 239 ENGINE *ret = NULL;
247 240
248 if (e == NULL) { 241 if (e == NULL) {
249 ENGINEerr(ENGINE_F_ENGINE_GET_PREV, 242 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
250 ERR_R_PASSED_NULL_PARAMETER);
251 return 0; 243 return 0;
252 } 244 }
253 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 245 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
@@ -270,18 +262,15 @@ ENGINE_add(ENGINE *e)
270 int to_return = 1; 262 int to_return = 1;
271 263
272 if (e == NULL) { 264 if (e == NULL) {
273 ENGINEerr(ENGINE_F_ENGINE_ADD, 265 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
274 ERR_R_PASSED_NULL_PARAMETER);
275 return 0; 266 return 0;
276 } 267 }
277 if ((e->id == NULL) || (e->name == NULL)) { 268 if ((e->id == NULL) || (e->name == NULL)) {
278 ENGINEerr(ENGINE_F_ENGINE_ADD, 269 ENGINEerror(ENGINE_R_ID_OR_NAME_MISSING);
279 ENGINE_R_ID_OR_NAME_MISSING);
280 } 270 }
281 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 271 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
282 if (!engine_list_add(e)) { 272 if (!engine_list_add(e)) {
283 ENGINEerr(ENGINE_F_ENGINE_ADD, 273 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
284 ENGINE_R_INTERNAL_LIST_ERROR);
285 to_return = 0; 274 to_return = 0;
286 } 275 }
287 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 276 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
@@ -295,14 +284,12 @@ ENGINE_remove(ENGINE *e)
295 int to_return = 1; 284 int to_return = 1;
296 285
297 if (e == NULL) { 286 if (e == NULL) {
298 ENGINEerr(ENGINE_F_ENGINE_REMOVE, 287 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
299 ERR_R_PASSED_NULL_PARAMETER);
300 return 0; 288 return 0;
301 } 289 }
302 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 290 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
303 if (!engine_list_remove(e)) { 291 if (!engine_list_remove(e)) {
304 ENGINEerr(ENGINE_F_ENGINE_REMOVE, 292 ENGINEerror(ENGINE_R_INTERNAL_LIST_ERROR);
305 ENGINE_R_INTERNAL_LIST_ERROR);
306 to_return = 0; 293 to_return = 0;
307 } 294 }
308 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 295 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
@@ -350,8 +337,7 @@ ENGINE_by_id(const char *id)
350 ENGINE *iterator; 337 ENGINE *iterator;
351 338
352 if (id == NULL) { 339 if (id == NULL) {
353 ENGINEerr(ENGINE_F_ENGINE_BY_ID, 340 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
354 ERR_R_PASSED_NULL_PARAMETER);
355 return NULL; 341 return NULL;
356 } 342 }
357 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 343 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
@@ -378,7 +364,7 @@ ENGINE_by_id(const char *id)
378 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 364 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
379 365
380 if (iterator == NULL) { 366 if (iterator == NULL) {
381 ENGINEerr(ENGINE_F_ENGINE_BY_ID, ENGINE_R_NO_SUCH_ENGINE); 367 ENGINEerror(ENGINE_R_NO_SUCH_ENGINE);
382 ERR_asprintf_error_data("id=%s", id); 368 ERR_asprintf_error_data("id=%s", id);
383 } 369 }
384 return iterator; 370 return iterator;
@@ -388,7 +374,7 @@ int
388ENGINE_up_ref(ENGINE *e) 374ENGINE_up_ref(ENGINE *e)
389{ 375{
390 if (e == NULL) { 376 if (e == NULL) {
391 ENGINEerr(ENGINE_F_ENGINE_UP_REF, ERR_R_PASSED_NULL_PARAMETER); 377 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
392 return 0; 378 return 0;
393 } 379 }
394 CRYPTO_add(&e->struct_ref, 1, CRYPTO_LOCK_ENGINE); 380 CRYPTO_add(&e->struct_ref, 1, CRYPTO_LOCK_ENGINE);
diff --git a/src/lib/libcrypto/engine/eng_pkey.c b/src/lib/libcrypto/engine/eng_pkey.c
index 74b1ce03b7..a0320e973f 100644
--- a/src/lib/libcrypto/engine/eng_pkey.c
+++ b/src/lib/libcrypto/engine/eng_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_pkey.c,v 1.6 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_pkey.c,v 1.7 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -108,27 +108,23 @@ ENGINE_load_private_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method,
108 EVP_PKEY *pkey; 108 EVP_PKEY *pkey;
109 109
110 if (e == NULL) { 110 if (e == NULL) {
111 ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, 111 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
112 ERR_R_PASSED_NULL_PARAMETER);
113 return 0; 112 return 0;
114 } 113 }
115 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 114 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
116 if (e->funct_ref == 0) { 115 if (e->funct_ref == 0) {
117 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 116 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
118 ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, 117 ENGINEerror(ENGINE_R_NOT_INITIALISED);
119 ENGINE_R_NOT_INITIALISED);
120 return 0; 118 return 0;
121 } 119 }
122 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 120 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
123 if (!e->load_privkey) { 121 if (!e->load_privkey) {
124 ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, 122 ENGINEerror(ENGINE_R_NO_LOAD_FUNCTION);
125 ENGINE_R_NO_LOAD_FUNCTION);
126 return 0; 123 return 0;
127 } 124 }
128 pkey = e->load_privkey(e, key_id, ui_method, callback_data); 125 pkey = e->load_privkey(e, key_id, ui_method, callback_data);
129 if (!pkey) { 126 if (!pkey) {
130 ENGINEerr(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY, 127 ENGINEerror(ENGINE_R_FAILED_LOADING_PRIVATE_KEY);
131 ENGINE_R_FAILED_LOADING_PRIVATE_KEY);
132 return 0; 128 return 0;
133 } 129 }
134 return pkey; 130 return pkey;
@@ -141,27 +137,23 @@ ENGINE_load_public_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method,
141 EVP_PKEY *pkey; 137 EVP_PKEY *pkey;
142 138
143 if (e == NULL) { 139 if (e == NULL) {
144 ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, 140 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
145 ERR_R_PASSED_NULL_PARAMETER);
146 return 0; 141 return 0;
147 } 142 }
148 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 143 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
149 if (e->funct_ref == 0) { 144 if (e->funct_ref == 0) {
150 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 145 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
151 ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, 146 ENGINEerror(ENGINE_R_NOT_INITIALISED);
152 ENGINE_R_NOT_INITIALISED);
153 return 0; 147 return 0;
154 } 148 }
155 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 149 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
156 if (!e->load_pubkey) { 150 if (!e->load_pubkey) {
157 ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, 151 ENGINEerror(ENGINE_R_NO_LOAD_FUNCTION);
158 ENGINE_R_NO_LOAD_FUNCTION);
159 return 0; 152 return 0;
160 } 153 }
161 pkey = e->load_pubkey(e, key_id, ui_method, callback_data); 154 pkey = e->load_pubkey(e, key_id, ui_method, callback_data);
162 if (!pkey) { 155 if (!pkey) {
163 ENGINEerr(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY, 156 ENGINEerror(ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
164 ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
165 return 0; 157 return 0;
166 } 158 }
167 return pkey; 159 return pkey;
@@ -173,21 +165,18 @@ ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, STACK_OF(X509_NAME) *ca_dn,
173 UI_METHOD *ui_method, void *callback_data) 165 UI_METHOD *ui_method, void *callback_data)
174{ 166{
175 if (e == NULL) { 167 if (e == NULL) {
176 ENGINEerr(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT, 168 ENGINEerror(ERR_R_PASSED_NULL_PARAMETER);
177 ERR_R_PASSED_NULL_PARAMETER);
178 return 0; 169 return 0;
179 } 170 }
180 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 171 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
181 if (e->funct_ref == 0) { 172 if (e->funct_ref == 0) {
182 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 173 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
183 ENGINEerr(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT, 174 ENGINEerror(ENGINE_R_NOT_INITIALISED);
184 ENGINE_R_NOT_INITIALISED);
185 return 0; 175 return 0;
186 } 176 }
187 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); 177 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
188 if (!e->load_ssl_client_cert) { 178 if (!e->load_ssl_client_cert) {
189 ENGINEerr(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT, 179 ENGINEerror(ENGINE_R_NO_LOAD_FUNCTION);
190 ENGINE_R_NO_LOAD_FUNCTION);
191 return 0; 180 return 0;
192 } 181 }
193 return e->load_ssl_client_cert(e, s, ca_dn, pcert, ppkey, pother, 182 return e->load_ssl_client_cert(e, s, ca_dn, pcert, ppkey, pother,
diff --git a/src/lib/libcrypto/engine/eng_table.c b/src/lib/libcrypto/engine/eng_table.c
index 342c76fa1b..a8aded5aaf 100644
--- a/src/lib/libcrypto/engine/eng_table.c
+++ b/src/lib/libcrypto/engine/eng_table.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: eng_table.c,v 1.8 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: eng_table.c,v 1.9 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -172,8 +172,7 @@ engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
172 fnd->uptodate = 0; 172 fnd->uptodate = 0;
173 if (setdefault) { 173 if (setdefault) {
174 if (!engine_unlocked_init(e)) { 174 if (!engine_unlocked_init(e)) {
175 ENGINEerr(ENGINE_F_ENGINE_TABLE_REGISTER, 175 ENGINEerror(ENGINE_R_INIT_FAILED);
176 ENGINE_R_INIT_FAILED);
177 goto end; 176 goto end;
178 } 177 }
179 if (fnd->funct) 178 if (fnd->funct)
diff --git a/src/lib/libcrypto/engine/tb_asnmth.c b/src/lib/libcrypto/engine/tb_asnmth.c
index 3ba5541933..51e5198b40 100644
--- a/src/lib/libcrypto/engine/tb_asnmth.c
+++ b/src/lib/libcrypto/engine/tb_asnmth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tb_asnmth.c,v 1.5 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: tb_asnmth.c,v 1.6 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -135,8 +135,7 @@ ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid)
135 ENGINE_PKEY_ASN1_METHS_PTR fn = ENGINE_get_pkey_asn1_meths(e); 135 ENGINE_PKEY_ASN1_METHS_PTR fn = ENGINE_get_pkey_asn1_meths(e);
136 136
137 if (!fn || !fn(e, &ret, NULL, nid)) { 137 if (!fn || !fn(e, &ret, NULL, nid)) {
138 ENGINEerr(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH, 138 ENGINEerror(ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
139 ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
140 return NULL; 139 return NULL;
141 } 140 }
142 return ret; 141 return ret;
diff --git a/src/lib/libcrypto/engine/tb_cipher.c b/src/lib/libcrypto/engine/tb_cipher.c
index a888d7a958..ed87ff199e 100644
--- a/src/lib/libcrypto/engine/tb_cipher.c
+++ b/src/lib/libcrypto/engine/tb_cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tb_cipher.c,v 1.7 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: tb_cipher.c,v 1.8 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -130,8 +130,7 @@ ENGINE_get_cipher(ENGINE *e, int nid)
130 ENGINE_CIPHERS_PTR fn = ENGINE_get_ciphers(e); 130 ENGINE_CIPHERS_PTR fn = ENGINE_get_ciphers(e);
131 131
132 if (!fn || !fn(e, &ret, NULL, nid)) { 132 if (!fn || !fn(e, &ret, NULL, nid)) {
133 ENGINEerr(ENGINE_F_ENGINE_GET_CIPHER, 133 ENGINEerror(ENGINE_R_UNIMPLEMENTED_CIPHER);
134 ENGINE_R_UNIMPLEMENTED_CIPHER);
135 return NULL; 134 return NULL;
136 } 135 }
137 return ret; 136 return ret;
diff --git a/src/lib/libcrypto/engine/tb_digest.c b/src/lib/libcrypto/engine/tb_digest.c
index f7720d39e7..f1a2e8a6b3 100644
--- a/src/lib/libcrypto/engine/tb_digest.c
+++ b/src/lib/libcrypto/engine/tb_digest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tb_digest.c,v 1.7 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: tb_digest.c,v 1.8 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -130,8 +130,7 @@ ENGINE_get_digest(ENGINE *e, int nid)
130 ENGINE_DIGESTS_PTR fn = ENGINE_get_digests(e); 130 ENGINE_DIGESTS_PTR fn = ENGINE_get_digests(e);
131 131
132 if (!fn || !fn(e, &ret, NULL, nid)) { 132 if (!fn || !fn(e, &ret, NULL, nid)) {
133 ENGINEerr(ENGINE_F_ENGINE_GET_DIGEST, 133 ENGINEerror(ENGINE_R_UNIMPLEMENTED_DIGEST);
134 ENGINE_R_UNIMPLEMENTED_DIGEST);
135 return NULL; 134 return NULL;
136 } 135 }
137 return ret; 136 return ret;
diff --git a/src/lib/libcrypto/engine/tb_pkmeth.c b/src/lib/libcrypto/engine/tb_pkmeth.c
index 3840434262..05566a3464 100644
--- a/src/lib/libcrypto/engine/tb_pkmeth.c
+++ b/src/lib/libcrypto/engine/tb_pkmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tb_pkmeth.c,v 1.5 2015/02/11 03:19:37 doug Exp $ */ 1/* $OpenBSD: tb_pkmeth.c,v 1.6 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -131,8 +131,7 @@ ENGINE_get_pkey_meth(ENGINE *e, int nid)
131 ENGINE_PKEY_METHS_PTR fn = ENGINE_get_pkey_meths(e); 131 ENGINE_PKEY_METHS_PTR fn = ENGINE_get_pkey_meths(e);
132 132
133 if (!fn || !fn(e, &ret, NULL, nid)) { 133 if (!fn || !fn(e, &ret, NULL, nid)) {
134 ENGINEerr(ENGINE_F_ENGINE_GET_PKEY_METH, 134 ENGINEerror(ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
135 ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
136 return NULL; 135 return NULL;
137 } 136 }
138 return ret; 137 return ret;