summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pem/pem_pk8.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pem/pem_pk8.c')
-rw-r--r--src/lib/libcrypto/pem/pem_pk8.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/libcrypto/pem/pem_pk8.c b/src/lib/libcrypto/pem/pem_pk8.c
index 4b3578f971..43581905f0 100644
--- a/src/lib/libcrypto/pem/pem_pk8.c
+++ b/src/lib/libcrypto/pem/pem_pk8.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pem_pk8.c,v 1.12 2016/09/04 16:10:38 jsing Exp $ */ 1/* $OpenBSD: pem_pk8.c,v 1.13 2017/01/29 17:49:23 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 *
@@ -116,8 +116,7 @@ do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc,
116 int ret; 116 int ret;
117 117
118 if (!(p8inf = EVP_PKEY2PKCS8(x))) { 118 if (!(p8inf = EVP_PKEY2PKCS8(x))) {
119 PEMerr(PEM_F_DO_PK8PKEY, 119 PEMerror(PEM_R_ERROR_CONVERTING_PRIVATE_KEY);
120 PEM_R_ERROR_CONVERTING_PRIVATE_KEY);
121 return 0; 120 return 0;
122 } 121 }
123 if (enc || (nid != -1)) { 122 if (enc || (nid != -1)) {
@@ -127,7 +126,7 @@ do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc,
127 else 126 else
128 klen = cb(buf, PEM_BUFSIZE, 1, u); 127 klen = cb(buf, PEM_BUFSIZE, 1, u);
129 if (klen <= 0) { 128 if (klen <= 0) {
130 PEMerr(PEM_F_DO_PK8PKEY, PEM_R_READ_KEY); 129 PEMerror(PEM_R_READ_KEY);
131 PKCS8_PRIV_KEY_INFO_free(p8inf); 130 PKCS8_PRIV_KEY_INFO_free(p8inf);
132 return 0; 131 return 0;
133 } 132 }
@@ -171,7 +170,7 @@ d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u)
171 else 170 else
172 klen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u); 171 klen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u);
173 if (klen <= 0) { 172 if (klen <= 0) {
174 PEMerr(PEM_F_D2I_PKCS8PRIVATEKEY_BIO, PEM_R_BAD_PASSWORD_READ); 173 PEMerror(PEM_R_BAD_PASSWORD_READ);
175 X509_SIG_free(p8); 174 X509_SIG_free(p8);
176 return NULL; 175 return NULL;
177 } 176 }
@@ -227,7 +226,7 @@ do_pk8pkey_fp(FILE *fp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER *enc,
227 int ret; 226 int ret;
228 227
229 if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) { 228 if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) {
230 PEMerr(PEM_F_DO_PK8PKEY_FP, ERR_R_BUF_LIB); 229 PEMerror(ERR_R_BUF_LIB);
231 return (0); 230 return (0);
232 } 231 }
233 ret = do_pk8pkey(bp, x, isder, nid, enc, kstr, klen, cb, u); 232 ret = do_pk8pkey(bp, x, isder, nid, enc, kstr, klen, cb, u);
@@ -242,7 +241,7 @@ d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u)
242 EVP_PKEY *ret; 241 EVP_PKEY *ret;
243 242
244 if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) { 243 if (!(bp = BIO_new_fp(fp, BIO_NOCLOSE))) {
245 PEMerr(PEM_F_D2I_PKCS8PRIVATEKEY_FP, ERR_R_BUF_LIB); 244 PEMerror(ERR_R_BUF_LIB);
246 return NULL; 245 return NULL;
247 } 246 }
248 ret = d2i_PKCS8PrivateKey_bio(bp, x, cb, u); 247 ret = d2i_PKCS8PrivateKey_bio(bp, x, cb, u);