selftests/tls: fix compile errors after adding CHACHA20-POLY1305
Subsystems (4)
PATCH 1/1 selftests/tls: fix compile errors after adding CHACHA20-POLY1305
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t known
union tls_crypto_context tls12;
^~~~~
tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function)
tls12_sz = sizeof(tls12_crypto_info_chacha20_poly1305);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function)
tls12_sz = sizeof(tls12_crypto_info_aes_gcm_128);
--- include/net/tls.h | 9 --------- include/uapi/linux/tls.h | 9 +++++++++ tools/testing/selftests/net/tls.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)
include/net/tls.h +0 -9
@@ -212,15 +212,6 @@ struct cipher_context {char *rec_seq; }; -union tls_crypto_context { -struct tls_crypto_info info; -union { -struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; -struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; -struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; - }; -}; -struct tls_prot_info {u16 version;u16 cipher_type;
include/uapi/linux/tls.h +9 -0
@@ -124,6 +124,15 @@ struct tls12_crypto_info_chacha20_poly1305 {unsigned char rec_seq[TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE ]; }; +union tls_crypto_context { +struct tls_crypto_info info; +union { +struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; +struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; +struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; + }; +}; +enum {TLS_INFO_UNSPEC ,TLS_INFO_VERSION ,
tools/testing/selftests/net/tls.c +2 -2
@@ -147,10 +147,10 @@ FIXTURE_SETUP(tls) 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 );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 );break ;default : tls12_sz =0 ;
Signature · 1 line
2.20.1
Quoted 71 lines · Rong Chen
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t knownunion tls_crypto_context tls12; ^~~~~ tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_chacha20_poly1305); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_aes_gcm_128);Fixes 4f336e88a870 ("selftests/tls: add CHACHA20-POLY1305 to tls selftests")Reported-by kernel test robot <[email protected]>Signed-off-by Rong Chen <[email protected]>--- include/net/tls.h | 9 --------- include/uapi/linux/tls.h | 9 +++++++++ tools/testing/selftests/net/tls.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)include/net/tls.h +0
-9@@ -212,15 +212,6 @@ struct cipher_context {char *rec_seq; }; -union tls_crypto_context { -struct tls_crypto_info info; -union { -struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; -struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; -struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; - }; -}; -struct tls_prot_info {u16 version;u16 cipher_type;include/uapi/linux/tls.h +9
-0@@ -124,6 +124,15 @@ struct tls12_crypto_info_chacha20_poly1305 {unsigned char rec_seq[TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE ]; }; +union tls_crypto_context { +struct tls_crypto_info info; +union { +struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; +struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; +struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; + }; +}; +enum {TLS_INFO_UNSPEC ,TLS_INFO_VERSION ,tools/testing/selftests/net/tls.c +0
-0@@ -147,10 +147,10 @@ FIXTURE_SETUP(tls) tls12.info.cipher_type = variant->cipher_type;switch (variant->cipher_type) {
tools/testing/selftests/net/tls.c FIXTURE_SETUP(tls) · line 156
Quoted 10 lines
tools/testing/selftests/net/tls.c +2
-2case TLS_CIPHER_CHACHA20_POLY1305 : - tls12_sz =sizeof (tls12_crypto_info_chacha20_poly1305); + tls12_sz =sizeof (struct tls12_crypto_info_chacha20_poly1305 );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 );break ;default : tls12_sz =0 ;
I'm not sure that it's a good idea to move tls_crypto_context to uapi as it's an internal union. Previous patches assumes that user-space uses different structures for different cipher configurations.
Quoted 76 lines · Vadim Fedorenko
Quoted 75 lines · Rong Chen
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t known
uniontls_crypto_contexttls12;
^~~~~
tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function)tls12_sz=sizeof(tls12_crypto_info_chacha20_poly1305); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function)tls12_sz=sizeof(tls12_crypto_info_aes_gcm_128);Fixes 4f336e88a870 ("selftests/tls: add CHACHA20-POLY1305 to tls selftests")Reported-by kernel test robot <[email protected]>Signed-off-by Rong Chen <[email protected]>---
include/net/tls.h | 9 ---------
include/uapi/linux/tls.h | 9 +++++++++
tools/testing/selftests/net/tls.c| 4 ++--3 files changed, 11 insertions(+), 11 deletions(-)include/net/tls.h +0
-8@@ -212,15 +212,6 @@ struct cipher_context { char *rec_seq; }; -union tls_crypto_context { - struct tls_crypto_info info; - union { - struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; - struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; - struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; - }; -}; - struct tls_prot_info { u16 version; u16 cipher_type;include/uapi/linux/tls.h +8
-0@@ -124,6 +124,15 @@ struct tls12_crypto_info_chacha20_poly1305 { unsigned char rec_seq[TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE]; }; +union tls_crypto_context { + struct tls_crypto_info info; + union { + struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; + struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; + struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; + }; +}; + enum { TLS_INFO_UNSPEC, TLS_INFO_VERSION,tools/testing/selftests/net/tls.c +0
-0@@ -147,10 +147,10 @@ FIXTURE_SETUP(tls) 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); break;
caseTLS_CIPHER_AES_GCM_128:
-tls12_sz=sizeof(tls12_crypto_info_aes_gcm_128);
+tls12_sz=sizeof(struct tls12_crypto_info_aes_gcm_128);
Quoted 8 lines
Quoted 4 lines
break;
default:
tls12_sz= 0;I'm not sure that it's a good idea to move
tls_crypto_contextto uapi as it's an internal union. Previous patches assumes that user-space uses different structures for different cipher configurations.
Hi Vadim,
Sorry i don't have the background, could you help to fix these build errors?
Best Regards,
Rong Chen
Quoted 88 lines · Rong Chen
Quoted 76 lines · Vadim Fedorenko
Quoted 75 lines · Rong Chen
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t known
uniontls_crypto_contexttls12;
^~~~~
tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function)tls12_sz=sizeof(tls12_crypto_info_chacha20_poly1305); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function)tls12_sz=sizeof(tls12_crypto_info_aes_gcm_128);Fixes 4f336e88a870 ("selftests/tls: add CHACHA20-POLY1305 to tls selftests")Reported-by kernel test robot <[email protected]>Signed-off-by Rong Chen <[email protected]>---
include/net/tls.h | 9 ---------
include/uapi/linux/tls.h | 9 +++++++++
tools/testing/selftests/net/tls.c| 4 ++--3 files changed, 11 insertions(+), 11 deletions(-)include/net/tls.h +0
-8@@ -212,15 +212,6 @@ struct cipher_context { char *rec_seq; }; -union tls_crypto_context { - struct tls_crypto_info info; - union { - struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; - struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; - struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; - }; -}; - struct tls_prot_info { u16 version; u16 cipher_type;include/uapi/linux/tls.h +8
-0@@ -124,6 +124,15 @@ struct tls12_crypto_info_chacha20_poly1305 { unsigned char rec_seq[TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE]; }; +union tls_crypto_context { + struct tls_crypto_info info; + union { + struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; + struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; + struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; + }; +}; + enum { TLS_INFO_UNSPEC, TLS_INFO_VERSION,tools/testing/selftests/net/tls.c +0
-0@@ -147,10 +147,10 @@ FIXTURE_SETUP(tls) 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); break;
caseTLS_CIPHER_AES_GCM_128:
-tls12_sz=sizeof(tls12_crypto_info_aes_gcm_128);
+tls12_sz=sizeof(struct tls12_crypto_info_aes_gcm_128);Quoted 8 lines
Quoted 4 lines
break;
default:
tls12_sz= 0;I'm not sure that it's a good idea to move
tls_crypto_contextto uapi as it's an internal union. Previous patches assumes that user-space uses different structures for different cipher configurations.
Quoted 7 lines
Hi Vadim,
Sorry i don't have the background, could you help to fix these build errors?
Best Regards,
Rong Chen
Yes, sure, no problem. I will prepare new patch tomorrow.
Jakub Kicinski
maintainerQuoted 9 lines · On Tue, 2 Feb 2021 17:45:00 +0800 Rong Chen wrote:
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t knownunion tls_crypto_context tls12; ^~~~~ tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_chacha20_poly1305); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function)
tls12_sz=sizeof(tls12_crypto_info_aes_gcm_128);Fixes 4f336e88a870 ("selftests/tls: add CHACHA20-POLY1305 to tls selftests")Reported-by kernel test robot <[email protected]>Signed-off-by Rong Chen <[email protected]>
Are you sure you have latest headers installed on your system?
Try make headers_install or some such, I forgot what the way to appease selftest was exactly but selftests often don't build on a fresh kernel clone if system headers are not very recent :S
Quoted 18 lines · Jakub Kicinski
Quoted 13 lines · On Tue, 2 Feb 2021 17:45:00 +0800 Rong Chen wrote:
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t knownunion tls_crypto_context tls12; ^~~~~ tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_chacha20_poly1305); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_aes_gcm_128);Quoted 4 lines
Fixes 4f336e88a870 ("selftests/tls: add CHACHA20-POLY1305 to tls selftests")Reported-by kernel test robot <[email protected]>Signed-off-by Rong Chen <[email protected]>
Quoted 5 lines
Are you sure you have latest headers installed on your system?
Try make
headers_installor some such, I forgot what the way to appease selftest was exactly but selftests often don't build on a fresh kernel clone if system headers are not very recent :S
Hi Jakub,
These errors still exist when testing the latest linux-next/master branch on our test system, and kernelci noticed the errors too:
Best Regards,
Rong Chen
Quoted 19 lines · Jakub Kicinski
Quoted 13 lines · On Tue, 2 Feb 2021 17:45:00 +0800 Rong Chen wrote:
The kernel test robot reported the following errors:
tls.c: In function ‘tls_setup’:
tls.c:136:27: error: storage size of ‘tls12’ isn’t knownunion tls_crypto_context tls12; ^~~~~ tls.c:150:21: error: ‘tls12_crypto_info_chacha20_poly1305’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_chacha20_poly1305); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tls.c:150:21: note: each undeclared identifier is reported only once for each function it appears in tls.c:153:21: error: ‘tls12_crypto_info_aes_gcm_128’ undeclared (first use in this function) tls12_sz = sizeof(tls12_crypto_info_aes_gcm_128);Quoted 4 lines
Fixes 4f336e88a870 ("selftests/tls: add CHACHA20-POLY1305 to tls selftests")Reported-by kernel test robot <[email protected]>Signed-off-by Rong Chen <[email protected]>
Quoted 5 lines
Are you sure you have latest headers installed on your system?
Try make
headers_installor some such, I forgot what the way to appease selftest was exactly but selftests often don't build on a fresh kernel clone if system headers are not very recent :S
There is definitely error in test - I could reproduce it in a clean environment. I will take care of it.