All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] unit: Add runtime check for TLS suite cipher support
@ 2019-02-15 22:01 Mat Martineau
  2019-02-18  2:43 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Mat Martineau @ 2019-02-15 22:01 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

Skip TLS suite tests where the currently running kernel does not have
support for the necessary cipher. Checksums types already have runtime
validation.
---
 unit/test-tls.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/unit/test-tls.c b/unit/test-tls.c
index 01496d2..03c5370 100644
--- a/unit/test-tls.c
+++ b/unit/test-tls.c
@@ -709,9 +709,24 @@ int main(int argc, char *argv[])
 	l_test_add("TLS connection version mismatch",
 			test_tls_version_mismatch_test, NULL);
 
-	for (i = 0; tls_cipher_suite_pref[i]; i++)
-		l_test_add(tls_cipher_suite_pref[i]->name, test_tls_suite_test,
-				tls_cipher_suite_pref[i]->name);
+	for (i = 0; tls_cipher_suite_pref[i]; i++) {
+		struct tls_cipher_suite *suite = tls_cipher_suite_pref[i];
+		struct tls_bulk_encryption_algorithm *alg = suite->encryption;
+		bool supported;
+
+		if (alg->cipher_type == TLS_CIPHER_AEAD)
+			supported = l_aead_cipher_is_supported(alg->l_aead_id);
+		else
+			supported = l_cipher_is_supported(alg->l_id);
+
+		if (supported) {
+			l_test_add(suite->name, test_tls_suite_test,
+					suite->name);
+		} else {
+			printf("Skipping %s due to missing cipher support\n",
+				suite->name);
+		}
+	}
 
 done:
 	return l_test_run();
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-18  2:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 22:01 [PATCH] unit: Add runtime check for TLS suite cipher support Mat Martineau
2019-02-18  2:43 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.