Skip to content

Commit 38ec6fd

Browse files
committed
Require OpenSSL 1.1.0 or later
Drop support for OpenSSL 1.0.2. It has reached upstream EOL in 2019-12. Most distributions that shipped with OpenSSL 1.0.2 have also reached EOL, or provide a newer version in the package repository: - RHEL 7 (EOL 2024-06) - Ubuntu 16.04 LTS (EOL 2021-04) - Amazon Linux 2 (EOL 2026-06, but OpenSSL 1.1.1 can be installed via the openssl11{,-devel} package)
1 parent 9db621a commit 38ec6fd

19 files changed

+16
-611
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ jobs:
6363
name-extra: [ '' ]
6464
openssl:
6565
# https://openssl-library.org/source/
66-
- openssl-1.0.2u # EOL
6766
- openssl-1.1.0l # EOL
6867
- openssl-1.1.1w # EOL 2023-09-11, still used by RHEL 8 and Ubuntu 20.04
6968
- openssl-3.0.15 # Supported until 2026-09-07

ext/openssl/extconf.rb

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
def find_openssl_library
6161
if $mswin || $mingw
6262
# required for static OpenSSL libraries
63-
have_library("gdi32") # OpenSSL <= 1.0.2 (for RAND_screen())
6463
have_library("crypt32")
6564
end
6665

@@ -77,12 +76,6 @@ def find_openssl_library
7776
return true
7877
end
7978

