aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-24 09:39:46 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-24 09:39:46 -0400
commitc380562aed5242eab6449b054199d742f02833dd (patch)
tree81cdc285f750e96d008e3e21d9f34e011d17d422 /src/common/crypto.c
parentd1e4ffc710fd6620614d4f7f20f6ed5d1c266ae4 (diff)
parentaeb4be1d5a17f8ff836e370f8942c09c66b31e1d (diff)
downloadtor-c380562aed5242eab6449b054199d742f02833dd.tar.gz
tor-c380562aed5242eab6449b054199d742f02833dd.zip
Merge branch 'bug26116_029' into maint-0.2.9
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 39c8cc2b0a..f8495bb107 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -653,7 +653,12 @@ pem_no_password_cb(char *buf, int size, int rwflag, void *u)
(void)size;
(void)rwflag;
(void)u;
- return 0;
+ /* The openssl documentation says that a callback "must" return 0 if an
+ * error occurred. But during the 1.1.1 series (commit c82c3462267afdbbaa5
+ * they changed the interpretation so that 0 indicates an empty password and
+ * -1 indicates an error. We want to reject any encrypted PEM buffers, so we
+ * return -1. This will work on older OpenSSL versions and LibreSSL too. */
+ return -1;
}
/** Read a PEM-encoded private key from the <b>len</b>-byte string <b>s</b>