aboutsummaryrefslogtreecommitdiff
path: root/src/IO/tls_openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/IO/tls_openssl.c')
-rw-r--r--src/IO/tls_openssl.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c
index 5ad12b8c..9098287a 100644
--- a/src/IO/tls_openssl.c
+++ b/src/IO/tls_openssl.c
@@ -246,6 +246,27 @@ static void Tls_load_certificates(void)
;
}
+const char *a_Tls_openssl_version(char *buf, int n)
+{
+ /* Ugly hack to replace "OpenSSL 3.4.0 22 Oct 2024" with
+ * "OpenSSL/3.4.0". It also works for LibreSSL. */
+ const char *ver = OpenSSL_version(OPENSSL_VERSION);
+ if (snprintf(buf, n, "%s", ver) >= n)
+ return "OpenSSL/?";
+
+ char *ossl = buf;
+ char *sp1 = strchr(ossl, ' ');
+ if (sp1) {
+ *sp1 = '/';
+ char *sp2 = strchr(ossl, ' ');
+ if (sp2) {
+ *sp2 = '\0';
+ }
+ }
+
+ return buf;
+}
+
/*
* Initialize the OpenSSL library.
*/