mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 08:34:20 +08:00
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: 4f336e88a8
(selftests/tls: add CHACHA20-POLY1305 to tls selftests)
Reported-by: Rong Chen <rong.a.chen@intel.com>
Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
Link: https://lore.kernel.org/r/1612384634-5377-1-git-send-email-vfedorenko@novek.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
2a80c15812
commit
d795cc02a2
@ -133,7 +133,10 @@ FIXTURE_VARIANT_ADD(tls, 13_chacha)
|
||||
|
||||
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;
|
||||
socklen_t len;
|
||||
int sfd, ret;
|
||||
@ -143,14 +146,16 @@ FIXTURE_SETUP(tls)
|
||||
len = sizeof(addr);
|
||||
|
||||
memset(&tls12, 0, sizeof(tls12));
|
||||
tls12.info.version = variant->tls_version;
|
||||
tls12.info.cipher_type = variant->cipher_type;
|
||||
switch (variant->cipher_type) {
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
tls12_sz = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user