facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.05k stars 539 forks source link

Incompatibility with openssl3 #201

Closed wyuenho closed 2 years ago

wyuenho commented 2 years ago
In file included from /opt/local/var/macports/build/_Users_wyuenho_ports_devel_wangle/wangle/work/wangle-2021.11.08.00/wangle/../wangle/acceptor/TransportInfo.h:20:
/opt/local/var/macports/build/_Users_wyuenho_ports_devel_wangle/wangle/work/wangle-2021.11.08.00/wangle/../wangle/ssl/SSLUtil.h:159:17: error: no matching function for call to 'CRYPTO_get_ex_new_index'
      *pindex = SSL_SESSION_get_ex_new_index(
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/libexec/openssl3/include/openssl/ssl.h:2159:5: note: expanded from macro 'SSL_SESSION_get_ex_new_index'
    CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef)
    ^~~~~~~~~~~~~~~~~~~~~~~
/opt/local/libexec/openssl3/include/openssl/crypto.h:242:12: note: candidate function not viable: no known conversion from 'int (CRYPTO_EX_DATA *, wangle::SSLUtil::ex_data_dup_from_arg_t, wangle::SSLUtil::ex_data_dup_ptr_arg_t, int, long, void *)' (aka 'int (crypto_ex_data_st *, const crypto_ex_data_st *, void *, int, long, void *)') to 'CRYPTO_EX_dup *' (aka 'int (*)(crypto_ex_data_st *, const crypto_ex_data_st *, void **, int, long, void *)') for 5th argument
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
           ^
1 error generated.
hybridstyle commented 2 years ago

Did you resolve this problem?

wyuenho commented 2 years ago

Yeah here's the patch.

--- ssl/SSLUtil.h
+++ ssl/SSLUtil.h
@@ -112,7 +112,7 @@ class SSLUtil {
   using ex_data_dup_from_arg_t = CRYPTO_EX_DATA*;
 #endif

-#ifdef OPENSSL_IS_BORINGSSL
+#if defined(OPENSSL_IS_BORINGSSL) || OPENSSL_VERSION_PREREQ(3, 0)
   using ex_data_dup_ptr_arg_t = void**;
 #else
   using ex_data_dup_ptr_arg_t = void*;
Orvid commented 2 years ago

Could you submit a pull request with the patch?

wyuenho commented 2 years ago

My patch only works for openssl3. A proper patch needs to work with openssl < 3, which I haven't had the time to investigate.

wyuenho commented 2 years ago

Looks like this was fixed on master