summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/tls.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-07-06 01:59:25 +0200
committerDavid S. Miller <davem@davemloft.net>2022-07-06 13:56:35 +0200
commitf36068a20256bad993d60e49602f02e3af336506 (patch)
tree0a31699ba4bfcaab9cd9fdf1be6da6d08d0ca914 /tools/testing/selftests/net/tls.c
parenttls: rx: add sockopt for enabling optimistic decrypt with TLS 1.3 (diff)
downloadlinux-f36068a20256bad993d60e49602f02e3af336506.tar.xz
linux-f36068a20256bad993d60e49602f02e3af336506.zip
selftests: tls: add selftest variant for pad
Add a self-test variant with TLS 1.3 nopad set. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/tls.c')
-rw-r--r--tools/testing/selftests/net/tls.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 5d70b04c482c..e71ec5846be9 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -235,6 +235,7 @@ FIXTURE_VARIANT(tls)
{
uint16_t tls_version;
uint16_t cipher_type;
+ bool nopad;
};
FIXTURE_VARIANT_ADD(tls, 12_aes_gcm)
@@ -297,9 +298,17 @@ FIXTURE_VARIANT_ADD(tls, 13_aes_gcm_256)
.cipher_type = TLS_CIPHER_AES_GCM_256,
};
+FIXTURE_VARIANT_ADD(tls, 13_nopad)
+{
+ .tls_version = TLS_1_3_VERSION,
+ .cipher_type = TLS_CIPHER_AES_GCM_128,
+ .nopad = true,
+};
+
FIXTURE_SETUP(tls)
{
struct tls_crypto_info_keys tls12;
+ int one = 1;
int ret;
tls_crypto_info_init(variant->tls_version, variant->cipher_type,
@@ -315,6 +324,12 @@ FIXTURE_SETUP(tls)
ret = setsockopt(self->cfd, SOL_TLS, TLS_RX, &tls12, tls12.len);
ASSERT_EQ(ret, 0);
+
+ if (variant->nopad) {
+ ret = setsockopt(self->cfd, SOL_TLS, TLS_RX_EXPECT_NO_PAD,
+ (void *)&one, sizeof(one));
+ ASSERT_EQ(ret, 0);
+ }
}
FIXTURE_TEARDOWN(tls)