Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/kern/ktls_test.c
Show First 20 Lines • Show All 907 Lines • ▼ Show 20 Lines | case EVFILT_READ: | ||||
outbuf_len += rv; | outbuf_len += rv; | ||||
} | } | ||||
if (outbuf_len < sizeof(struct tls_record_layer)) | if (outbuf_len < sizeof(struct tls_record_layer)) | ||||
break; | break; | ||||
record_len = sizeof(struct tls_record_layer) + | record_len = sizeof(struct tls_record_layer) + | ||||
ntohs(hdr->tls_length); | ntohs(hdr->tls_length); | ||||
assert(record_len <= outbuf_cap); | ATF_REQUIRE(record_len <= outbuf_cap); | ||||
assert(record_len > outbuf_len); | ATF_REQUIRE(record_len > outbuf_len); | ||||
rv = read(ev.ident, outbuf + outbuf_len, | rv = read(ev.ident, outbuf + outbuf_len, | ||||
record_len - outbuf_len); | record_len - outbuf_len); | ||||
if (rv == -1 && errno == EAGAIN) | if (rv == -1 && errno == EAGAIN) | ||||
break; | break; | ||||
ATF_REQUIRE_MSG(rv > 0, "failed to read from socket"); | ATF_REQUIRE_MSG(rv > 0, "failed to read from socket"); | ||||
outbuf_len += rv; | outbuf_len += rv; | ||||
if (outbuf_len == record_len) { | if (outbuf_len == record_len) { | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | test_ktls_transmit_control(struct tls_enable *en, uint64_t seqno, uint8_t type, | ||||
/* | /* | ||||
* First read the header to determine how much additional data | * First read the header to determine how much additional data | ||||
* to read. | * to read. | ||||
*/ | */ | ||||
rv = read(sockets[0], outbuf, sizeof(struct tls_record_layer)); | rv = read(sockets[0], outbuf, sizeof(struct tls_record_layer)); | ||||
ATF_REQUIRE(rv == sizeof(struct tls_record_layer)); | ATF_REQUIRE(rv == sizeof(struct tls_record_layer)); | ||||
payload_len = ntohs(hdr->tls_length); | payload_len = ntohs(hdr->tls_length); | ||||
record_len = payload_len + sizeof(struct tls_record_layer); | 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), | rv = read(sockets[0], outbuf + sizeof(struct tls_record_layer), | ||||
payload_len); | payload_len); | ||||
ATF_REQUIRE(rv == (ssize_t)payload_len); | ATF_REQUIRE(rv == (ssize_t)payload_len); | ||||
rv = decrypt_tls_record(en, seqno, outbuf, record_len, decrypted, len, | rv = decrypt_tls_record(en, seqno, outbuf, record_len, decrypted, len, | ||||
&record_type); | &record_type); | ||||
ATF_REQUIRE_MSG((ssize_t)len == rv, | ATF_REQUIRE_MSG((ssize_t)len == rv, | ||||
▲ Show 20 Lines • Show All 658 Lines • Show Last 20 Lines |