]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Add message when decoding PKCS12 file fails.
authorArne Schwabe <arne@rfc2549.org>
Tue, 19 Oct 2021 18:31:22 +0000 (20:31 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 21 Oct 2021 06:20:50 +0000 (08:20 +0200)
Currently we never display the OpenSSL error stack when decoding a
PCKS12 file fails. With LibreSSL defaulting to RC2-40-CBC, the failure
might not be a wrong password but can actually be an unsupported encoding,
seeing the error stack is really helpful (example from OpenSSL 3.0):

error:0308010C:digital envelope routines:inner_evp_generic_fetch:
  unsupported:crypto/evp/evp_fetch.c:346:Global default library
  context, Algorithm (RC2-40-CBC : 0), Properties ()

to pinpoint the issue

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211019183127.614175-17-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23017.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl_openssl.c

index 9a7cb9c6413377eae964748f3512cf5115dbdbad..30fc7aef196fe7e1afe36301a3e795f72072ca77 100644 (file)
@@ -806,6 +806,8 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file,
         ca = NULL;
         if (!PKCS12_parse(p12, password, &pkey, &cert, &ca))
         {
+            crypto_msg(M_WARN, "Decoding PKCS12 failed. Probably wrong password "
+                               "or unsupported/legacy encryption");
 #ifdef ENABLE_MANAGEMENT
             if (management && (ERR_GET_REASON(ERR_peek_error()) == PKCS12_R_MAC_VERIFY_FAILURE))
             {