diff options
author | beck <> | 2017-01-29 17:49:23 +0000 |
---|---|---|
committer | beck <> | 2017-01-29 17:49:23 +0000 |
commit | 957b11334a7afb14537322f0e4795b2e368b3f59 (patch) | |
tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/engine/eng_pkey.c | |
parent | df96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff) | |
download | openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2 openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/engine/eng_pkey.c')
-rw-r--r-- | src/lib/libcrypto/engine/eng_pkey.c | 35 |
1 files changed, 12 insertions, 23 deletions
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, |