Skip to content

Commit

Permalink
ts: use TS_VERIFY_CTX_set_certs instead of TS_VERIFY_CTS_set_certs
Browse files Browse the repository at this point in the history
[ This is a backport to the 2.2 branch to fix build with LibreSSL. ]

OpenSSL 3.0 fixed the typo in the function name and replaced the
current 'CTS' version with a macro.

(cherry picked from commit 2be6779)
  • Loading branch information
rhenium committed Dec 22, 2022
1 parent 075b68e commit ec19e47
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ext/openssl/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,16 @@ def find_openssl_library
have_func("TS_STATUS_INFO_get0_status")
have_func("TS_STATUS_INFO_get0_text")
have_func("TS_STATUS_INFO_get0_failure_info")
have_func("TS_VERIFY_CTS_set_certs")
have_func("TS_VERIFY_CTS_set_certs(NULL, NULL)", "openssl/ts.h")
have_func("TS_VERIFY_CTX_set_store")
have_func("TS_VERIFY_CTX_add_flags")
have_func("TS_RESP_CTX_set_time_cb")
have_func("EVP_PBE_scrypt")
have_func("SSL_CTX_set_post_handshake_auth")

# added in 3.0.0
have_func("TS_VERIFY_CTX_set_certs(NULL, NULL)", "openssl/ts.h")

Logging::message "=== Checking done. ===\n"

create_header
Expand Down
5 changes: 5 additions & 0 deletions ext/openssl/openssl_missing.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,9 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
} while (0)
#endif

/* added in 3.0.0 */
#if !defined(HAVE_TS_VERIFY_CTX_SET_CERTS)
# define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
#endif

#endif /* _OSSL_OPENSSL_MISSING_H_ */
2 changes: 1 addition & 1 deletion ext/openssl/ossl_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ ossl_ts_resp_verify(int argc, VALUE *argv, VALUE self)
X509_up_ref(cert);
}

TS_VERIFY_CTS_set_certs(ctx, x509inter);
TS_VERIFY_CTX_set_certs(ctx, x509inter);
TS_VERIFY_CTX_add_flags(ctx, TS_VFY_SIGNATURE);
TS_VERIFY_CTX_set_store(ctx, x509st);

Expand Down

0 comments on commit ec19e47

Please sign in to comment.