Skip to content

Commit 3ec3178

Browse files
committed
only set CRL if we're using certificates
and complain if check_crl=yes, but OpenSSL doesn't have the relevant flags
1 parent 27cb0b1 commit 3ec3178

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/lib/tls/ctx.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,7 @@ int tls_ctx_version_set(
550550
SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client)
551551
{
552552
SSL_CTX *ctx;
553-
X509_STORE *cert_vpstore;
554-
X509_STORE *verify_store;
553+
X509_STORE *verify_store = NULL;
555554
int ctx_options = 0;
556555
int mode= SSL_MODE_ASYNC;
557556

@@ -881,16 +880,11 @@ SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client)
881880
SSL_CTX_set_info_callback(ctx, fr_tls_session_info_cb);
882881

883882
/*
884-
* Check the certificates for revocation.
883+
* Check the certificates for revocation, but not if we're doing PSK.
885884
*/
885+
if (conf->verify.check_crl && verify_store) {
886886
#ifdef X509_V_FLAG_CRL_CHECK_ALL
887-
if (conf->verify.check_crl) {
888-
cert_vpstore = SSL_CTX_get_cert_store(ctx);
889-
if (cert_vpstore == NULL) {
890-
fr_tls_log(NULL, "Error reading Certificate Store");
891-
goto error;
892-
}
893-
X509_STORE_set_flags(cert_vpstore, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
887+
X509_STORE_set_flags(verify_store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
894888
#ifdef X509_V_FLAG_USE_DELTAS
895889
/*
896890
* If set, delta CRLs (if present) are used to
@@ -899,10 +893,12 @@ SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client)
899893
*
900894
* So it's safe to always set this flag.
901895
*/
902-
X509_STORE_set_flags(cert_vpstore, X509_V_FLAG_USE_DELTAS);
896+
X509_STORE_set_flags(verify_store, X509_V_FLAG_USE_DELTAS);
903897
#endif
904-
}
898+
#else
899+
WARN(LOG_PREFIX ": Ignoring 'check_crl = yes' as the OpenSSL libraries do not support the relevant flags");
905900
#endif
901+
}
906902

907903
/*
908904
* SSL_ctx_set_verify is now called in the session

0 commit comments

Comments
 (0)