Skip to content

Commit 050f0c6

Browse files
authored
Merge pull request #841 from rhenium/ky/require-openssl-1.1.1
Require OpenSSL 1.1.1 or later (Drop support for 1.1.0)
2 parents 4a009a1 + ba83abe commit 050f0c6

File tree

16 files changed

+38
-166
lines changed

16 files changed

+38
-166
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.1.0l # EOL
6766
- openssl-1.1.1w # EOL 2023-09-11, still used by RHEL 8 and Ubuntu 20.04
6867
- openssl-3.0.15 # Supported until 2026-09-07
6968
- openssl-3.1.7 # Supported until 2025-03-14

ext/openssl/extconf.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def find_openssl_library
115115
try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") }
116116
else
117117
is_openssl = true
118-
checking_for("OpenSSL version >= 1.1.0") {
119-
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10100000L", "openssl/opensslv.h") }
118+
checking_for("OpenSSL version >= 1.1.1") {
119+
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10101000L", "openssl/opensslv.h") }
120120
end
121121
unless version_ok
122-
raise "OpenSSL >= 1.1.0 or LibreSSL >= 3.9.0 is required"
122+
raise "OpenSSL >= 1.1.1 or LibreSSL >= 3.9.0 is required"
123123
end
124124

125125
# Prevent wincrypt.h from being included, which defines conflicting macro with openssl/x509.h
@@ -138,11 +138,8 @@ def find_openssl_library
138138
# added in 1.1.0, currently not in LibreSSL
139139
have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
140140

141-
# added in 1.1.1
141+
# added in OpenSSL 1.1.1 and LibreSSL 3.5.0, then removed in LibreSSL 4.0.0
142142
have_func("EVP_PKEY_check(NULL)", evp_h)
143-
have_func("EVP_PKEY_new_raw_private_key(0, NULL, (unsigned char *)\"\", 0)", evp_h)
144-
have_func("SSL_CTX_set_ciphersuites(NULL, \"\")", ssl_h)
145-
have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
146143

147144
# added in 3.0.0
148145
have_func("SSL_set0_tmp_dh_pkey(NULL, NULL)", ssl_h)

ext/openssl/ossl_hmac.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,11 @@ ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
9797

9898
GetHMAC(self, ctx);
9999
StringValue(key);
100-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
101100
pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_HMAC, NULL,
102101
(unsigned char *)RSTRING_PTR(key),
103102
RSTRING_LENINT(key));
104103
if (!pkey)
105104
ossl_raise(eHMACError, "EVP_PKEY_new_raw_private_key");
106-
#else
107-
pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL,
108-
(unsigned char *)RSTRING_PTR(key),
109-
RSTRING_LENINT(key));
110-
if (!pkey)
111-
ossl_raise(eHMACError, "EVP_PKEY_new_mac_key");
112-
#endif
113105
if (EVP_DigestSignInit(ctx, NULL, ossl_evp_get_digestbyname(digest),
114106
NULL, pkey) != 1) {
115107
EVP_PKEY_free(pkey);

ext/openssl/ossl_pkey.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ ossl_pkey_initialize_copy(VALUE self, VALUE other)
634634
}
635635
#endif
636636

