-
Notifications
You must be signed in to change notification settings - Fork 1k
Add WOLFSSL_STRICT_CIPHER_LIST for TLS 1.3-only cipher lists on a non-TLS1.3 ctx/ssl #10963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2463,6 +2463,31 @@ int test_tls13_cipher_suites(void) | |
| return EXPECT_RESULT(); | ||
| } | ||
|
|
||
| int test_tls13_cipher_list_no_tls13_ctx(void) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 [Medium] Test only exercises the CTX path, not the SSL path The new macro gates the return value inside Suggestion: Add a parallel case that creates a WOLFSSL* from a TLS 1.2 ctx and calls wolfSSL_set_cipher_list(ssl, "TLS13-AES128-GCM-SHA256"), asserting WOLFSSL_FAILURE (strict) / WOLFSSL_SUCCESS (default), to cover the ssl->version branch. |
||
| { | ||
| EXPECT_DECLS; | ||
| #if defined(WOLFSSL_TLS13) && defined(OPENSSL_EXTRA) && \ | ||
| !defined(NO_WOLFSSL_CLIENT) && !defined(WOLFSSL_NO_TLS12) && \ | ||
| defined(BUILD_TLS_AES_128_GCM_SHA256) | ||
| WOLFSSL_CTX* ctx = NULL; | ||
|
|
||
| /* ctx->method caps the connection at TLS 1.2, so a cipher list that | ||
| * names only TLS 1.3 suites can never take effect on it. */ | ||
| ExpectNotNull(ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())); | ||
| #ifdef WOLFSSL_STRICT_CIPHER_LIST | ||
| ExpectIntEQ(wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES128-GCM-SHA256"), | ||
| WOLFSSL_FAILURE); | ||
| #else | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 [Low] Test asserts return value but not that suites are actually left untouched The default-path comment claims the call succeeds "but leave ctx->suites untouched," yet the test only checks the WOLFSSL_SUCCESS return code. The distinguishing behavior (that the prior <=TLS1.2 suites remain and the TLS1.3-only list did NOT overwrite them) is not asserted. This is the exact silent-no-op behavior the PR is calling out as a footgun, so it would be valuable to pin it down. Suggestion: Capture ctx->suites->suiteSz (or the suite bytes) before the call and assert they are unchanged after, confirming the TLS1.3-only list was actually ignored rather than merely returning success. |
||
| /* Default OpenSSL-compat behavior: succeed but leave ctx->suites | ||
| * untouched since the TLS 1.3-only list is unusable on this ctx. */ | ||
| ExpectIntEQ(wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES128-GCM-SHA256"), | ||
| WOLFSSL_SUCCESS); | ||
| #endif | ||
| wolfSSL_CTX_free(ctx); | ||
|
miyazakh marked this conversation as resolved.
|
||
| #endif | ||
| return EXPECT_RESULT(); | ||
| } | ||
|
|
||
|
|
||
| #if defined(WOLFSSL_TLS13) && defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES)\ | ||
| && !defined(NO_PSK) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 [Low] WOLFSSL_STRICT_CIPHER_LIST can now fail ctx creation under WOLFSSL_SYS_CRYPTO_POLICY
💡 SUGGEST
questionBeyond the two public setters named in the PR,
wolfSSL_parse_cipher_list()is also called during ctx construction whenWOLFSSL_SYS_CRYPTO_POLICYis enabled. WithWOLFSSL_STRICT_CIPHER_LISTdefined, a system crypto policy that lists only TLS 1.3 suites applied to a <=TLS1.2 method would now makewolfSSL_parse_cipher_list()return WOLFSSL_FAILURE, causingwolfSSL_CTX_new_exto free the ctx and return NULL where it previously succeeded. This is a plausibly-intended consequence of opting into strict behavior (fail loudly), but it is a broader blast radius than the two setters described in the PR body and is not covered by tests. Worth confirming this interaction is intended and documenting it.Recommendation: Confirm the WOLFSSL_SYS_CRYPTO_POLICY + WOLFSSL_STRICT_CIPHER_LIST interaction (ctx creation can now fail) is intended, and note it in the macro documentation.