Skip to content

Commit 9ac64e9

Browse files
committed
Generate IP-host test certificates in CMake build
The cert_ip_cn.pem and cert_ipv6.pem certificates added in ba390f2 were only generated by gen-certs.sh, which the Makefile-based Linux/macOS CI uses. The Windows CI builds with CMake, whose own certificate-generation block was not updated, so cert_ipv6.pem was missing there and SSLClientServerTest.TlsVerifyHostnameIpv6San failed on is_valid(). Mirror the two openssl commands into test/CMakeLists.txt to keep both certificate-generation paths in sync.
1 parent ba390f2 commit 9ac64e9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ if(HTTPLIB_IS_USING_OPENSSL)
116116
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
117117
COMMAND_ERROR_IS_FATAL ANY
118118
)
119+
# Certificates for IP-host hostname verification regression tests.
120+
# cert_ip_cn.pem: CN is an IPv4 literal with NO subjectAltName. An IP host
121+
# must NOT be authenticated via the CN, so verifying it
122+
# against this cert must fail.
123+
execute_process(
124+
COMMAND ${OPENSSL_COMMAND} req -x509 -key key.pem -sha256 -days 3650 -nodes -subj /CN=127.0.0.1 -out cert_ip_cn.pem
125+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
126+
COMMAND_ERROR_IS_FATAL ANY
127+
)
128+
# cert_ipv6.pem: CN is an IPv6 literal plus an IPv6 iPAddress SAN for a
129+
# different address. The SAN address must match; the CN
130+
# address must be ignored.
131+
execute_process(
132+
COMMAND ${OPENSSL_COMMAND} req -x509 -key key.pem -sha256 -days 3650 -nodes -subj /CN=::1 -addext subjectAltName=IP:2001:db8::1 -out cert_ipv6.pem
133+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
134+
COMMAND_ERROR_IS_FATAL ANY
135+
)
119136
endif()
120137

121138
add_subdirectory(fuzzing)

0 commit comments

Comments
 (0)