mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
selftests: tls: add a selftest for wrapping rec_seq
Set the initial rec_seq to 0xffffffffffffffff so that it wraps
immediately. The send() call should fail with EBADMSG.
A bug in this code was fixed in commit cfaa80c91f
("net/tls: do not
free tls_rec on async operation in bpf_exec_tx_verdict()").
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20775fcfd0371422921ee60a42de170c0398ac10.1729244987.git.sd@queasysnail.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
8b448f0dbc
commit
81bc949f64
1 changed files with 19 additions and 0 deletions
|
@ -266,6 +266,25 @@ TEST_F(tls_basic, bad_cipher)
|
|||
EXPECT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, sizeof(struct tls12_crypto_info_aes_gcm_128)), -1);
|
||||
}
|
||||
|
||||
TEST_F(tls_basic, recseq_wrap)
|
||||
{
|
||||
struct tls_crypto_info_keys tls12;
|
||||
char const *test_str = "test_read";
|
||||
int send_len = 10;
|
||||
|
||||
if (self->notls)
|
||||
SKIP(return, "no TLS support");
|
||||
|
||||
tls_crypto_info_init(TLS_1_2_VERSION, TLS_CIPHER_AES_GCM_128, &tls12);
|
||||
memset(&tls12.aes128.rec_seq, 0xff, sizeof(tls12.aes128.rec_seq));
|
||||
|
||||
ASSERT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, tls12.len), 0);
|
||||
ASSERT_EQ(setsockopt(self->cfd, SOL_TLS, TLS_RX, &tls12, tls12.len), 0);
|
||||
|
||||
EXPECT_EQ(send(self->fd, test_str, send_len, 0), -1);
|
||||
EXPECT_EQ(errno, EBADMSG);
|
||||
}
|
||||
|
||||
FIXTURE(tls)
|
||||
{
|
||||
int fd, cfd;
|
||||
|
|
Loading…
Add table
Reference in a new issue