Skip to content

Commit 4b7c052

Browse files
committed
test_wolfSSL_inject: don't call accept on completed handshake
1 parent d1c321a commit 4b7c052

1 file changed

Lines changed: 32 additions & 20 deletions

File tree

tests/api.c

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50626,6 +50626,8 @@ static int test_wolfSSL_inject(void)
5062650626
struct test_memio_ctx test_ctx;
5062750627
WOLFSSL_ALERT_HISTORY h;
5062850628
int rounds;
50629+
int hs_c = 0;
50630+
int hs_s = 0;
5062950631

5063050632
printf("Testing %s\n", params[i].tls_version);
5063150633

@@ -50635,31 +50637,41 @@ static int test_wolfSSL_inject(void)
5063550637
params[i].client_meth, params[i].server_meth), 0);
5063650638

5063750639
for (rounds = 0; rounds < 10 && EXPECT_SUCCESS(); rounds++) {
50638-
wolfSSL_SetLoggingPrefix("client");
50639-
if (wolfSSL_negotiate(ssl_c) != 1) {
50640-
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1),
50641-
WOLFSSL_ERROR_WANT_READ);
50642-
}
50643-
wolfSSL_SetLoggingPrefix("server");
50644-
if (test_ctx.s_len > 0) {
50645-
ExpectIntEQ(wolfSSL_inject(ssl_s, test_ctx.s_buff,
50646-
test_ctx.s_len), 1);
50647-
test_memio_clear_buffer(&test_ctx, 0);
50640+
if (!hs_c) {
50641+
wolfSSL_SetLoggingPrefix("client");
50642+
if (wolfSSL_negotiate(ssl_c) != 1) {
50643+
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1),
50644+
WOLFSSL_ERROR_WANT_READ);
50645+
}
50646+
else
50647+
hs_c = 1;
5064850648
}
50649-
if (wolfSSL_negotiate(ssl_s) != 1) {
50650-
ExpectIntEQ(wolfSSL_get_error(ssl_s, -1),
50651-
WOLFSSL_ERROR_WANT_READ);
50649+
if (!hs_s) {
50650+
wolfSSL_SetLoggingPrefix("server");
50651+
if (test_ctx.s_len > 0) {
50652+
ExpectIntEQ(wolfSSL_inject(ssl_s, test_ctx.s_buff,
50653+
test_ctx.s_len), 1);
50654+
test_memio_clear_buffer(&test_ctx, 0);
50655+
}
50656+
if (wolfSSL_negotiate(ssl_s) != 1) {
50657+
ExpectIntEQ(wolfSSL_get_error(ssl_s, -1),
50658+
WOLFSSL_ERROR_WANT_READ);
50659+
}
50660+
else
50661+
hs_s = 1;
5065250662
}
50653-
wolfSSL_SetLoggingPrefix("client");
50654-
if (test_ctx.c_len > 0) {
50655-
ExpectIntEQ(wolfSSL_inject(ssl_c, test_ctx.c_buff,
50656-
test_ctx.c_len), 1);
50657-
test_memio_clear_buffer(&test_ctx, 1);
50663+
if (!hs_c) {
50664+
wolfSSL_SetLoggingPrefix("client");
50665+
if (test_ctx.c_len > 0) {
50666+
ExpectIntEQ(wolfSSL_inject(ssl_c, test_ctx.c_buff,
50667+
test_ctx.c_len), 1);
50668+
test_memio_clear_buffer(&test_ctx, 1);
50669+
}
5065850670
}
5065950671
wolfSSL_SetLoggingPrefix(NULL);
5066050672
}
50661-
ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
50662-
ExpectIntEQ(wolfSSL_negotiate(ssl_s), 1);
50673+
ExpectIntEQ(hs_c, 1);
50674+
ExpectIntEQ(hs_s, 1);
5066350675

5066450676
wolfSSL_free(ssl_c);
5066550677
wolfSSL_free(ssl_s);

0 commit comments

Comments
 (0)