Compile tested with 3.0.1 and glanced over the code.  Not actually
tested (no management-external-key here) but I know that Arne is using
*this* in his Android app, so it got a good beating :-)

There might be a memory leak lurking here:

+#ifdef HAVE_XKEY_PROVIDER
+    EVP_PKEY *privkey = xkey_load_management_key(tls_libctx, pkey);
+    if (!privkey
+        || !SSL_CTX_use_PrivateKey(ctx->ctx, privkey))
+    {
+        goto cleanup;
+    }
+    EVP_PKEY_free(privkey);
+#else

if I read this right, the actual signing operation is happening
in SSL_CTX_use_PrivateKey() - so, if the key can be loaded fine
(privkey != NULL) but the actual signing fails, we "goto cleanup",
and never EVP_PKEY_free() it.  But I might be misunderstanding this.

Fixed one typo in a comment ("avaialble") on the fly.  Hope that 
won't come back as a "context not matching" conflict later on.


Your patch has been applied to the master branch.

commit c279986bf4814aad72f9358d8509aa35f54ff662
Author: Selva Nair
Date:   Tue Dec 14 11:59:16 2021 -0500

     A helper function to import private key for management-external-key

     Signed-off-by: Selva Nair <selva.n...@gmail.com>
     Acked-by: Arne Schwabe <a...@rfc2549.org>
     Message-Id: <20211214165928.30676-7-selva.n...@gmail.com>
     URL: 
https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23443.html
     Signed-off-by: Gert Doering <g...@greenie.muc.de>


--
kind regards,

Gert Doering



_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to