Skip to content

Commit e61be0d

Browse files
authored
Merge branch 'main' into sha3_absorb_squeeze
2 parents 02b8085 + 4243a79 commit e61be0d

File tree

3 files changed

+70
-6
lines changed

3 files changed

+70
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb
2+
index a24f5e0..26ab754 100644
3+
--- a/test/net/http/test_https.rb
4+
+++ b/test/net/http/test_https.rb
5+
@@ -167,6 +167,8 @@ def test_session_reuse
6+
def test_session_reuse_but_expire
7+
# FIXME: The new_session_cb is known broken for clients in OpenSSL 1.1.0h.
8+
omit if OpenSSL::OPENSSL_LIBRARY_VERSION.include?('OpenSSL 1.1.0h')
9+
+ # "AWS-LC does not support internal session caching on the client".
10+
+ omit if OpenSSL::OPENSSL_LIBRARY_VERSION.include?('AWS-LC')
11+
12+
http = Net::HTTP.new(HOST, config("port"))
13+
http.use_ssl = true
14+
@@ -237,7 +239,7 @@ def test_certificate_verify_failure
15+
ex = assert_raise(OpenSSL::SSL::SSLError){
16+
http.request_get("/") {|res| }
17+
}
18+
- assert_match(/certificate verify failed/, ex.message)
19+
+ assert_match(/certificate verify failed|CERTIFICATE_VERIFY_FAILED/, ex.message)
20+
unless /mswin|mingw/ =~ RUBY_PLATFORM
21+
# on Windows, Errno::ECONNRESET will be raised, and it'll be eaten by
22+
# WEBrick
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 226ae828c5cc2c87245417e9a372b9403c91a54c Mon Sep 17 00:00:00 2001
2+
From: Jeremy Evans <[email protected]>
3+
Date: Tue, 4 Jun 2024 16:35:06 -0700
4+
Subject: [PATCH] Fix wrong certificate version
5+
6+
OpenSSL::X509::Certificate#version= calls X509_set_version, and
7+
that sets the version stored in the certificate. However, the
8+
version stored in certificate is one less than the actual
9+
certificate version (https://www.openssl.org/docs/manmaster/man3/X509_set_version.html).
10+
There are no version 4 certificates, and when using recent LibreSSL,
11+
drb ssl tests all fail without this change.
12+
---
13+
lib/drb/ssl.rb | 2 +-
14+
1 file changed, 1 insertion(+), 1 deletion(-)
15+
16+
diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb
17+
index 392d656..4e4d992 100644
18+
--- a/lib/drb/ssl.rb
19+
+++ b/lib/drb/ssl.rb
20+
@@ -185,7 +185,7 @@ module DRb
21+
}
22+
23+
cert = OpenSSL::X509::Certificate.new
24+
- cert.version = 3
25+
+ cert.version = 2
26+
cert.serial = 0
27+
name = OpenSSL::X509::Name.new(self[:SSLCertName])
28+
cert.subject = name
29+
--
30+
2.25.1
31+

tests/ci/integration/run_ruby_integration.sh

+17-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ FIPS=${FIPS:-"0"}
2525
SCRATCH_FOLDER="${SRC_ROOT}/RUBY_BUILD_ROOT"
2626
RUBY_SRC_FOLDER="${SCRATCH_FOLDER}/ruby-src"
2727
RUBY_PATCH_FOLDER="${SRC_ROOT}/tests/ci/integration/ruby_patch"
28+
RUBY_BACKPORT_FOLDER="${SRC_ROOT}/tests/ci/integration/ruby_patch/ruby_release_backport"
29+
RUBY_COMMON_FOLDER="${SRC_ROOT}/tests/ci/integration/ruby_patch/ruby_patch_common"
2830
AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build"
2931
AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install"
3032

@@ -45,26 +47,35 @@ function ruby_build() {
4547
ldd "$(find "$PWD/install" -name "openssl.so")" | grep "${AWS_LC_INSTALL_FOLDER}/lib/libcrypto.so" || exit 1
4648
ldd "$(find "$PWD/install" -name "openssl.so")" | grep "${AWS_LC_INSTALL_FOLDER}/lib/libssl.so" || exit 1
4749

48-
#TODO: add more relevant tests here
4950
make test-all TESTS="test/openssl/*.rb"
51+
make test-all TESTS="test/drb/*ssl*.rb"
52+
make test-all TESTS="test/rubygems/test*.rb"
5053

5154
popd
5255
}
5356

5457
function ruby_patch() {
5558
local branch=${1}
5659
local src_dir="${RUBY_SRC_FOLDER}/${branch}"
57-
local patch_dir="${RUBY_PATCH_FOLDER}/${branch}"
58-
if [[ ! $(find -L ${patch_dir} -type f -name '*.patch') ]]; then
60+
local patch_dirs=("${RUBY_PATCH_FOLDER}/${branch}" "${RUBY_COMMON_FOLDER}")
61+
if [[ ! $(find -L ${patch_dirs[0]} -type f -name '*.patch') ]]; then
5962
echo "No patch for ${branch}!"
6063
exit 1
6164
fi
6265
git clone https://github.com/ruby/ruby.git ${src_dir} \
6366
--depth 1 \
6467
--branch ${branch}
65-
for patchfile in $(find -L ${patch_dir} -type f -name '*.patch'); do
66-
echo "Apply patch ${patchfile}..."
67-
cat ${patchfile} | patch -p1 --quiet -d ${src_dir}
68+
69+
# Add directory of backport patches if branch is not master.
70+
if [[ "${branch}" != "master" ]]; then
71+
patch_dirs+=("${RUBY_BACKPORT_FOLDER}")
72+
fi
73+
74+
for patch_dir in "${patch_dirs[@]}"; do
75+
for patchfile in $(find -L ${patch_dir} -type f -name '*.patch'); do
76+
echo "Apply patch ${patchfile}..."
77+
cat ${patchfile} | patch -p1 --quiet -d ${src_dir}
78+
done
6879
done
6980
}
7081

0 commit comments

Comments
 (0)