[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 72/151: openssl: retrieve reported LibreSSL version at runtime
From: |
gnunet |
Subject: |
[gnurl] 72/151: openssl: retrieve reported LibreSSL version at runtime |
Date: |
Fri, 20 Dec 2019 14:26:21 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 0436d4438a9dbfd5dc1364de31281505c7915b25
Author: Jay Satiro <address@hidden>
AuthorDate: Sat Mar 24 00:57:42 2018 -0400
openssl: retrieve reported LibreSSL version at runtime
- Retrieve LibreSSL runtime version when supported (>= 2.7.1).
For earlier versions we continue to use the compile-time version.
Ref: https://man.openbsd.org/OPENSSL_VERSION_NUMBER.3
Closes https://github.com/curl/curl/pull/2425
---
lib/vtls/openssl.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index e5bd9d604..32d0e449e 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -142,10 +142,6 @@
#endif
#endif
-#ifdef LIBRESSL_VERSION_NUMBER
-#define OpenSSL_version_num() LIBRESSL_VERSION_NUMBER
-#endif
-
#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* 1.0.2 or later */ \
!(defined(LIBRESSL_VERSION_NUMBER) && \
LIBRESSL_VERSION_NUMBER < 0x20700000L)
@@ -3975,13 +3971,35 @@ static ssize_t ossl_recv(struct connectdata *conn, /*
connection data */
static size_t Curl_ossl_version(char *buffer, size_t size)
{
-#ifdef OPENSSL_IS_BORINGSSL
+#ifdef LIBRESSL_VERSION_NUMBER
+#if LIBRESSL_VERSION_NUMBER < 0x2070100fL
+ return msnprintf(buffer, size, "%s/%lx.%lx.%lx",
+ OSSL_PACKAGE,
+ (LIBRESSL_VERSION_NUMBER>>28)&0xf,
+ (LIBRESSL_VERSION_NUMBER>>20)&0xff,
+ (LIBRESSL_VERSION_NUMBER>>12)&0xff);
+#else /* OpenSSL_version() first appeared in LibreSSL 2.7.1 */
+ char *p;
+ int count;
+ const char *ver = OpenSSL_version(OPENSSL_VERSION);
+ const char expected[] = OSSL_PACKAGE " "; /* ie "LibreSSL " */
+ if(Curl_strncasecompare(ver, expected, sizeof(expected) - 1)) {
+ ver += sizeof(expected) - 1;
+ }
+ count = msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
+ for(p = buffer; *p; ++p) {
+ if(ISSPACE(*p))
+ *p = '_';
+ }
+ return count;
+#endif
+#elif defined(OPENSSL_IS_BORINGSSL)
return msnprintf(buffer, size, OSSL_PACKAGE);
#elif defined(HAVE_OPENSSL_VERSION) && defined(OPENSSL_VERSION_STRING)
return msnprintf(buffer, size, "%s/%s",
OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING));
#else
- /* not BoringSSL and not using OpenSSL_version */
+ /* not LibreSSL, BoringSSL and not using OpenSSL_version */
char sub[3];
unsigned long ssleay_value;
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 67/151: sha256: bump the copyright year range, (continued)
- [gnurl] 67/151: sha256: bump the copyright year range, gnunet, 2019/12/20
- [gnurl] 50/151: multi: add curl_multi_wakeup(), gnunet, 2019/12/20
- [gnurl] 69/151: parsedate: offer a getdate_capped() alternative, gnunet, 2019/12/20
- [gnurl] 52/151: TLS: add BearSSL vtls implementation, gnunet, 2019/12/20
- [gnurl] 86/151: hostip4.c: bump copyright year range, gnunet, 2019/12/20
- [gnurl] 75/151: docs: add "added: 7.68.0" to the --etag-* docs, gnunet, 2019/12/20
- [gnurl] 81/151: openssl: set X509_V_FLAG_PARTIAL_CHAIN, gnunet, 2019/12/20
- [gnurl] 78/151: travis: do not use OVERRIDE_CC or OVERRIDE_CXX if empty, gnunet, 2019/12/20
- [gnurl] 91/151: curl_setup: fix `CURLRES_IPV6` condition, gnunet, 2019/12/20
- [gnurl] 71/151: strerror: Add Curl_winapi_strerror for Win API specific errors, gnunet, 2019/12/20
- [gnurl] 72/151: openssl: retrieve reported LibreSSL version at runtime,
gnunet <=
- [gnurl] 74/151: copyright: fix the year ranges for two files, gnunet, 2019/12/20
- [gnurl] 68/151: docs: add more references to curl_multi_poll, gnunet, 2019/12/20
- [gnurl] 76/151: Azure Pipelines: initial CI setup, gnunet, 2019/12/20
- [gnurl] 97/151: mailmap: Mohammad Hasbini, gnunet, 2019/12/20
- [gnurl] 106/151: tests: make it possible to set executable extensions, gnunet, 2019/12/20
- [gnurl] 92/151: etag: allow both --etag-compare and --etag-save in same cmdline, gnunet, 2019/12/20
- [gnurl] 95/151: RELEASE-NOTES: synced, gnunet, 2019/12/20
- [gnurl] 104/151: tests: use \r\n for log messages in WSL, gnunet, 2019/12/20
- [gnurl] 88/151: azure: add more builds, gnunet, 2019/12/20
- [gnurl] 93/151: setopt: Fix ALPN / NPN user option when built without HTTP2, gnunet, 2019/12/20