Commit b637fbe781 for openssl.org
commit b637fbe781ab40afca700a44fa78b8748f5892dd
Author: Matt Caswell <matt@openssl.org>
Date: Fri Apr 11 14:21:48 2025 +0100
Add a test for calling SSL_accept() on a listener
We expect this scenario to fail
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27351)
diff --git a/test/quicapitest.c b/test/quicapitest.c
index 25b7d242cf..a8d803501c 100644
--- a/test/quicapitest.c
+++ b/test/quicapitest.c
@@ -2770,6 +2770,12 @@ static int test_ssl_accept_connection(void)
if (!create_quic_ssl_objects(sctx, cctx, &qlistener, &clientssl))
goto err;
+ /* Calling SSL_accept() on a listener is expected to fail */
+ ret = SSL_accept(qlistener);
+ if (!TEST_int_le(ret, 0)
+ || !TEST_int_eq(SSL_get_error(qlistener, ret), SSL_ERROR_SSL))
+ goto err;
+
/* Send ClientHello and server retry */
for (i = 0; i < 2; i++) {
ret = SSL_connect(clientssl);