libkmipclient: Adjustments for OpenSSL v4.0.0 API changes and deprecations

With OpenSSL 4.0.0 function SSL_set1_host() is deprecated and should be
replaced by SSL_set1_ipaddr() and SSL_set1_dnsname().

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2026-02-27 10:07:06 +01:00
committed by Jan Höppner
parent 7e68d7f61a
commit 93f8d093ce

View File

@@ -378,8 +378,14 @@ int kmip_connection_tls_init(struct kmip_connection *conn, bool debug)
if (conn->config.tls_verify_host) {
SSL_set_hostflags(conn->plain_tls.ssl,
X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
#if OPENSSL_VERSION_PREREQ(4, 0)
if (SSL_set1_ipaddr(conn->plain_tls.ssl, hostname) != 1 &&
SSL_set1_dnsname(conn->plain_tls.ssl, hostname) != 1) {
kmip_debug(debug, "SSL_set1_ipaddr/dnsname failed");
#else
if (SSL_set1_host(conn->plain_tls.ssl, hostname) != 1) {
kmip_debug(debug, "SSL_set1_host failed");
#endif
if (debug)
ERR_print_errors_fp(stderr);
rc = -EIO;