openssl icon indicating copy to clipboard operation
openssl copied to clipboard

patches for ruby for 1.1.1

Open mcr opened this issue 3 years ago • 1 comments

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)

mcr avatar Oct 13 '22 22:10 mcr

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/.

rhenium avatar Oct 17 '22 07:10 rhenium