unit/test-cipher: always report local ciphers as supported
PATCH 1/2 unit/test-cipher: always report local ciphers as supported
Fixes test failure on system with CONFIG_CRYPTO_USER_API=n kernel:
FAIL: unit/test-cipher
======================
test-cipher: unit/test-cipher.c:124:
test_arc4: Assertion `l_cipher_is_supported(L_CIPHER_ARC4)' failed.
FAIL unit/test-cipher (exit status: 134)
Lack of AF_ALG family is the result of CONFIG_CRYPTO_USER_API=n.
The change moved supported ciphed detection before AF_ALG socket creation attempt.
--- ell/cipher.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
ell/cipher.c +4 -4
@@ -677,6 +677,10 @@ static void init_supported() initialized = true; +for (c =0 ; c <L_ARRAY_SIZE (local_impl_ciphers); c++) +if (HAVE_LOCAL_IMPLEMENTATION (c)) + supported_ciphers |=1 << c; + sk =socket (PF_ALG ,SOCK_SEQPACKET |SOCK_CLOEXEC ,0 );if (sk <0 )return ;
@@ -698,10 +702,6 @@ static void init_supported() supported_ciphers |=1 << c; } -for (c =0 ; c <L_ARRAY_SIZE (local_impl_ciphers); c++) -if (HAVE_LOCAL_IMPLEMENTATION (c)) - supported_ciphers |=1 << c; -strcpy ((char *) salg.salg_type,"aead" );for (a =L_AEAD_CIPHER_AES_CCM ; a <=L_AEAD_CIPHER_AES_GCM ; a++) {
Signature · 1 line
2.33.0
PATCH 2/2 unit/test-uuid: skip tests on system without AF_ALG support
Fixes test failure on system with CONFIG_CRYPTO_USER_API=n kernel:
FAIL: unit/test-uuid
====================
test-uuid: unit/test-uuid.c:58: test_v3: Assertion `r' failed. FAIL unit/test-uuid (exit status: 134)
Lack of AF_ALG family is the result of CONFIG_CRYPTO_USER_API=n.
The change moved supported ciphed detection under respective cipher detection presence: MD5 for v3 UUID, SHA1 for v5 UUID.
--- unit/test-uuid.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
unit/test-uuid.c +6 -3
@@ -227,13 +227,16 @@ int main(int argc, char *argv[]) {l_test_init (&argc, &argv); -l_test_add ("/uuid/v3" , test_v3,NULL ); +if (l_checksum_is_supported (L_CHECKSUM_MD5 , false)) +l_test_add ("/uuid/v3" , test_v3,NULL );if (l_getrandom_is_supported ())l_test_add ("/uuid/v4" , test_v4,NULL ); -l_test_add ("/uuid/v5" , test_v5,NULL ); -l_test_add ("/uuid/to string" , test_to_string,NULL ); +if (l_checksum_is_supported (L_CHECKSUM_SHA1 , false)) { +l_test_add ("/uuid/v5" , test_v5,NULL ); +l_test_add ("/uuid/to string" , test_to_string,NULL ); + }l_test_add ("/uuid/from string" , test_from_string,NULL );l_test_add ("/uuid/from string/too short" , test_from_string_too_short,NULL );l_test_add ("/uuid/from string/too long" , test_from_string_too_long,NULL );
Signature · 1 line
2.33.0
Quoted 11 lines · Sergei Trofimovich
Fixes test failure on system with
CONFIG_CRYPTO_USER_API=nkernel:FAIL: unit/test-cipher
======================test-cipher:
unit/test-cipher.c:124:
test_arc4: Assertion `l_cipher_is_supported(L_CIPHER_ARC4)' failed.
FAIL unit/test-cipher (exit status: 134)Lack of
AF_ALGfamily is the result ofCONFIG_CRYPTO_USER_API=n.
Quoted 8 lines
The change moved supported ciphed detection before
AF_ALGsocket creation attempt.Signed-off-by Sergei Trofimovich <[email protected]>--- ell/cipher.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Both applied, thanks. I did add an extra line in patch 2 for coding style purposes and reworded the commit headers slightly. Also removed Signed-off-by lines since we do not use them in ell.
Regards,
-Denis