summaryrefslogtreecommitdiffstats
path: root/src/crypto/pem/pem_pk8.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/pem/pem_pk8.c')
-rw-r--r--src/crypto/pem/pem_pk8.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto/pem/pem_pk8.c b/src/crypto/pem/pem_pk8.c
index 383a524..035038e 100644
--- a/src/crypto/pem/pem_pk8.c
+++ b/src/crypto/pem/pem_pk8.c
@@ -124,8 +124,8 @@ static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, int nid, const EVP_CIPHER
if(enc || (nid != -1)) {
if(!kstr) {
klen = 0;
- if (cb)
- klen = cb(buf, PEM_BUFSIZE, 1, u);
+ if (!cb) cb = PEM_def_callback;
+ klen = cb(buf, PEM_BUFSIZE, 1, u);
if(klen <= 0) {
OPENSSL_PUT_ERROR(PEM, do_pk8pkey, PEM_R_READ_KEY);
PKCS8_PRIV_KEY_INFO_free(p8inf);
@@ -160,8 +160,8 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo
if(!p8) return NULL;
klen = 0;
- if (cb)
- klen=cb(psbuf,PEM_BUFSIZE,0,u);
+ if (!cb) cb = PEM_def_callback;
+ klen=cb(psbuf,PEM_BUFSIZE,0,u);
if (klen <= 0) {
OPENSSL_PUT_ERROR(PEM, d2i_PKCS8PrivateKey_bio, PEM_R_BAD_PASSWORD_READ);
X509_SIG_free(p8);