637-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
638637
/*
639638
* call-seq:
640639
* OpenSSL::PKey.new_raw_private_key(algo, string) -> PKey
@@ -665,9 +664,7 @@ ossl_pkey_new_raw_private_key(VALUE self, VALUE type, VALUE key)
665664

666665
return ossl_pkey_new(pkey);
667666
}
668-
#endif
669667

670-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
671668
/*
672669
* call-seq:
673670
* OpenSSL::PKey.new_raw_public_key(algo, string) -> PKey
@@ -698,7 +695,6 @@ ossl_pkey_new_raw_public_key(VALUE self, VALUE type, VALUE key)
698695

699696
return ossl_pkey_new(pkey);
700697
}
701-
#endif
702698

703699
/*
704700
* call-seq:
@@ -889,7 +885,6 @@ ossl_pkey_private_to_pem(int argc, VALUE *argv, VALUE self)
889885
return do_pkcs8_export(argc, argv, self, 0);
890886
}
891887

892-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
893888
/*
894889
* call-seq:
895890
* pkey.raw_private_key => string
@@ -916,7 +911,6 @@ ossl_pkey_raw_private_key(VALUE self)
916911

917912
return str;
918913
}
919-
#endif
920914

921915
VALUE
922916
ossl_pkey_export_spki(VALUE self, int to_der)
@@ -973,7 +967,6 @@ ossl_pkey_public_to_pem(VALUE self)
973967
return ossl_pkey_export_spki(self, 0);
974968
}
975969

976-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
977970
/*
978971
* call-seq:
979972
* pkey.raw_public_key => string
@@ -1000,7 +993,6 @@ ossl_pkey_raw_public_key(VALUE self)
1000993

1001994
return str;
1002995
}
1003-
#endif
1004996

1005997
/*
1006998
* call-seq:
@@ -1104,7 +1096,6 @@ ossl_pkey_sign(int argc, VALUE *argv, VALUE self)
11041096
rb_jump_tag(state);
11051097
}
11061098
}
1107-
#if OSSL_OPENSSL_PREREQ(1, 1, 1) || OSSL_IS_LIBRESSL
11081099
if (EVP_DigestSign(ctx, NULL, &siglen, (unsigned char *)RSTRING_PTR(data),
11091100
RSTRING_LEN(data)) < 1) {
11101101
EVP_MD_CTX_free(ctx);
@@ -1125,30 +1116,6 @@ ossl_pkey_sign(int argc, VALUE *argv, VALUE self)
11251116
EVP_MD_CTX_free(ctx);
11261117
ossl_raise(ePKeyError, "EVP_DigestSign");
11271118
}
1128-
#else
1129-
if (EVP_DigestSignUpdate(ctx, RSTRING_PTR(data), RSTRING_LEN(data)) < 1) {
1130-
EVP_MD_CTX_free(ctx);
1131-
ossl_raise(ePKeyError, "EVP_DigestSignUpdate");
1132-
}
1133-
if (EVP_DigestSignFinal(ctx, NULL, &siglen) < 1) {
1134-
EVP_MD_CTX_free(ctx);
1135-
ossl_raise(ePKeyError, "EVP_DigestSignFinal");
1136-
}
1137-
if (siglen > LONG_MAX) {
1138-
EVP_MD_CTX_free(ctx);
1139-
rb_raise(ePKeyError, "signature would be too large");
1140-
}
1141-
sig = ossl_str_new(NULL, (long)siglen, &state);
1142-
if (state) {
1143-
EVP_MD_CTX_free(ctx);
1144-
rb_jump_tag(state);
1145-
}
1146-
if (EVP_DigestSignFinal(ctx, (unsigned char *)RSTRING_PTR(sig),
1147-
&siglen) < 1) {
1148-
EVP_MD_CTX_free(ctx);
1149-
ossl_raise(ePKeyError, "EVP_DigestSignFinal");
1150-
}
1151-
#endif
11521119
EVP_MD_CTX_free(ctx);
11531120
rb_str_set_len(sig, siglen);
11541121
return sig;
@@ -1209,24 +1176,12 @@ ossl_pkey_verify(int argc, VALUE *argv, VALUE self)
12091176
rb_jump_tag(state);
12101177
}
12111178
}
1212-
#if OSSL_OPENSSL_PREREQ(1, 1, 1) || OSSL_IS_LIBRESSL
12131179
ret = EVP_DigestVerify(ctx, (unsigned char *)RSTRING_PTR(sig),
12141180
RSTRING_LEN(sig), (unsigned char *)RSTRING_PTR(data),
12151181
RSTRING_LEN(data));
12161182
EVP_MD_CTX_free(ctx);
12171183
if (ret < 0)
12181184
ossl_raise(ePKeyError, "EVP_DigestVerify");
1219-
#else
1220-
if (EVP_DigestVerifyUpdate(ctx, RSTRING_PTR(data), RSTRING_LEN(data)) < 1) {
1221-
EVP_MD_CTX_free(ctx);
1222-
ossl_raise(ePKeyError, "EVP_DigestVerifyUpdate");
1223-
}
1224-
ret = EVP_DigestVerifyFinal(ctx, (unsigned char *)RSTRING_PTR(sig),
1225-
RSTRING_LEN(sig));
1226-
EVP_MD_CTX_free(ctx);
1227-
if (ret < 0)
1228-
ossl_raise(ePKeyError, "EVP_DigestVerifyFinal");
1229-
#endif
12301185
if (ret)
12311186
return Qtrue;
12321187
else {
@@ -1739,10 +1694,8 @@ Init_ossl_pkey(void)
17391694
rb_define_module_function(mPKey, "read", ossl_pkey_new_from_data, -1);
17401695
rb_define_module_function(mPKey, "generate_parameters", ossl_pkey_s_generate_parameters, -1);
17411696
rb_define_module_function(mPKey, "generate_key", ossl_pkey_s_generate_key, -1);
1742-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
17431697
rb_define_module_function(mPKey, "new_raw_private_key", ossl_pkey_new_raw_private_key, 2);
17441698
rb_define_module_function(mPKey, "new_raw_public_key", ossl_pkey_new_raw_public_key, 2);
1745-
#endif
17461699

17471700
rb_define_alloc_func(cPKey, ossl_pkey_alloc);
17481701
rb_define_method(cPKey, "initialize", ossl_pkey_initialize, 0);
@@ -1758,10 +1711,8 @@ Init_ossl_pkey(void)
17581711
rb_define_method(cPKey, "private_to_pem", ossl_pkey_private_to_pem, -1);
17591712
rb_define_method(cPKey, "public_to_der", ossl_pkey_public_to_der, 0);
17601713
rb_define_method(cPKey, "public_to_pem", ossl_pkey_public_to_pem, 0);
1761-
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
17621714
rb_define_method(cPKey, "raw_private_key", ossl_pkey_raw_private_key, 0);
17631715
rb_define_method(cPKey, "raw_public_key", ossl_pkey_raw_public_key, 0);
1764-
#endif
17651716
rb_define_method(cPKey, "compare?", ossl_pkey_compare, 1);
17661717

17671718
rb_define_method(cPKey, "sign", ossl_pkey_sign, -1);

ext/openssl/ossl_rand.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,7 @@ Init_ossl_rand(void)
189189
rb_define_module_function(mRandom, "load_random_file", ossl_rand_load_file, 1);
190190
rb_define_module_function(mRandom, "write_random_file", ossl_rand_write_file, 1);
191191
rb_define_module_function(mRandom, "random_bytes", ossl_rand_bytes, 1);
192-
#if OPENSSL_VERSION_NUMBER < 0x10101000 || defined(LIBRESSL_VERSION_NUMBER)
193192
rb_define_alias(rb_singleton_class(mRandom), "pseudo_bytes", "random_bytes");
194-
#endif
195193
#ifdef HAVE_RAND_EGD
196194
rb_define_module_function(mRandom, "egd", ossl_rand_egd, 1);
197195
rb_define_module_function(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);

ext/openssl/ossl_ssl.c

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ parse_proto_version(VALUE str)
109109
{ "TLS1", TLS1_VERSION },
110110
{ "TLS1_1", TLS1_1_VERSION },
111111
{ "TLS1_2", TLS1_2_VERSION },
112-
#ifdef TLS1_3_VERSION
113112
{ "TLS1_3", TLS1_3_VERSION },
114-
#endif
115113
};
116114

117115
if (NIL_P(str))
@@ -383,7 +381,7 @@ ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
383381
return 0;
384382
}
385383

386-
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
384+
#if !OSSL_IS_LIBRESSL
387385
/*
388386
* It is only compatible with OpenSSL >= 1.1.1. Even if LibreSSL implements
389387
* SSL_CTX_set_keylog_callback() from v3.4.2, it does nothing (see
@@ -762,9 +760,7 @@ ossl_sslctx_setup(VALUE self)
762760
SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
763761
#endif
764762

765-
#ifdef HAVE_SSL_CTX_SET_POST_HANDSHAKE_AUTH
766763
SSL_CTX_set_post_handshake_auth(ctx, 1);
767-
#endif
768764

769765
val = rb_attr_get(self, id_i_cert_store);
770766
if (!NIL_P(val)) {
@@ -904,7 +900,7 @@ ossl_sslctx_setup(VALUE self)
904900
OSSL_Debug("SSL TLSEXT servername callback added");
905901
}
906902

907-
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
903+
#if !OSSL_IS_LIBRESSL
908904
/*
909905
* It is only compatible with OpenSSL >= 1.1.1. Even if LibreSSL implements
910906
* SSL_CTX_set_keylog_callback() from v3.4.2, it does nothing (see
@@ -1016,7 +1012,6 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
10161012
return v;
10171013
}
10181014

1019-
#ifdef HAVE_SSL_CTX_SET_CIPHERSUITES
10201015
/*
10211016
* call-seq:
10221017
* ctx.ciphersuites = "cipher1:cipher2:..."
@@ -1043,7 +1038,6 @@ ossl_sslctx_set_ciphersuites(VALUE self, VALUE v)
10431038

10441039
return v;
10451040
}
1046-
#endif
10471041

10481042
#ifndef OPENSSL_NO_DH
10491043
/*
@@ -2856,9 +2850,7 @@ Init_ossl_ssl(void)
28562850
ossl_sslctx_set_minmax_proto_version, 2);
28572851
rb_define_method(cSSLContext, "ciphers", ossl_sslctx_get_ciphers, 0);
28582852
rb_define_method(cSSLContext, "ciphers=", ossl_sslctx_set_ciphers, 1);
2859-
#ifdef HAVE_SSL_CTX_SET_CIPHERSUITES
28602853
rb_define_method(cSSLContext, "ciphersuites=", ossl_sslctx_set_ciphersuites, 1);
2861-
#endif
28622854
#ifndef OPENSSL_NO_DH
28632855
rb_define_method(cSSLContext, "tmp_dh=", ossl_sslctx_set_tmp_dh, 1);
28642856
#endif
@@ -2994,36 +2986,34 @@ Init_ossl_ssl(void)
29942986
#ifdef SSL_OP_DISABLE_TLSEXT_CA_NAMES /* OpenSSL 3.0 */
29952987
rb_define_const(mSSL, "OP_DISABLE_TLSEXT_CA_NAMES", ULONG2NUM(SSL_OP_DISABLE_TLSEXT_CA_NAMES));
29962988
#endif
2997-
#ifdef SSL_OP_ALLOW_NO_DHE_KEX /* OpenSSL 1.1.1 */
2989+
#ifdef SSL_OP_ALLOW_NO_DHE_KEX /* OpenSSL 1.1.1, missing in LibreSSL */
29982990
rb_define_const(mSSL, "OP_ALLOW_NO_DHE_KEX", ULONG2NUM(SSL_OP_ALLOW_NO_DHE_KEX));
29992991
#endif
30002992
rb_define_const(mSSL, "OP_DONT_INSERT_EMPTY_FRAGMENTS", ULONG2NUM(SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS));
30012993
rb_define_const(mSSL, "OP_NO_TICKET", ULONG2NUM(SSL_OP_NO_TICKET));
30022994
rb_define_const(mSSL, "OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION", ULONG2NUM(SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION));
30032995
rb_define_const(mSSL, "OP_NO_COMPRESSION", ULONG2NUM(SSL_OP_NO_COMPRESSION));
30042996
rb_define_const(mSSL, "OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION", ULONG2NUM(SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION));
3005-
#ifdef SSL_OP_NO_ENCRYPT_THEN_MAC /* OpenSSL 1.1.1 */
2997+
#ifdef SSL_OP_NO_ENCRYPT_THEN_MAC /* OpenSSL 1.1.1, missing in LibreSSL */
30062998
rb_define_const(mSSL, "OP_NO_ENCRYPT_THEN_MAC", ULONG2NUM(SSL_OP_NO_ENCRYPT_THEN_MAC));
30072999
#endif
3008-
#ifdef SSL_OP_ENABLE_MIDDLEBOX_COMPAT /* OpenSSL 1.1.1 */
3000+
#ifdef SSL_OP_ENABLE_MIDDLEBOX_COMPAT /* OpenSSL 1.1.1, missing in LibreSSL */
30093001
rb_define_const(mSSL, "OP_ENABLE_MIDDLEBOX_COMPAT", ULONG2NUM(SSL_OP_ENABLE_MIDDLEBOX_COMPAT));
30103002
#endif
3011-
#ifdef SSL_OP_PRIORITIZE_CHACHA /* OpenSSL 1.1.1 */
3003+
#ifdef SSL_OP_PRIORITIZE_CHACHA /* OpenSSL 1.1.1, missing in LibreSSL */
30123004
rb_define_const(mSSL, "OP_PRIORITIZE_CHACHA", ULONG2NUM(SSL_OP_PRIORITIZE_CHACHA));
30133005
#endif
3014-
#ifdef SSL_OP_NO_ANTI_REPLAY /* OpenSSL 1.1.1 */
3006+
#ifdef SSL_OP_NO_ANTI_REPLAY /* OpenSSL 1.1.1, missing in LibreSSL */
30153007
rb_define_const(mSSL, "OP_NO_ANTI_REPLAY", ULONG2NUM(SSL_OP_NO_ANTI_REPLAY));
30163008
#endif
30173009
rb_define_const(mSSL, "OP_NO_SSLv3", ULONG2NUM(SSL_OP_NO_SSLv3));
30183010
rb_define_const(mSSL, "OP_NO_TLSv1", ULONG2NUM(SSL_OP_NO_TLSv1));
30193011
rb_define_const(mSSL, "OP_NO_TLSv1_1", ULONG2NUM(SSL_OP_NO_TLSv1_1));
30203012
rb_define_const(mSSL, "OP_NO_TLSv1_2", ULONG2NUM(SSL_OP_NO_TLSv1_2));
3021-
#ifdef SSL_OP_NO_TLSv1_3 /* OpenSSL 1.1.1 */
30223013
rb_define_const(mSSL, "OP_NO_TLSv1_3", ULONG2NUM(SSL_OP_NO_TLSv1_3));
3023-
#endif
30243014
rb_define_const(mSSL, "OP_CIPHER_SERVER_PREFERENCE", ULONG2NUM(SSL_OP_CIPHER_SERVER_PREFERENCE));
30253015
rb_define_const(mSSL, "OP_TLS_ROLLBACK_BUG", ULONG2NUM(SSL_OP_TLS_ROLLBACK_BUG));
3026-
#ifdef SSL_OP_NO_RENEGOTIATION /* OpenSSL 1.1.1 */
3016+
#ifdef SSL_OP_NO_RENEGOTIATION /* OpenSSL 1.1.1, missing in LibreSSL */
30273017
rb_define_const(mSSL, "OP_NO_RENEGOTIATION", ULONG2NUM(SSL_OP_NO_RENEGOTIATION));
30283018
#endif
30293019
rb_define_const(mSSL, "OP_CRYPTOPRO_TLSEXT_BUG", ULONG2NUM(SSL_OP_CRYPTOPRO_TLSEXT_BUG));
@@ -3085,10 +3075,8 @@ Init_ossl_ssl(void)
30853075
rb_define_const(mSSL, "TLS1_1_VERSION", INT2NUM(TLS1_1_VERSION));
30863076
/* TLS 1.2 */
30873077
rb_define_const(mSSL, "TLS1_2_VERSION", INT2NUM(TLS1_2_VERSION));
3088-
#ifdef TLS1_3_VERSION /* OpenSSL 1.1.1 */
30893078
/* TLS 1.3 */
30903079
rb_define_const(mSSL, "TLS1_3_VERSION", INT2NUM(TLS1_3_VERSION));
3091-
#endif
30923080

30933081

30943082
sym_exception = ID2SYM(rb_intern_const("exception"));

ext/openssl/ossl_x509.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Init_ossl_x509(void)
130130
#if defined(X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION) /* OpenSSL 1.1.0, missing in LibreSSL */
131131
DefX509Const(V_ERR_PROXY_SUBJECT_NAME_VIOLATION);
132132
#endif
133-
#if defined(X509_V_ERR_OCSP_VERIFY_NEEDED)
133+
#if defined(X509_V_ERR_OCSP_VERIFY_NEEDED) /* OpenSSL 1.1.1, missing in LibreSSL */
134134
DefX509Const(V_ERR_OCSP_VERIFY_NEEDED);
135135
DefX509Const(V_ERR_OCSP_VERIFY_FAILED);
136136
DefX509Const(V_ERR_OCSP_CERT_UNKNOWN);

ext/openssl/ossl_x509store.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,6 @@ ossl_x509store_add_file(VALUE self, VALUE file)
357357
ossl_raise(eX509StoreError, "X509_STORE_add_lookup");
358358
if (X509_LOOKUP_load_file(lookup, path, X509_FILETYPE_PEM) != 1)
359359
ossl_raise(eX509StoreError, "X509_LOOKUP_load_file");
360-
#if !OSSL_OPENSSL_PREREQ(1, 1, 1) && !OSSL_IS_LIBRESSL
361-
/*
362-
* X509_load_cert_crl_file() which is called from X509_LOOKUP_load_file()
363-
* did not check the return value of X509_STORE_add_{cert,crl}(), leaking
364-
* "cert already in hash table" errors on the error queue, if duplicate
365-
* certificates are found. Fixed by OpenSSL 1.1.1 and LibreSSL 3.5.0.
366-
*/
367-
ossl_clear_error();
368-
#endif
369360

370361
return self;
371362
}

test/openssl/test_pkey.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def test_hmac_sign_verify
8484
def test_ed25519
8585
# Ed25519 is not FIPS-approved.
8686
omit_on_fips
87-
omit "Ed25519 not supported" if openssl? && !openssl?(1, 1, 1)
8887

8988
# Test vector from RFC 8032 Section 7.1 TEST 2
9089
priv_pem = <<~EOF
@@ -157,9 +156,6 @@ def test_x25519
157156
assert_equal bob_pem, bob.public_to_pem
158157
assert_equal [shared_secret].pack("H*"), alice.derive(bob)
159158

160-
if openssl? && !openssl?(1, 1, 1)
161-
omit "running OpenSSL version does not have raw public key support"
162-
end
163159
alice_private = OpenSSL::PKey.new_raw_private_key("X25519", alice.raw_private_key)
164160
bob_public = OpenSSL::PKey.new_raw_public_key("X25519", bob.raw_public_key)
165161
assert_equal alice_private.private_to_pem,
@@ -173,8 +169,6 @@ def test_x25519
173169
end
174170

175171
def test_raw_initialize_errors
176-
omit "Ed25519 not supported" if openssl? && !openssl?(1, 1, 1)
177-
178172
assert_raise(OpenSSL::PKey::PKeyError) { OpenSSL::PKey.new_raw_private_key("foo123", "xxx") }
179173
assert_raise(OpenSSL::PKey::PKeyError) { OpenSSL::PKey.new_raw_private_key("ED25519", "xxx") }
180174
assert_raise(OpenSSL::PKey::PKeyError) { OpenSSL::PKey.new_raw_public_key("foo123", "xxx") }

test/openssl/test_pkey_dh.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_params_ok?
111111
# applying the following commits in OpenSSL 1.1.1d to make `DH_check`
112112
# function pass the RFC 7919 FFDHE group texts.
113113
# https://github.com/openssl/openssl/pull/9435
114-
unless openssl?(1, 1, 1, 4)
114+
if openssl? && !openssl?(1, 1, 1, 4)
115115
pend 'DH check for RFC 7919 FFDHE group texts is not implemented'
116116
end
117117

0 commit comments

Comments
 (0)