git: b2d704ea8820 - stable/13 - ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 23 Nov 2021 23:13:12 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=b2d704ea882031204c41ecf472200e9bf5c629eb

commit b2d704ea882031204c41ecf472200e9bf5c629eb
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-11-16 17:56:15 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-11-23 23:11:54 +0000

    ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.
    
    The TLS header length field is set by the kernel, so if it is
    incorrect that is an indication of a kernel bug, not an internal error
    in the tests.
    
    Prompted by:    markj (comment in an earlier review)
    Reviewed by:    markj
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D33003
    
    (cherry picked from commit d71830cdf0df6dbc4bd3332daa95d9ecd7d64060)
---
 tests/sys/kern/ktls_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c
index 21e3213a8634..64e26bb27f37 100644
--- a/tests/sys/kern/ktls_test.c
+++ b/tests/sys/kern/ktls_test.c
@@ -913,8 +913,8 @@ test_ktls_transmit_app_data(struct tls_enable *en, uint64_t seqno, size_t len)
 
 			record_len = sizeof(struct tls_record_layer) +
 			    ntohs(hdr->tls_length);
-			assert(record_len <= outbuf_cap);
-			assert(record_len > outbuf_len);
+			ATF_REQUIRE(record_len <= outbuf_cap);
+			ATF_REQUIRE(record_len > outbuf_len);
 			rv = read(ev.ident, outbuf + outbuf_len,
 			    record_len - outbuf_len);
 			if (rv == -1 && errno == EAGAIN)
@@ -1013,7 +1013,7 @@ test_ktls_transmit_control(struct tls_enable *en, uint64_t seqno, uint8_t type,
 	ATF_REQUIRE(rv == sizeof(struct tls_record_layer));
 	payload_len = ntohs(hdr->tls_length);
 	record_len = payload_len + sizeof(struct tls_record_layer);
-	assert(record_len <= outbuf_cap);
+	ATF_REQUIRE(record_len <= outbuf_cap);
 	rv = read(sockets[0], outbuf + sizeof(struct tls_record_layer),
 	    payload_len);
 	ATF_REQUIRE(rv == (ssize_t)payload_len);