Skip to content

Commit 2b87193

Browse files
committed
Allow clearing group messages flag
1 parent 9a5d00f commit 2b87193

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/ssl.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5159,6 +5159,16 @@ int wolfSSL_CTX_set_group_messages(WOLFSSL_CTX* ctx)
51595159

51605160
return WOLFSSL_SUCCESS;
51615161
}
5162+
5163+
int wolfSSL_CTX_clear_group_messages(WOLFSSL_CTX* ctx)
5164+
{
5165+
if (ctx == NULL)
5166+
return BAD_FUNC_ARG;
5167+
5168+
ctx->groupMessages = 0;
5169+
5170+
return WOLFSSL_SUCCESS;
5171+
}
51625172
#endif
51635173

51645174

@@ -5192,6 +5202,15 @@ int wolfSSL_set_group_messages(WOLFSSL* ssl)
51925202
return WOLFSSL_SUCCESS;
51935203
}
51945204

5205+
int wolfSSL_clear_group_messages(WOLFSSL* ssl)
5206+
{
5207+
if (ssl == NULL)
5208+
return BAD_FUNC_ARG;
5209+
5210+
ssl->options.groupMessages = 0;
5211+
5212+
return WOLFSSL_SUCCESS;
5213+
}
51955214

51965215
/* make minVersion the internal equivalent SSL version */
51975216
static int SetMinVersionHelper(byte* minVersion, int version)

tests/api/test_tls.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int test_utils_memio_move_message(void)
4545
ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
4646
wolfTLSv1_2_client_method, wolfTLSv1_2_server_method), 0);
4747
wolfSSL_set_verify(ssl_s, WOLFSSL_VERIFY_PEER, NULL);
48+
ExpectIntEQ(wolfSSL_clear_group_messages(ssl_s), 1);
4849
/* start handshake, send first ClientHello */
4950
ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
5051
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
@@ -316,6 +317,7 @@ int test_tls_certreq_order(void)
316317
ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
317318
wolfTLSv1_2_client_method, wolfTLSv1_2_server_method), 0);
318319
wolfSSL_set_verify(ssl_s, WOLFSSL_VERIFY_PEER, NULL);
320+
ExpectIntEQ(wolfSSL_clear_group_messages(ssl_s), 1);
319321

320322
/* start handshake, send first ClientHello */
321323
ExpectIntEQ(wolfSSL_connect(ssl_c), -1);

wolfssl/ssl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,7 +3696,9 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* key, unsigned int len,
36963696
#endif
36973697

36983698
WOLFSSL_API int wolfSSL_CTX_set_group_messages(WOLFSSL_CTX* ctx);
3699+
WOLFSSL_API int wolfSSL_CTX_clear_group_messages(WOLFSSL_CTX* ctx);
36993700
WOLFSSL_API int wolfSSL_set_group_messages(WOLFSSL* ssl);
3701+
WOLFSSL_API int wolfSSL_clear_group_messages(WOLFSSL* ssl);
37003702

37013703

37023704
#ifdef HAVE_FUZZER

0 commit comments

Comments
 (0)