ruby / openssl

Provides SSL, TLS and general purpose cryptography.
Other
241 stars 163 forks source link

patches for ruby for 1.1.1 #552

Open mcr opened 1 year ago

mcr commented 1 year ago

While our PR #399 still needs some work, and our current code base (master) seems to compile against all of my private installations of libssl-dev 1.1.1 (i.e. "make install_sw" of openssl 1.1.1), the openssl code one gets from the ruby git tree (either directly from github), or via rvm fails to compile:

In file included from ossl.h:171,
                 from ossl_ssl.c:12:
ossl_ssl.c: In function ‘ossl_sslctx_session_new_cb’:
openssl_missing.h:99:2: warning: implicit declaration of function ‘CRYPTO_add’ [-Wimplicit-function-declaration]
   99 |  CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
      |  ^~~~~~~~~~
ossl_ssl.c:422:5: note: in expansion of macro ‘SSL_SESSION_up_ref’
  422 |     SSL_SESSION_up_ref(sess);
      |     ^~~~~~~~~~~~~~~~~~
openssl_missing.h:99:17: error: dereferencing pointer to incomplete type ‘SSL_SESSION’ {aka ‘struct ssl_session_st’}
   99 |  CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
      |                 ^~

these are things that I'm sure that we've fixed, long ago. But the ruby distro hasn't updated things. This fails on a fresh ubuntu LTS20.04 install. Ubuntu 22 (which will also be LTS) has moved to openssl 3.0, so it's a total non-starter. (And there are no libtls-dev 1.1.1 that you can easily find)

rhenium commented 1 year ago
openssl_missing.h:99:2: warning: implicit declaration of function ‘CRYPTO_add’ [-Wimplicit-function-declaration]
   99 |  CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
      |  ^~~~~~~~~~

This code should have been enabled when SSL_SESSION_up_ref() does not exist, in other words, for OpenSSL 1.0.2 only. This suggests that extconf.rb somehow detected OpenSSL 1.0.2, but the actual compilation used OpenSSL 1.1 headers. Could you check the mkmf.log?

ruby/ruby and this repository are slightly out of sync, but I don't recall changes that would affect this.

ruby/ruby.git master compiles and passes all tests on both Ubuntu 20.04 and 22.04 according to https://rubyci.org/.