80-
# OpenSSL <= 1.0.2: libeay32.lib and ssleay32.lib.
81-
if have_library("libeay32", "CRYPTO_malloc") &&
82-
have_library("ssleay32", "SSL_new")
83-
return true
84-
end
85-
8679
# LibreSSL: libcrypto-##.lib and libssl-##.lib, where ## is the ABI version
8780
# number. We have to find the version number out by scanning libpath.
8881
libpath = $LIBPATH.dup
@@ -124,11 +117,11 @@ def find_openssl_library
124117
try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") }
125118
else
126119
is_openssl = true
127-
checking_for("OpenSSL version >= 1.0.2") {
128-
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") }
120+
checking_for("OpenSSL version >= 1.1.0") {
121+
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10100000L", "openssl/opensslv.h") }
129122
end
130123
unless version_ok
131-
raise "OpenSSL >= 1.0.2 or LibreSSL >= 3.9.0 is required"
124+
raise "OpenSSL >= 1.1.0 or LibreSSL >= 3.9.0 is required"
132125
end
133126

134127
# Prevent wincrypt.h from being included, which defines conflicting macro with openssl/x509.h
@@ -138,64 +131,20 @@ def find_openssl_library
138131

139132
Logging::message "=== Checking for OpenSSL features... ===\n"
140133
evp_h = "openssl/evp.h".freeze
141-
x509_h = "openssl/x509.h".freeze
142134
ts_h = "openssl/ts.h".freeze
143135
ssl_h = "openssl/ssl.h".freeze
144136

145137
# compile options
146138
have_func("RAND_egd()", "openssl/rand.h")
147-
if is_openssl
148-
engines = %w{dynamic 4758cca aep atalla chil
149-
cswift nuron sureware ubsec padlock capi gmp gost cryptodev}
150-
engines.each { |name|
151-
have_func("ENGINE_load_#{name}()", "openssl/engine.h")
152-
}
153-
end
154139

155-
# added in 1.1.0
156-
if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl
157-
$defs.push("-DHAVE_OPAQUE_OPENSSL")
158-
end
159-
have_func("EVP_MD_CTX_new()", evp_h)
160-
have_func("EVP_MD_CTX_free(NULL)", evp_h)
161-
have_func("EVP_MD_CTX_pkey_ctx(NULL)", evp_h)
162-
have_func("X509_STORE_get_ex_data(NULL, 0)", x509_h)
163-
have_func("X509_STORE_set_ex_data(NULL, 0, NULL)", x509_h)
164-
have_func("X509_STORE_get_ex_new_index(0, NULL, NULL, NULL, NULL)", x509_h)
165-
have_func("X509_CRL_get0_signature(NULL, NULL, NULL)", x509_h)
166-
have_func("X509_REQ_get0_signature(NULL, NULL, NULL)", x509_h)
167-
have_func("X509_REVOKED_get0_serialNumber(NULL)", x509_h)
168-
have_func("X509_REVOKED_get0_revocationDate(NULL)", x509_h)
169-
have_func("X509_get0_tbs_sigalg(NULL)", x509_h)
170-
have_func("X509_STORE_CTX_get0_untrusted(NULL)", x509_h)
171-
have_func("X509_STORE_CTX_get0_cert(NULL)", x509_h)
172-
have_func("X509_STORE_CTX_get0_chain(NULL)", x509_h)
173-
have_func("OCSP_SINGLERESP_get0_id(NULL)", "openssl/ocsp.h")
174-
have_func("SSL_CTX_get_ciphers(NULL)", ssl_h)
175-
have_func("X509_up_ref(NULL)", x509_h)
176-
have_func("X509_CRL_up_ref(NULL)", x509_h)
177-
have_func("X509_STORE_up_ref(NULL)", x509_h)
178-
have_func("SSL_SESSION_up_ref(NULL)", ssl_h)
179-
have_func("EVP_PKEY_up_ref(NULL)", evp_h)
180-
have_func("SSL_CTX_set_min_proto_version(NULL, 0)", ssl_h)
181-
have_func("SSL_CTX_get_security_level(NULL)", ssl_h)
182-
have_func("X509_get0_notBefore(NULL)", x509_h)
183-
have_func("SSL_SESSION_get_protocol_version(NULL)", ssl_h)
184-
have_func("TS_STATUS_INFO_get0_status(NULL)", ts_h)
185-
have_func("TS_STATUS_INFO_get0_text(NULL)", ts_h)
186-
have_func("TS_STATUS_INFO_get0_failure_info(NULL)", ts_h)
187-
have_func("TS_VERIFY_CTS_set_certs(NULL, NULL)", ts_h)
188-
have_func("TS_VERIFY_CTX_set_store(NULL, NULL)", ts_h)
189-
have_func("TS_VERIFY_CTX_add_flags(NULL, 0)", ts_h)
190-
have_func("TS_RESP_CTX_set_time_cb(NULL, NULL, NULL)", ts_h)
140+
# added in 1.1.0, currently not in LibreSSL
191141
have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
192-
have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
193-
have_func("X509_STORE_get0_param(NULL)", x509_h)
194142

195143
# added in 1.1.1
196144
have_func("EVP_PKEY_check(NULL)", evp_h)
197145
have_func("EVP_PKEY_new_raw_private_key(0, NULL, (unsigned char *)\"\", 0)", evp_h)
198146
have_func("SSL_CTX_set_ciphersuites(NULL, \"\")", ssl_h)
147+
have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
199148

200149
# added in 3.0.0
201150
have_func("SSL_set0_tmp_dh_pkey(NULL, NULL)", ssl_h)

ext/openssl/openssl_missing.c

Lines changed: 0 additions & 40 deletions
This file was deleted.

ext/openssl/openssl_missing.h

Lines changed: 0 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -12,204 +12,6 @@
1212

1313
#include "ruby/config.h"
1414

15-
/* added in 1.1.0 */
16-
#if !defined(HAVE_EVP_MD_CTX_NEW)
17-
# define EVP_MD_CTX_new EVP_MD_CTX_create
18-
#endif
19-
20-
#if !defined(HAVE_EVP_MD_CTX_FREE)
21-
# define EVP_MD_CTX_free EVP_MD_CTX_destroy
22-
#endif
23-
24-
#if !defined(HAVE_X509_STORE_GET_EX_DATA)
25-
# define X509_STORE_get_ex_data(x, idx) \
26-
CRYPTO_get_ex_data(&(x)->ex_data, (idx))
27-
#endif
28-
29-
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
30-
# define X509_STORE_set_ex_data(x, idx, data) \
31-
CRYPTO_set_ex_data(&(x)->ex_data, (idx), (data))
32-
#endif
33-
34-
#if !defined(HAVE_X509_STORE_GET_EX_NEW_INDEX) && !defined(X509_STORE_get_ex_new_index)
35-
# define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
36-
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, (l), (p), \
37-
(newf), (dupf), (freef))
38-
#endif
39-
40-
#if !defined(HAVE_X509_CRL_GET0_SIGNATURE)
41-
void ossl_X509_CRL_get0_signature(const X509_CRL *, const ASN1_BIT_STRING **, const X509_ALGOR **);
42-
# define X509_CRL_get0_signature ossl_X509_CRL_get0_signature
43-
#endif
44-
45-
#if !defined(HAVE_X509_REQ_GET0_SIGNATURE)
46-
void ossl_X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, const X509_ALGOR **);
47-
# define X509_REQ_get0_signature ossl_X509_REQ_get0_signature
48-
#endif
49-
50-
#if !defined(HAVE_X509_REVOKED_GET0_SERIALNUMBER)
51-
# define X509_REVOKED_get0_serialNumber(x) ((x)->serialNumber)
52-
#endif
53-
54-
#if !defined(HAVE_X509_REVOKED_GET0_REVOCATIONDATE)
55-
# define X509_REVOKED_get0_revocationDate(x) ((x)->revocationDate)
56-
#endif
57-
58-
#if !defined(HAVE_X509_GET0_TBS_SIGALG)
59-
# define X509_get0_tbs_sigalg(x) ((x)->cert_info->signature)
60-
#endif
61-
62-
#if !defined(HAVE_X509_STORE_CTX_GET0_UNTRUSTED)
63-
# define X509_STORE_CTX_get0_untrusted(x) ((x)->untrusted)
64-
#endif
65-
66-
#if !defined(HAVE_X509_STORE_CTX_GET0_CERT)
67-
# define X509_STORE_CTX_get0_cert(x) ((x)->cert)
68-
#endif
69-
70-
#if !defined(HAVE_X509_STORE_CTX_GET0_CHAIN)
71-
# define X509_STORE_CTX_get0_chain(ctx) X509_STORE_CTX_get_chain(ctx)
72-
#endif
73-
74-
#if !defined(HAVE_OCSP_SINGLERESP_GET0_ID)
75-
# define OCSP_SINGLERESP_get0_id(s) ((s)->certId)
76-
#endif
77-
78-
#if !defined(HAVE_SSL_CTX_GET_CIPHERS)
79-
# define SSL_CTX_get_ciphers(ctx) ((ctx)->cipher_list)
80-
#endif
81-
82-
#if !defined(HAVE_X509_UP_REF)
83-
# define X509_up_ref(x) \
84-
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509)
85-
#endif
86-
87-
#if !defined(HAVE_X509_CRL_UP_REF)
88-
# define X509_CRL_up_ref(x) \
89-
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_CRL);
90-
#endif
91-
92-
#if !defined(HAVE_X509_STORE_UP_REF)
93-
# define X509_STORE_up_ref(x) \
94-
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_STORE);
95-
#endif
96-
97-
#if !defined(HAVE_SSL_SESSION_UP_REF)
98-
# define SSL_SESSION_up_ref(x) \
99-
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
100-
#endif
101-
102-
#if !defined(HAVE_EVP_PKEY_UP_REF)
103-
# define EVP_PKEY_up_ref(x) \
104-
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_EVP_PKEY);
105-
#endif
106-
107-
#if !defined(HAVE_OPAQUE_OPENSSL)
108-
#define IMPL_PKEY_GETTER(_type, _name) \
109-
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
110-
return pkey->pkey._name; }
111-
#define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \
112-
static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
113-
if (a1) *a1 = obj->a1; \
114-
if (a2) *a2 = obj->a2; } \
115-
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
116-
if (_fail_cond) return 0; \
117-
BN_clear_free(obj->a1); obj->a1 = a1; \
118-
BN_clear_free(obj->a2); obj->a2 = a2; \
119-
return 1; }
120-
#define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \
121-
static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
122-
if (a1) *a1 = obj->a1; \
123-
if (a2) *a2 = obj->a2; \
124-
if (a3) *a3 = obj->a3; } \
125-
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
126-
if (_fail_cond) return 0; \
127-
BN_clear_free(obj->a1); obj->a1 = a1; \
128-
BN_clear_free(obj->a2); obj->a2 = a2; \
129-
BN_clear_free(obj->a3); obj->a3 = a3; \
130-
return 1; }
131-
132-
#if !defined(OPENSSL_NO_RSA)
133-
IMPL_PKEY_GETTER(RSA, rsa)
134-
IMPL_KEY_ACCESSOR3(RSA, key, n, e, d, (n == obj->n || e == obj->e || (obj->d && d == obj->d)))
135-
IMPL_KEY_ACCESSOR2(RSA, factors, p, q, (p == obj->p || q == obj->q))
136-
IMPL_KEY_ACCESSOR3(RSA, crt_params, dmp1, dmq1, iqmp, (dmp1 == obj->dmp1 || dmq1 == obj->dmq1 || iqmp == obj->iqmp))
137-
#endif
138-
139-
#if !defined(OPENSSL_NO_DSA)
140-
IMPL_PKEY_GETTER(DSA, dsa)
141-
IMPL_KEY_ACCESSOR2(DSA, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
142-
IMPL_KEY_ACCESSOR3(DSA, pqg, p, q, g, (p == obj->p || q == obj->q || g == obj->g))
143-
#endif
144-
145-
#if !defined(OPENSSL_NO_DH)
146-
IMPL_PKEY_GETTER(DH, dh)
147-
IMPL_KEY_ACCESSOR2(DH, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
148-
IMPL_KEY_ACCESSOR3(DH, pqg, p, q, g, (p == obj->p || (obj->q && q == obj->q) || g == obj->g))
149-
static inline ENGINE *DH_get0_engine(DH *dh) { return dh->engine; }
150-
#endif
151-
152-
#if !defined(OPENSSL_NO_EC)
153-
IMPL_PKEY_GETTER(EC_KEY, ec)
154-
#endif
155-
156-
#undef IMPL_PKEY_GETTER
157-
#undef IMPL_KEY_ACCESSOR2
158-
#undef IMPL_KEY_ACCESSOR3
159-
#endif /* HAVE_OPAQUE_OPENSSL */
160-
161-
#if !defined(EVP_CTRL_AEAD_GET_TAG)
162-
# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG
163-
# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG
164-
# define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN
165-
#endif
166-
167-
#if !defined(HAVE_X509_GET0_NOTBEFORE)
168-
# define X509_get0_notBefore(x) X509_get_notBefore(x)
169-
# define X509_get0_notAfter(x) X509_get_notAfter(x)
170-
# define X509_CRL_get0_lastUpdate(x) X509_CRL_get_lastUpdate(x)
171-
# define X509_CRL_get0_nextUpdate(x) X509_CRL_get_nextUpdate(x)
172-
# define X509_set1_notBefore(x, t) X509_set_notBefore(x, t)
173-
# define X509_set1_notAfter(x, t) X509_set_notAfter(x, t)
174-
# define X509_CRL_set1_lastUpdate(x, t) X509_CRL_set_lastUpdate(x, t)
175-
# define X509_CRL_set1_nextUpdate(x, t) X509_CRL_set_nextUpdate(x, t)
176-
#endif
177-
178-
#if !defined(HAVE_SSL_SESSION_GET_PROTOCOL_VERSION)
179-
# define SSL_SESSION_get_protocol_version(s) ((s)->ssl_version)
180-
#endif
181-
182-
#if !defined(HAVE_TS_STATUS_INFO_GET0_STATUS)
183-
# define TS_STATUS_INFO_get0_status(a) ((a)->status)
184-
#endif
185-
186-
#if !defined(HAVE_TS_STATUS_INFO_GET0_TEXT)
187-
# define TS_STATUS_INFO_get0_text(a) ((a)->text)
188-
#endif
189-
190-
#if !defined(HAVE_TS_STATUS_INFO_GET0_FAILURE_INFO)
191-
# define TS_STATUS_INFO_get0_failure_info(a) ((a)->failure_info)
192-
#endif
193-
194-
#if !defined(HAVE_TS_VERIFY_CTS_SET_CERTS)
195-
# define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
196-
#endif
197-
198-
#if !defined(HAVE_TS_VERIFY_CTX_SET_STORE)
199-
# define TS_VERIFY_CTX_set_store(ctx, str) ((ctx)->store=(str))
200-
#endif
201-
202-
#if !defined(HAVE_TS_VERIFY_CTX_ADD_FLAGS)
203-
# define TS_VERIFY_CTX_add_flags(ctx, f) ((ctx)->flags |= (f))
204-
#endif
205-
206-
#if !defined(HAVE_TS_RESP_CTX_SET_TIME_CB)
207-
# define TS_RESP_CTX_set_time_cb(ctx, callback, dta) do { \
208-
(ctx)->time_cb = (callback); \
209-
(ctx)->time_cb_data = (dta); \
210-
} while (0)
211-
#endif
212-
21315
/* added in 3.0.0 */
21416
#if !defined(HAVE_TS_VERIFY_CTX_SET_CERTS)
21517
# define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
@@ -224,11 +26,7 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
22426
* EVP_MD_CTX_get_pkey_ctx(x) in OpenSSL 3.0.
22527
*/
22628
#ifndef HAVE_EVP_MD_CTX_GET_PKEY_CTX
227-
# ifdef HAVE_EVP_MD_CTX_PKEY_CTX
22829
# define EVP_MD_CTX_get_pkey_ctx(x) EVP_MD_CTX_pkey_ctx(x)
229-
# else
230-
# define EVP_MD_CTX_get_pkey_ctx(x) (x)->pctx
231-
# endif
23230
#endif
23331

23432
#ifndef HAVE_EVP_PKEY_EQ

0 commit comments

Comments
 (0)