summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/x_pubkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/x_pubkey.c')
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index 3bdbb5a536..738507bbb6 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_pubkey.c,v 1.25 2015/02/11 04:00:39 jsing Exp $ */ 1/* $OpenBSD: x_pubkey.c,v 1.26 2017/01/29 17:49:22 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -149,17 +149,15 @@ X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
149 if (pkey->ameth) { 149 if (pkey->ameth) {
150 if (pkey->ameth->pub_encode) { 150 if (pkey->ameth->pub_encode) {
151 if (!pkey->ameth->pub_encode(pk, pkey)) { 151 if (!pkey->ameth->pub_encode(pk, pkey)) {
152 X509err(X509_F_X509_PUBKEY_SET, 152 X509error(X509_R_PUBLIC_KEY_ENCODE_ERROR);
153 X509_R_PUBLIC_KEY_ENCODE_ERROR);
154 goto error; 153 goto error;
155 } 154 }
156 } else { 155 } else {
157 X509err(X509_F_X509_PUBKEY_SET, 156 X509error(X509_R_METHOD_NOT_SUPPORTED);
158 X509_R_METHOD_NOT_SUPPORTED);
159 goto error; 157 goto error;
160 } 158 }
161 } else { 159 } else {
162 X509err(X509_F_X509_PUBKEY_SET, X509_R_UNSUPPORTED_ALGORITHM); 160 X509error(X509_R_UNSUPPORTED_ALGORITHM);
163 goto error; 161 goto error;
164 } 162 }
165 163
@@ -193,23 +191,22 @@ X509_PUBKEY_get(X509_PUBKEY *key)
193 goto error; 191 goto error;
194 192
195 if ((ret = EVP_PKEY_new()) == NULL) { 193 if ((ret = EVP_PKEY_new()) == NULL) {
196 X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); 194 X509error(ERR_R_MALLOC_FAILURE);
197 goto error; 195 goto error;
198 } 196 }
199 197
200 if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm))) { 198 if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm))) {
201 X509err(X509_F_X509_PUBKEY_GET, X509_R_UNSUPPORTED_ALGORITHM); 199 X509error(X509_R_UNSUPPORTED_ALGORITHM);
202 goto error; 200 goto error;
203 } 201 }
204 202
205 if (ret->ameth->pub_decode) { 203 if (ret->ameth->pub_decode) {
206 if (!ret->ameth->pub_decode(ret, key)) { 204 if (!ret->ameth->pub_decode(ret, key)) {
207 X509err(X509_F_X509_PUBKEY_GET, 205 X509error(X509_R_PUBLIC_KEY_DECODE_ERROR);
208 X509_R_PUBLIC_KEY_DECODE_ERROR);
209 goto error; 206 goto error;
210 } 207 }
211 } else { 208 } else {
212 X509err(X509_F_X509_PUBKEY_GET, X509_R_METHOD_NOT_SUPPORTED); 209 X509error(X509_R_METHOD_NOT_SUPPORTED);
213 goto error; 210 goto error;
214 } 211 }
215 212
@@ -304,7 +301,7 @@ i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
304 return 0; 301 return 0;
305 pktmp = EVP_PKEY_new(); 302 pktmp = EVP_PKEY_new();
306 if (!pktmp) { 303 if (!pktmp) {
307 ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE); 304 ASN1error(ERR_R_MALLOC_FAILURE);
308 return 0; 305 return 0;
309 } 306 }
310 EVP_PKEY_set1_RSA(pktmp, a); 307 EVP_PKEY_set1_RSA(pktmp, a);
@@ -346,7 +343,7 @@ i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
346 return 0; 343 return 0;
347 pktmp = EVP_PKEY_new(); 344 pktmp = EVP_PKEY_new();
348 if (!pktmp) { 345 if (!pktmp) {
349 ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE); 346 ASN1error(ERR_R_MALLOC_FAILURE);
350 return 0; 347 return 0;
351 } 348 }
352 EVP_PKEY_set1_DSA(pktmp, a); 349 EVP_PKEY_set1_DSA(pktmp, a);
@@ -387,7 +384,7 @@ i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp)
387 if (!a) 384 if (!a)
388 return (0); 385 return (0);
389 if ((pktmp = EVP_PKEY_new()) == NULL) { 386 if ((pktmp = EVP_PKEY_new()) == NULL) {
390 ASN1err(ASN1_F_I2D_EC_PUBKEY, ERR_R_MALLOC_FAILURE); 387 ASN1error(ERR_R_MALLOC_FAILURE);
391 return (0); 388 return (0);
392 } 389 }
393 EVP_PKEY_set1_EC_KEY(pktmp, a); 390 EVP_PKEY_set1_EC_KEY(pktmp, a);