Commit d795cc02 authored by Vadim Fedorenko's avatar Vadim Fedorenko Committed by Jakub Kicinski

selftests/tls: fix selftest with CHACHA20-POLY1305

TLS selftests were broken also because of use of structure that
was not exported to UAPI. Fix by defining the union in tests.

Fixes: 4f336e88 (selftests/tls: add CHACHA20-POLY1305 to tls selftests)
Reported-by: default avatarRong Chen <rong.a.chen@intel.com>
Signed-off-by: default avatarVadim Fedorenko <vfedorenko@novek.ru>
Link: https://lore.kernel.org/r/1612384634-5377-1-git-send-email-vfedorenko@novek.ruSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2a80c158
...@@ -133,7 +133,10 @@ FIXTURE_VARIANT_ADD(tls, 13_chacha) ...@@ -133,7 +133,10 @@ FIXTURE_VARIANT_ADD(tls, 13_chacha)
FIXTURE_SETUP(tls) FIXTURE_SETUP(tls)
{ {
union tls_crypto_context tls12; union {
struct tls12_crypto_info_aes_gcm_128 aes128;
struct tls12_crypto_info_chacha20_poly1305 chacha20;
} tls12;
struct sockaddr_in addr; struct sockaddr_in addr;
socklen_t len; socklen_t len;
int sfd, ret; int sfd, ret;
...@@ -143,14 +146,16 @@ FIXTURE_SETUP(tls) ...@@ -143,14 +146,16 @@ FIXTURE_SETUP(tls)
len = sizeof(addr); len = sizeof(addr);
memset(&tls12, 0, sizeof(tls12)); memset(&tls12, 0, sizeof(tls12));
tls12.info.version = variant->tls_version;
tls12.info.cipher_type = variant->cipher_type;
switch (variant->cipher_type) { switch (variant->cipher_type) {
case TLS_CIPHER_CHACHA20_POLY1305: case TLS_CIPHER_CHACHA20_POLY1305:
tls12_sz = sizeof(tls12_crypto_info_chacha20_poly1305); tls12_sz = sizeof(struct tls12_crypto_info_chacha20_poly1305);
tls12.chacha20.info.version = variant->tls_version;
tls12.chacha20.info.cipher_type = variant->cipher_type;
break; break;
case TLS_CIPHER_AES_GCM_128: case TLS_CIPHER_AES_GCM_128:
tls12_sz = sizeof(tls12_crypto_info_aes_gcm_128); tls12_sz = sizeof(struct tls12_crypto_info_aes_gcm_128);
tls12.aes128.info.version = variant->tls_version;
tls12.aes128.info.cipher_type = variant->cipher_type;
break; break;
default: default:
tls12_sz = 0; tls12_sz = 0;
......
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