@@ -4614,10 +4614,12 @@ int test_tls13_empty_record_limit(void)
46144614 test_memio_clear_buffer (& test_ctx , 1 );
46154615
46164616 /* Get the size of an encrypted zero-length app data record. */
4617- recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4618- application_data , 0 , 1 , 0 );
4619- ExpectIntGT (recSz , 0 );
4620- ExpectIntLE (recSz , (int )sizeof (rec ));
4617+ if (EXPECT_SUCCESS ()) {
4618+ recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4619+ application_data , 0 , 1 , 0 );
4620+ ExpectIntGT (recSz , 0 );
4621+ ExpectIntLE (recSz , (int )sizeof (rec ));
4622+ }
46214623
46224624 /* Build all empty records into one contiguous buffer. */
46234625 if (EXPECT_SUCCESS ()) {
@@ -4635,14 +4637,18 @@ int test_tls13_empty_record_limit(void)
46354637 }
46364638
46374639 /* Inject all records as a single message. */
4638- ExpectIntEQ (test_memio_inject_message (& test_ctx , 0 , (const char * )allRecs ,
4639- recSz * numRecs ), 0 );
4640+ if (EXPECT_SUCCESS ()) {
4641+ ExpectIntEQ (test_memio_inject_message (& test_ctx , 0 ,
4642+ (const char * )allRecs , recSz * numRecs ), 0 );
4643+ }
46404644
46414645 /* The server's wolfSSL_read should fail with EMPTY_RECORD_LIMIT_E. */
4642- ExpectIntEQ (wolfSSL_read (ssl_s , buf , sizeof (buf )),
4643- WC_NO_ERR_TRACE (WOLFSSL_FATAL_ERROR ));
4644- ExpectIntEQ (wolfSSL_get_error (ssl_s , WOLFSSL_FATAL_ERROR ),
4645- WC_NO_ERR_TRACE (EMPTY_RECORD_LIMIT_E ));
4646+ if (EXPECT_SUCCESS ()) {
4647+ ExpectIntEQ (wolfSSL_read (ssl_s , buf , sizeof (buf )),
4648+ WC_NO_ERR_TRACE (WOLFSSL_FATAL_ERROR ));
4649+ ExpectIntEQ (wolfSSL_get_error (ssl_s , WOLFSSL_FATAL_ERROR ),
4650+ WC_NO_ERR_TRACE (EMPTY_RECORD_LIMIT_E ));
4651+ }
46464652
46474653 XFREE (allRecs , NULL , DYNAMIC_TYPE_TMP_BUFFER );
46484654 allRecs = NULL ;
@@ -4668,24 +4674,28 @@ int test_tls13_empty_record_limit(void)
46684674 test_memio_clear_buffer (& test_ctx , 0 );
46694675 test_memio_clear_buffer (& test_ctx , 1 );
46704676
4671- recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4672- application_data , 0 , 1 , 0 );
4673- ExpectIntGT (recSz , 0 );
4677+ if (EXPECT_SUCCESS ()) {
4678+ recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4679+ application_data , 0 , 1 , 0 );
4680+ ExpectIntGT (recSz , 0 );
4681+ }
46744682
46754683 {
46764684 int emptyBefore = WOLFSSL_MAX_EMPTY_RECORDS - 1 ;
46774685 int emptyAfter = WOLFSSL_MAX_EMPTY_RECORDS - 1 ;
4678- int dataRecSz ;
4686+ int dataRecSz = 0 ;
46794687 byte dataRec [128 ];
46804688 byte payload [1 ] = { 'a' };
4681- int totalSz ;
4689+ int totalSz = 0 ;
46824690
4683- dataRecSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 1 ,
4684- application_data , 0 , 1 , 0 );
4685- ExpectIntGT (dataRecSz , 0 );
4691+ if (EXPECT_SUCCESS ()) {
4692+ dataRecSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 1 ,
4693+ application_data , 0 , 1 , 0 );
4694+ ExpectIntGT (dataRecSz , 0 );
4695+ }
46864696
4687- totalSz = recSz * (emptyBefore + emptyAfter ) + dataRecSz ;
46884697 if (EXPECT_SUCCESS ()) {
4698+ totalSz = recSz * (emptyBefore + emptyAfter ) + dataRecSz ;
46894699 allRecs = (byte * )XMALLOC ((size_t )totalSz , NULL ,
46904700 DYNAMIC_TYPE_TMP_BUFFER );
46914701 ExpectNotNull (allRecs );
@@ -4721,15 +4731,19 @@ int test_tls13_empty_record_limit(void)
47214731 rec , (size_t )recSz );
47224732 }
47234733
4724- ExpectIntEQ (test_memio_inject_message (& test_ctx , 0 ,
4725- (const char * )allRecs , totalSz ), 0 );
4734+ if (EXPECT_SUCCESS ()) {
4735+ ExpectIntEQ (test_memio_inject_message (& test_ctx , 0 ,
4736+ (const char * )allRecs , totalSz ), 0 );
4737+ }
47264738 }
47274739
47284740 /* wolfSSL_read should return the 1-byte payload. The counter resets
47294741 * on the non-empty record so neither batch of (limit - 1) empties
47304742 * triggers the error. */
4731- ExpectIntEQ (wolfSSL_read (ssl_s , buf , sizeof (buf )), 1 );
4732- ExpectIntEQ (buf [0 ], 'a' );
4743+ if (EXPECT_SUCCESS ()) {
4744+ ExpectIntEQ (wolfSSL_read (ssl_s , buf , sizeof (buf )), 1 );
4745+ ExpectIntEQ (buf [0 ], 'a' );
4746+ }
47334747
47344748 XFREE (allRecs , NULL , DYNAMIC_TYPE_TMP_BUFFER );
47354749 wolfSSL_free (ssl_c );
0 commit comments