summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorDarshan Sen <raisinten@gmail.com>2022-01-22 17:56:05 +0530
committerTomas Mraz <tomas@openssl.org>2022-01-26 17:23:06 +0100
commit09894bacc035fb4c68acfc3dd2798ad999eb3275 (patch)
treef11a11f3b48cfa11883b5a8a77de0c9925462534 /crypto/pem
parent481709cd4d9ad5b77f1550fd23b169934ff8e2b6 (diff)
Allow empty passphrase in PEM_write_bio_PKCS8PrivateKey_nid()
Signed-off-by: Darshan Sen <raisinten@gmail.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17507) (cherry picked from commit 1d28ada1c39997c10fe5392f4235bbd2bc44b40f)
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_pk8.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
index 4742f02fef..60ff09354b 100644
--- a/crypto/pem/pem_pk8.c
+++ b/crypto/pem/pem_pk8.c
@@ -136,7 +136,7 @@ static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid,
if (enc || (nid != -1)) {
if (kstr == NULL) {
klen = cb(buf, PEM_BUFSIZE, 1, u);
- if (klen <= 0) {
+ if (klen < 0) {
ERR_raise(ERR_LIB_PEM, PEM_R_READ_KEY);
goto legacy_end;
}