Fix building with LibreSSL 2.5.1 by cleaning a hack. Similar to what is done in curl: https://github.com/curl/curl/blob/028391df5d84d9fae3433afdee9261d565900355/lib/vtls/openssl.c#L603-L619
PATCH 1/1 Fix building with LibreSSL 2.5.1 by cleaning a hack. Similar to what is done in curl: https://github.com/curl/curl/blob/028391df5d84d9fae3433afdee9261d565900355/lib/vtls/openssl.c#L603-L619
Use SSL_CTX_get0_privatekey() for OpenSSL >= 1.0.2
--- src/openvpn/ssl_openssl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
src/openvpn/ssl_openssl.c +11 -3
@@ -508,10 +508,18 @@ tls_ctx_load_ecdh_params(struct tls_root_ctx *ctx, const char *curve_nameconst EC_GROUP *ecgrp =NULL ;EVP_PKEY *pkey =NULL ; +#if OPENSSL_VERSION_NUMBER >=0x10002000L && !defined(LIBRESSL_VERSION_NUMBER ) + pkey =SSL_CTX_get0_privatekey (ctx->ctx); +#else /* Little hack to get private key ref from SSL_CTX, yay OpenSSL... */ -SSL ssl; - ssl.cert = ctx->ctx->cert; - pkey =SSL_get_privatekey (&ssl); +SSL *ssl =SSL_new (ctx->ctx); +if (!ssl) + { +crypto_msg (M_FATAL ,"SSL_new failed" ); + } + pkey =SSL_get_privatekey (ssl); +SSL_free (ssl); +#endif msg (D_TLS_DEBUG ,"Extracting ECDH curve from private key" );
Signature · 1 line
2.11.1
Hi,
Quoted 24 lines · On 13-02-17 19:38, O2 Graphics wrote:
Use
SSL_CTX_get0_privatekey()for OpenSSL >= 1.0.2Signed-off-by Olivier Wahrenberger <[email protected]...>--- src/openvpn/ssl_openssl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)src/openvpn/ssl_openssl.c +4
-3@@ -508,10 +508,18 @@ tls_ctx_load_ecdh_params(struct tls_root_ctx *ctx, const char *curve_nameconst EC_GROUP *ecgrp =NULL ;EVP_PKEY *pkey =NULL ; +#if OPENSSL_VERSION_NUMBER >=0x10002000L && !defined(LIBRESSL_VERSION_NUMBER ) + pkey =SSL_CTX_get0_privatekey (ctx->ctx); +#else /* Little hack to get private key ref from SSL_CTX, yay OpenSSL... */ -SSL ssl; - ssl.cert = ctx->ctx->cert; - pkey =SSL_get_privatekey (&ssl); +SSL *ssl =SSL_new (ctx->ctx);
src/openvpn/ssl_openssl.c tls_ctx_load_ecdh_params(struct tls_root_ctx *ctx, const char *curve_name · line 525
Quoted 10 lines
src/openvpn/ssl_openssl.c +7
-0+if (!ssl) + { +crypto_msg (M_FATAL ,"SSL_new failed" ); + } + pkey =SSL_get_privatekey (ssl); +SSL_free (ssl); +#endif msg (D_TLS_DEBUG ,"Extracting ECDH curve from private key" );
Code still looks good, patch looks a lot better (applies cleanly now), but could use an extra newline in the subject. But that doesn't warrant an extra patch iteration, so ACK.
-Steffan
Hello Steffan,
2017-02-14 23:00 GMT+01:00 Steffan Karger <[email protected]...>:
Quoted 3 lines
Code still looks good, patch looks a lot better (applies cleanly now), but could use an extra newline in the subject. But that doesn't warrant an extra patch iteration, so ACK.
Great, thanks!
Yes, I don't know why my commit has a long line i the subject, when I used "git commit --amend" to change the message, "Similar to what..." was on a new line. Next time I'll contribute to OpenVPN, I'll try to make less mistakes with git.
Best Regards,
Olivier
Quoted 4 lines · Olivier W
Hello Steffan,
2017-02-14 23:00 GMT+01:00 Steffan Karger <[email protected]...>:
Quoted 8 lines
Quoted 3 lines
Code still looks good, patch looks a lot better (applies cleanly now), but could use an extra newline in the subject. But that doesn't warrant an extra patch iteration, so ACK.
Great, thanks!
Yes, I don't know why my commit has a long line i the subject, when I used "git commit --amend" to change the message, "Similar to what..." was on a new line.
You need to put an empty line between the subject and the body. For example:
my commit message
this is the body and can be multiline
random text here...
and here...
Cheers,
Signature · 1 line
Antonio Quartulli
Hello Antonio,
2017-02-16 3:34 GMT+01:00 Antonio Quartulli <[email protected]...>:
Quoted 10 lines
You need to put an empty line between the subject and the body. For example:
my commit message
this is the body and can be multiline
random text here...
and here...
Thanks, I'll remember for a next time.
Best Regards,
Olivier
Your patch has been applied to the master and release/2.4 branch.
Not sure if it is something we want in release/2.3, but it wouldn't apply with "git cherry-pick" - too much formatting changes, so one would need to do it manually ("but we knew this").
commit dcfd3b6173d8cdb4658de23db1dd0bd932b390d2 (master) commit fb802b9b0d9366093b5567c0f3e9845b2f30e9cc (release/2.4)
Author: Olivier Wahrenberger Date: Mon Feb 13 19:38:26 2017 +0100
Fix building with LibreSSL 2.5.1 by cleaning a hack.
Signed-off-by: Olivier Wahrenberger <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg14045.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hello Gert,
2017-02-16 8:47 GMT+01:00 Gert Doering <[email protected]...>:
Quoted 5 lines
Your patch has been applied to the master and release/2.4 branch.
Not sure if it is something we want in release/2.3, but it wouldn't apply with "git cherry-pick" - too much formatting changes, so one would need to do it manually ("but we knew this").
I just had a quick look at release/2.3 and the code I patched (around the SSL_get_privatekey() call) isn't present at all. So there's no need for a patch there.
Best Regards,
Olivier
Hi,
Quoted 10 lines · Olivier W
2017-02-16 8:47 GMT+01:00 Gert Doering <[email protected]...>:
Quoted 5 lines
Your patch has been applied to the master and release/2.4 branch.
Not sure if it is something we want in release/2.3, but it wouldn't apply with "git cherry-pick" - too much formatting changes, so one would need to do it manually ("but we knew this").
I just had a quick look at release/2.3 and the code I patched (around the
SSL_get_privatekey()call) isn't present at all. So there's no need for a patch there.
That's even easier, then ;-) - I didn't check, just tried to cherrypick, it didn't apply, and I *assumed* that it was due to the massive formatting cleanup. But obviously "the to-be-patched code is not there" is a much better reason...
thanks for checking,
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...