Line 0
Link Here
|
|
|
1 |
From b22568a54506e4b79b72530f89f21032e6435414 Mon Sep 17 00:00:00 2001 |
2 |
From: Nick Mathewson <nickm@torproject.org> |
3 |
Date: Fri, 6 Nov 2020 10:29:28 -0500 |
4 |
Subject: [PATCH] Rename OpenSSL_version_num() as defined in Tor |
5 |
|
6 |
This way, if we guess wrong about whether the library has it, |
7 |
we don't conflict with the library's headers. |
8 |
|
9 |
Fixes #40181; bug not in any released version. |
10 |
--- |
11 |
src/lib/crypt_ops/compat_openssl.h | 3 ++- |
12 |
src/lib/crypt_ops/crypto_openssl_mgt.c | 2 +- |
13 |
src/lib/tls/tortls_openssl.c | 2 +- |
14 |
3 files changed, 4 insertions(+), 3 deletions(-) |
15 |
|
16 |
diff --git a/src/lib/crypt_ops/compat_openssl.h b/src/lib/crypt_ops/compat_openssl.h |
17 |
index c2e1459078..aa66e0c3fa 100644 |
18 |
--- src/lib/crypt_ops/compat_openssl.h.orig |
19 |
+++ src/lib/crypt_ops/compat_openssl.h |
20 |
@@ -34,7 +34,7 @@ |
21 |
|
22 |
#ifndef OPENSSL_1_1_API |
23 |
#define OpenSSL_version(v) SSLeay_version(v) |
24 |
-#define OpenSSL_version_num() SSLeay() |
25 |
+#define tor_OpenSSL_version_num() SSLeay() |
26 |
#define RAND_OpenSSL() RAND_SSLeay() |
27 |
#define STATE_IS_SW_SERVER_HELLO(st) \ |
28 |
(((st) == SSL3_ST_SW_SRVR_HELLO_A) || \ |
29 |
@@ -42,6 +42,7 @@ |
30 |
#define OSSL_HANDSHAKE_STATE int |
31 |
#define CONST_IF_OPENSSL_1_1_API |
32 |
#else /* defined(OPENSSL_1_1_API) */ |
33 |
+#define tor_OpenSSL_version_num() OpenSSL_version_num() |
34 |
#define STATE_IS_SW_SERVER_HELLO(st) \ |
35 |
((st) == TLS_ST_SW_SRVR_HELLO) |
36 |
#define CONST_IF_OPENSSL_1_1_API const |
37 |
diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.c b/src/lib/crypt_ops/crypto_openssl_mgt.c |
38 |
index 065cbca1cc..e763491a11 100644 |
39 |
--- src/lib/crypt_ops/crypto_openssl_mgt.c.orig |
40 |
+++ src/lib/crypt_ops/crypto_openssl_mgt.c |
41 |
@@ -222,7 +222,7 @@ crypto_openssl_early_init(void) |
42 |
|
43 |
setup_openssl_threading(); |
44 |
|
45 |
- unsigned long version_num = OpenSSL_version_num(); |
46 |
+ unsigned long version_num = tor_OpenSSL_version_num(); |
47 |
const char *version_str = crypto_openssl_get_version_str(); |
48 |
if (version_num == OPENSSL_VERSION_NUMBER && |
49 |
!strcmp(version_str, OPENSSL_VERSION_TEXT)) { |
50 |
diff --git a/src/lib/tls/tortls_openssl.c b/src/lib/tls/tortls_openssl.c |
51 |
index 2269714141..ad9b49ab4f 100644 |
52 |
--- src/lib/tls/tortls_openssl.c.orig |
53 |
+++ src/lib/tls/tortls_openssl.c |
54 |
@@ -342,7 +342,7 @@ tor_tls_init(void) |
55 |
|
56 |
#if (SIZEOF_VOID_P >= 8 && \ |
57 |
OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,0,1)) |
58 |
- long version = OpenSSL_version_num(); |
59 |
+ long version = tor_OpenSSL_version_num(); |
60 |
|
61 |
/* LCOV_EXCL_START : we can't test these lines on the same machine */ |
62 |
if (version >= OPENSSL_V_SERIES(1,0,1)) { |