Skip to content

Commit

Permalink
Make return code external tls key match docs
Browse files Browse the repository at this point in the history
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 <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg16577.html

Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
joostrijneveld authored and cron2 committed Mar 4, 2018
1 parent b607900 commit 6bee1a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/openvpn/ssl_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */

Expand Down
4 changes: 2 additions & 2 deletions src/openvpn/ssl_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 6bee1a1

Please sign in to comment.