Skip to content
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

Avoid calling onServerNameIndication twice with HRR #402

Merged
merged 2 commits into from
Nov 5, 2019
Merged

Avoid calling onServerNameIndication twice with HRR #402

merged 2 commits into from
Nov 5, 2019

Conversation

ocheron
Copy link
Contributor

@ocheron ocheron commented Nov 3, 2019

When TLS13 is negotiated, the callback onServerNameIndication in called too early in the server code flow. In case of HelloRetryRequest there is an unnecessary call for the first Client Hello. It is needed only for the second Client Hello.

To avoid this, the PR moves the call to splitted implementations TLS12/TLS13:

  • Knowning what credentials are available is required for cipher selection < TLS13
  • With TLS13, onServerNameIndication can be called after HRR handling

Test case "SNI" is also extended to verify that onServerNameIndication is called once, and that getClientSNI returns a correct result on client side.

@kazu-yamamoto kazu-yamamoto self-requested a review November 5, 2019 02:14
Copy link
Collaborator

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks excellent to me!

kazu-yamamoto added a commit to kazu-yamamoto/hs-tls that referenced this pull request Nov 5, 2019
@kazu-yamamoto kazu-yamamoto merged commit 4680397 into haskell-tls:master Nov 5, 2019
@kazu-yamamoto
Copy link
Collaborator

Merged.

@ocheron
Copy link
Contributor Author

ocheron commented Nov 9, 2019

Yes I saw that when trying Encrypted SNI.
We could even go one step further and remove the call completely for a PSK handshake.
But some people might use the callback for other goal than providing credentials.

@ocheron ocheron deleted the hrr-sni branch November 9, 2019 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants