Skip to content

Make tests pass on LibreSSL 3.5 and 3.4 #506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ jobs:
- openssl-1.1.1l
- openssl-3.0.1
- libressl-3.1.5 # EOL
- libressl-3.2.6
- libressl-3.3.4
- libressl-3.2.7
- libressl-3.3.5
- libressl-3.4.2
- libressl-3.5.0
steps:
- name: repo checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/ossl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
#ifndef LIBRESSL_VERSION_NUMBER
# define OSSL_IS_LIBRESSL 0
# define OSSL_OPENSSL_PREREQ(maj, min, pat) \
(OPENSSL_VERSION_NUMBER >= (maj << 28) | (min << 20) | (pat << 12))
(OPENSSL_VERSION_NUMBER >= ((maj << 28) | (min << 20) | (pat << 12)))
# define OSSL_LIBRESSL_PREREQ(maj, min, pat) 0
#else
# define OSSL_IS_LIBRESSL 1
# define OSSL_OPENSSL_PREREQ(maj, min, pat) 0
# define OSSL_LIBRESSL_PREREQ(maj, min, pat) \
(LIBRESSL_VERSION_NUMBER >= (maj << 28) | (min << 20) | (pat << 12))
(LIBRESSL_VERSION_NUMBER >= ((maj << 28) | (min << 20) | (pat << 12)))
#endif

#if !defined(OPENSSL_NO_ENGINE) && !OSSL_OPENSSL_PREREQ(3, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_pkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ ossl_pkey_export_traditional(int argc, VALUE *argv, VALUE self, int to_der)
}
}
else {
#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
#if OSSL_OPENSSL_PREREQ(1, 1, 0) || OSSL_LIBRESSL_PREREQ(3, 5, 0)
if (!PEM_write_bio_PrivateKey_traditional(bio, pkey, enc, NULL, 0,
ossl_pem_passwd_cb,
(void *)pass)) {
Expand Down
6 changes: 5 additions & 1 deletion test/openssl/test_ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,11 @@ def test_ciphersuites_method_tls_connection

server_connect(port, cli_ctx) do |ssl|
assert_equal('TLSv1.3', ssl.ssl_version)
assert_equal(csuite[0], ssl.cipher[0])
if libressl?(3, 4, 0) && !libressl?(3, 5, 0)
assert_equal("AEAD-AES128-GCM-SHA256", ssl.cipher[0])
else
assert_equal(csuite[0], ssl.cipher[0])
end
ssl.puts('abc'); assert_equal("abc\n", ssl.gets)
end
end
Expand Down