-
Notifications
You must be signed in to change notification settings - Fork 981
CI Addition (ECH): Check only the public SNI is visible #10542
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
Open
sebastian-carpenter
wants to merge
1
commit into
wolfSSL:master
Choose a base branch
from
sebastian-carpenter:public-sni-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+90
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15914,6 +15914,94 @@ static int test_wolfSSL_Tls13_ECH_GREASE(void) | |
| return EXPECT_RESULT(); | ||
| } | ||
|
|
||
| /* The public name must be visible and the private name must not be visible */ | ||
| static int test_wolfSSL_Tls13_ECH_wire_sni_ex(int accept) | ||
| { | ||
| EXPECT_DECLS; | ||
| test_ssl_memio_ctx test_ctx; | ||
| WOLFSSL_CTX* tempCtx = NULL; | ||
| byte badConfig[128]; | ||
| word32 badConfigLen = sizeof(badConfig); | ||
|
|
||
| XMEMSET(&test_ctx, 0, sizeof(test_ctx)); | ||
|
|
||
| test_ctx.s_cb.method = wolfTLSv1_3_server_method; | ||
| test_ctx.c_cb.method = wolfTLSv1_3_client_method; | ||
|
|
||
| test_ctx.s_cb.ctx_ready = test_ech_server_ctx_ready; | ||
| test_ctx.s_cb.ssl_ready = test_ech_server_ssl_ready; | ||
| /* Accept path uses the correct configs */ | ||
| if (accept) | ||
| test_ctx.c_cb.ssl_ready = test_ech_client_ssl_ready; | ||
|
|
||
| ExpectIntEQ(test_ssl_memio_setup(&test_ctx), TEST_SUCCESS); | ||
|
|
||
| /* Reject path installs bad configs (with the correct public name) */ | ||
| if (!accept) { | ||
| ExpectNotNull(tempCtx = wolfSSL_CTX_new(wolfTLSv1_3_server_method())); | ||
| ExpectIntEQ(wolfSSL_CTX_GenerateEchConfig(tempCtx, echCbTestPublicName, | ||
| 0, 0, 0), WOLFSSL_SUCCESS); | ||
| ExpectIntEQ(wolfSSL_CTX_GetEchConfigs(tempCtx, badConfig, | ||
| &badConfigLen), WOLFSSL_SUCCESS); | ||
| wolfSSL_CTX_free(tempCtx); | ||
| ExpectIntEQ(wolfSSL_SetEchConfigs(test_ctx.c_ssl, badConfig, | ||
| badConfigLen), WOLFSSL_SUCCESS); | ||
| ExpectIntEQ(wolfSSL_UseSNI(test_ctx.c_ssl, WOLFSSL_SNI_HOST_NAME, | ||
| echCbTestPrivateName, (word16)XSTRLEN(echCbTestPrivateName)), | ||
| WOLFSSL_SUCCESS); | ||
| } | ||
|
|
||
| /* force HelloRetryRequest */ | ||
| ExpectIntEQ(wolfSSL_NoKeyShares(test_ctx.c_ssl), WOLFSSL_SUCCESS); | ||
|
|
||
| /* On reject, client aborts with ech_required and won't send a cert. */ | ||
| if (!accept) { | ||
| wolfSSL_set_verify(test_ctx.s_ssl, WOLFSSL_VERIFY_NONE, NULL); | ||
| wolfSSL_set_verify(test_ctx.c_ssl, WOLFSSL_VERIFY_PEER, NULL); | ||
| } | ||
|
|
||
| /* client writes CH1 into s_buff */ | ||
| ExpectIntEQ(wolfSSL_connect(test_ctx.c_ssl), WOLFSSL_FATAL_ERROR); | ||
| ExpectIntEQ(wolfSSL_get_error(test_ctx.c_ssl, WOLFSSL_FATAL_ERROR), | ||
| WOLFSSL_ERROR_WANT_READ); | ||
|
|
||
| /* CH1 wire bytes */ | ||
| ExpectNotNull(mymemmem(test_ctx.s_buff, test_ctx.s_len, | ||
| echCbTestPublicName, XSTRLEN(echCbTestPublicName))); | ||
| ExpectNull(mymemmem(test_ctx.s_buff, test_ctx.s_len, | ||
| echCbTestPrivateName, XSTRLEN(echCbTestPrivateName))); | ||
|
|
||
| /* server consumes CH1 and writes HRR into c_buff */ | ||
| ExpectIntEQ(wolfSSL_accept(test_ctx.s_ssl), WOLFSSL_FATAL_ERROR); | ||
| ExpectIntEQ(wolfSSL_get_error(test_ctx.s_ssl, WOLFSSL_FATAL_ERROR), | ||
| WOLFSSL_ERROR_WANT_READ); | ||
| ExpectIntEQ(test_ctx.s_ssl->options.serverState, | ||
| SERVER_HELLO_RETRY_REQUEST_COMPLETE); | ||
|
|
||
| /* client reads HRR from c_buff and writes CH2 into s_buff */ | ||
| ExpectIntEQ(wolfSSL_connect(test_ctx.c_ssl), WOLFSSL_FATAL_ERROR); | ||
| ExpectIntEQ(wolfSSL_get_error(test_ctx.c_ssl, WOLFSSL_FATAL_ERROR), | ||
| WOLFSSL_ERROR_WANT_READ); | ||
|
|
||
| /* CH2 wire bytes: same property must hold */ | ||
| ExpectNotNull(mymemmem(test_ctx.s_buff, test_ctx.s_len, | ||
|
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. Can we expect echCbTestPublicName to be at a specific location? |
||
| echCbTestPublicName, XSTRLEN(echCbTestPublicName))); | ||
| ExpectNull(mymemmem(test_ctx.s_buff, test_ctx.s_len, | ||
| echCbTestPrivateName, XSTRLEN(echCbTestPrivateName))); | ||
|
|
||
| test_ssl_memio_cleanup(&test_ctx); | ||
|
|
||
| return EXPECT_RESULT(); | ||
| } | ||
|
|
||
| static int test_wolfSSL_Tls13_ECH_wire_sni(void) | ||
| { | ||
| EXPECT_DECLS; | ||
| ExpectIntEQ(test_wolfSSL_Tls13_ECH_wire_sni_ex(0), TEST_SUCCESS); | ||
| ExpectIntEQ(test_wolfSSL_Tls13_ECH_wire_sni_ex(1), TEST_SUCCESS); | ||
| return EXPECT_RESULT(); | ||
| } | ||
|
|
||
| static int test_wolfSSL_Tls13_ECH_disable_conn_ex(int enableServer, | ||
| int enableClient) | ||
| { | ||
|
|
@@ -40768,6 +40856,7 @@ TEST_CASE testCases[] = { | |
| TEST_DECL(test_wolfSSL_Tls13_ECH_new_config), | ||
| TEST_DECL(test_wolfSSL_Tls13_ECH_trial_decrypt), | ||
| TEST_DECL(test_wolfSSL_Tls13_ECH_GREASE), | ||
| TEST_DECL(test_wolfSSL_Tls13_ECH_wire_sni), | ||
| TEST_DECL(test_wolfSSL_Tls13_ECH_disable_conn), | ||
| TEST_DECL(test_wolfSSL_Tls13_ECH_long_SNI), | ||
| TEST_DECL(test_wolfSSL_Tls13_ECH_HRR_rejection), | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Reduce the scope - put declarations down in block where used.