Skip to content

Commit 27cb0b1

Browse files
committed
set ASYNC for non-certificate case, too
1 parent efa1701 commit 27cb0b1

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/lib/tls/ctx.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client)
553553
X509_STORE *cert_vpstore;
554554
X509_STORE *verify_store;
555555
int ctx_options = 0;
556+
int mode= SSL_MODE_ASYNC;
556557

557558
ctx = SSL_CTX_new(TLS_method());
558559
if (!ctx) {
@@ -656,37 +657,31 @@ SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client)
656657
goto error;
657658
}
658659

660+
SSL_CTX_set_mode(ctx, mode);
659661
goto post_ca;
660662
}
661663
#else
662664
(void) client; /* -Wunused */
663665
#endif
664666

665667
/*
666-
* Set mode before processing any certifictes
667-
*/
668-
{
669-
int mode = SSL_MODE_ASYNC;
670-
671-
/*
672-
* OpenSSL will automatically create certificate chains,
673-
* unless we tell it to not do that. The problem is that
674-
* it sometimes gets the chains right from a certificate
675-
* signature view, but wrong from the clients view.
676-
*
677-
* It's better just to have users specify the complete
678-
* chains.
668+
* OpenSSL will automatically create certificate chains,
669+
* unless we tell it to not do that. The problem is that
670+
* it sometimes gets the chains right from a certificate
671+
* signature view, but wrong from the clients view.
672+
*
673+
* It's better just to have users specify the complete
674+
* chains.
679675
*/
680-
mode |= SSL_MODE_NO_AUTO_CHAIN;
676+
mode |= SSL_MODE_NO_AUTO_CHAIN;
681677

682-
if (client) {
683-
mode |= SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER;
684-
mode |= SSL_MODE_AUTO_RETRY;
685-
}
686-
687-
if (mode) SSL_CTX_set_mode(ctx, mode);
678+
if (client) {
679+
mode |= SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER;
680+
mode |= SSL_MODE_AUTO_RETRY;
688681
}
689682

683+
SSL_CTX_set_mode(ctx, mode);
684+
690685
/*
691686
* Initialise a separate store for verifying user
692687
* certificates.

0 commit comments

Comments
 (0)