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

ktls: improve messaging around freed handshakes #4346

Merged
merged 3 commits into from
Jan 9, 2024

Conversation

lrstewart
Copy link
Contributor

@lrstewart lrstewart commented Jan 8, 2024

Description of changes:

A customer integrating with ktls ran into a "NULL pointer encountered" error because they tried to enable ktls after freeing the handshake, which is required to calculate the TLS1.2 keys. I've updated the documentation and added a specific check for "prf_space" so that the caller gets the slightly more helpful "Invalid state, this is the result of invalid use of an API. Check the API documentation for the function that raised this error for more info" error.

Call-outs:

We could theoretically re-allocate and then re-free the memory needed to calculate the TLS1.2 keys, but I don't think that's the right behavior. We should just provide the information the application needs to call the API in a way that doesn't waste memory.

Testing:

I manually verified that prf_space is the only field from the handshake that ktls needs for either TLS1.2 or TLS1.3 by adding the call to s2n_connection_free_handshake, but without s2n_prf_free.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Jan 8, 2024
@lrstewart lrstewart marked this pull request as ready for review January 8, 2024 22:10
@lrstewart lrstewart requested a review from goatgoose January 9, 2024 17:02
@lrstewart lrstewart enabled auto-merge (squash) January 9, 2024 17:31
@lrstewart lrstewart merged commit e5e7b01 into aws:main Jan 9, 2024
29 checks passed
@lrstewart lrstewart deleted the ktls_fix branch January 9, 2024 18:50
dougch pushed a commit to dougch/s2n-tls that referenced this pull request Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants