]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Make return code external tls key match docs
authorJoost Rijneveld <joost@joostrijneveld.nl>
Wed, 28 Feb 2018 13:52:40 +0000 (14:52 +0100)
committerGert Doering <gert@greenie.muc.de>
Sun, 4 Mar 2018 09:45:57 +0000 (10:45 +0100)
In tls_ctx_use_external_private_key, the return codes were inverted
compared to what is documented in ssl_backend.h (and what can
reasonably be expected). Internally the return code is never checked,
so this did not directly result in any change of behavior.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20180228135240.22945-1-joost@joostrijneveld.nl>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16577.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl_mbedtls.c
src/openvpn/ssl_openssl.c

index 3906cd55f9f090e4eff7378c827350320c4584da..8e31980a3ca841d543b56e488224a2155fa4c3cc 100644 (file)
@@ -630,7 +630,7 @@ tls_ctx_use_external_private_key(struct tls_root_ctx *ctx,
 
     if (ctx->crt_chain == NULL)
     {
-        return 0;
+        return 1;
     }
 
     ALLOC_OBJ_CLEAR(ctx->external_key, struct external_context);
@@ -640,10 +640,10 @@ tls_ctx_use_external_private_key(struct tls_root_ctx *ctx,
     if (!mbed_ok(mbedtls_pk_setup_rsa_alt(ctx->priv_key, ctx->external_key,
                                           NULL, external_pkcs1_sign, external_key_len)))
     {
-        return 0;
+        return 1;
     }
 
-    return 1;
+    return 0;
 }
 #endif /* ifdef MANAGMENT_EXTERNAL_KEY */
 
index d91458b0c9b67735f9a6e7987cb97da9cbaa77b8..8ef68ebd71d6c05599a0da93285b1aab153932d7 100644 (file)
@@ -1327,11 +1327,11 @@ tls_ctx_use_external_private_key(struct tls_root_ctx *ctx,
         goto err;
     }
 #endif /* OPENSSL_VERSION_NUMBER > 1.1.0 dev */
-    return 1;
+    return 0;
 
 err:
     crypto_msg(M_FATAL, "Cannot enable SSL external private key capability");
-    return 0;
+    return 1;
 }
 
 #endif /* ifdef MANAGMENT_EXTERNAL_KEY */