Commit e29903c4 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

selftests/tls: fix TLS tests with CONFIG_TLS=n

Build bot reports some recent TLS tests are failing
with CONFIG_TLS=n. Correct the expected return code
and skip TLS installation if not supported.

Tested with CONFIG_TLS=n and CONFIG_TLS=m.
Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
Fixes: cf32526c ("selftests/tls: add a test for ULP but no keys")
Fixes: 65d41fb3 ("selftests/tls: add a bidirectional test")
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d8a1de3d
...@@ -69,7 +69,7 @@ FIXTURE_SETUP(tls_basic) ...@@ -69,7 +69,7 @@ FIXTURE_SETUP(tls_basic)
ret = setsockopt(self->fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); ret = setsockopt(self->fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls"));
if (ret != 0) { if (ret != 0) {
ASSERT_EQ(errno, ENOTSUPP); ASSERT_EQ(errno, ENOENT);
self->notls = true; self->notls = true;
printf("Failure setting TCP_ULP, testing without tls\n"); printf("Failure setting TCP_ULP, testing without tls\n");
return; return;
...@@ -696,21 +696,26 @@ TEST_F(tls, recv_lowat) ...@@ -696,21 +696,26 @@ TEST_F(tls, recv_lowat)
TEST_F(tls, bidir) TEST_F(tls, bidir)
{ {
struct tls12_crypto_info_aes_gcm_128 tls12;
char const *test_str = "test_read"; char const *test_str = "test_read";
int send_len = 10; int send_len = 10;
char buf[10]; char buf[10];
int ret; int ret;
if (!self->notls) {
struct tls12_crypto_info_aes_gcm_128 tls12;
memset(&tls12, 0, sizeof(tls12)); memset(&tls12, 0, sizeof(tls12));
tls12.info.version = TLS_1_3_VERSION; tls12.info.version = TLS_1_3_VERSION;
tls12.info.cipher_type = TLS_CIPHER_AES_GCM_128; tls12.info.cipher_type = TLS_CIPHER_AES_GCM_128;
ret = setsockopt(self->fd, SOL_TLS, TLS_RX, &tls12, sizeof(tls12)); ret = setsockopt(self->fd, SOL_TLS, TLS_RX, &tls12,
sizeof(tls12));
ASSERT_EQ(ret, 0); ASSERT_EQ(ret, 0);
ret = setsockopt(self->cfd, SOL_TLS, TLS_TX, &tls12, sizeof(tls12)); ret = setsockopt(self->cfd, SOL_TLS, TLS_TX, &tls12,
sizeof(tls12));
ASSERT_EQ(ret, 0); ASSERT_EQ(ret, 0);
}
ASSERT_EQ(strlen(test_str) + 1, send_len); ASSERT_EQ(strlen(test_str) + 1, send_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment