Skip to content

Commit a9b6a64

Browse files
committed
ssl: fix extconf.rb check for SSL_CTX_set0_tmp_dh_pkey()
Check for the function we actually use. Both SSL_set0_tmp_dh_pkey() and SSL_CTX_set0_tmp_dh_pkey() were added in OpenSSL 3.0.
1 parent 013db02 commit a9b6a64

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ext/openssl/extconf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def find_openssl_library
147147
have_func("EVP_PKEY_check(NULL)", evp_h)
148148

149149
# added in 3.0.0
150-
have_func("SSL_set0_tmp_dh_pkey(NULL, NULL)", ssl_h)
150+
have_func("SSL_CTX_set0_tmp_dh_pkey(NULL, NULL)", ssl_h)
151151
have_func("ERR_get_error_all(NULL, NULL, NULL, NULL, NULL)", "openssl/err.h")
152152
have_func("SSL_CTX_load_verify_file(NULL, \"\")", ssl_h)
153153
have_func("BN_check_prime(NULL, NULL, NULL)", "openssl/bn.h")

ext/openssl/ossl_ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ ossl_sslctx_set_client_sigalgs(VALUE self, VALUE v)
11481148
* contained in the key object, if any, are ignored. The server will always
11491149
* generate a new key pair for each handshake.
11501150
*
1151-
* Added in version 3.0. See also the man page SSL_set0_tmp_dh_pkey(3).
1151+
* Added in version 3.0. See also the man page SSL_CTX_set0_tmp_dh_pkey(3).
11521152
*
11531153
* Example:
11541154
* ctx = OpenSSL::SSL::SSLContext.new
@@ -1169,7 +1169,7 @@ ossl_sslctx_set_tmp_dh(VALUE self, VALUE arg)
11691169
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_DH)
11701170
rb_raise(eSSLError, "invalid pkey type %s (expected DH)",
11711171
OBJ_nid2sn(EVP_PKEY_base_id(pkey)));
1172-
#ifdef HAVE_SSL_SET0_TMP_DH_PKEY
1172+
#ifdef HAVE_SSL_CTX_SET0_TMP_DH_PKEY
11731173
if (!SSL_CTX_set0_tmp_dh_pkey(ctx, pkey))
11741174
ossl_raise(eSSLError, "SSL_CTX_set0_tmp_dh_pkey");
11751175
EVP_PKEY_up_ref(pkey);

0 commit comments

Comments
 (0)