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

feat: Configurable blinding #4562

Merged
merged 18 commits into from
Jun 3, 2024
Merged

feat: Configurable blinding #4562

merged 18 commits into from
Jun 3, 2024

Conversation

maddeleine
Copy link
Contributor

@maddeleine maddeleine commented May 16, 2024

Resolved issues:

Resolves #4508

Description of changes:

Adds an option to set a configurable blinding timeout instead of going with the default of 10-30 seconds. This is to encourage applications that turn off blinding completely to instead opt-in to an amount of blinding that they can handle.

Call-outs:

Note that I offer an in-depth comment for developers rather than one for users. I don't think most users need to know about our blinding rational. They just need to know that the best blinding is the default, and anything less will lower the security bar. However, if we want my more in-depth discussion about how blinding mitigates Lucky 13, I could add that discussion to the user guide. It just seemed too detailed for normal users.

Testing:

Includes tests to make sure that blinding range is calculated as expected.
Is this a refactor change? If so, how have you proved that the intended behavior hasn't changed?
Should be no behavior change.

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 May 16, 2024
@maddeleine maddeleine requested a review from lrstewart May 17, 2024 16:57
api/s2n.h Outdated Show resolved Hide resolved
bindings/rust/s2n-tls/src/connection.rs Outdated Show resolved Hide resolved
tls/s2n_connection.h Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tests/unit/s2n_blinding_test.c Outdated Show resolved Hide resolved
api/s2n.h Outdated Show resolved Hide resolved
api/s2n.h Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
@maddeleine maddeleine requested a review from lrstewart May 28, 2024 17:37
api/s2n.h Outdated Show resolved Hide resolved
tls/s2n_connection.h Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
tests/unit/s2n_connection_blinding_test.c Outdated Show resolved Hide resolved
tls/s2n_connection.c Outdated Show resolved Hide resolved
@maddeleine maddeleine requested a review from lrstewart May 29, 2024 18:31
@maddeleine maddeleine requested a review from goatgoose May 29, 2024 21:17
@maddeleine maddeleine requested a review from lrstewart May 29, 2024 21:49
Comment on lines 1213 to 1214
* hypothetical timing difference of 1us, the number of attempts necessary to recover a byte is
* (((30 - 10) * 10 ^6)^2)/12 ~= 3.3 trillion (note that we first have to convert from seconds to
Copy link
Contributor

Choose a reason for hiding this comment

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

What does recovering a byte mean here? I would have assumed the calculation would be in terms of number of samples required to observe a timing difference. Or is this description specifically related to lucky 13?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the number of samples required to distinguish the timing distributions from a correctly guessed byte versus incorrectly guessed bytes. In lucky13 in particular, if you've correctly guessed the last byte of padding, the timing distribution that is created from sampling that byte would be slightly different than the timing distributions of an incorrect byte.
😮‍💨 So hard to describe this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think I could add something to make this paragraph more clear?

Copy link
Contributor

Choose a reason for hiding this comment

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

No I think it makes sense. I guess I just wasn't sure if this same description could be applied to all sidechannels or just lucky 13. Like, could there be a timing difference that could be exploited without the goal of differentiating a correct byte from an incorrect byte? If so, then it might help to clarify that this example of recovering bytes is specific to lucky 13.

Comment on lines +52 to +53
#define S2N_DEFAULT_BLINDING_MAX 30
#define S2N_DEFAULT_BLINDING_MIN 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be simpler to only keep track of the max and just always / 3 for the min? Or is it better to state the default values explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like having them called out explicitly for this particular feature. The min and max are really important for understanding the fixed versus variable part of blinding.

bindings/rust/s2n-tls/src/config.rs Outdated Show resolved Hide resolved
api/s2n.h Outdated Show resolved Hide resolved
@maddeleine maddeleine requested a review from goatgoose May 31, 2024 17:21
Comment on lines 1213 to 1214
* hypothetical timing difference of 1us, the number of attempts necessary to recover a byte is
* (((30 - 10) * 10 ^6)^2)/12 ~= 3.3 trillion (note that we first have to convert from seconds to
Copy link
Contributor

Choose a reason for hiding this comment

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

No I think it makes sense. I guess I just wasn't sure if this same description could be applied to all sidechannels or just lucky 13. Like, could there be a timing difference that could be exploited without the goal of differentiating a correct byte from an incorrect byte? If so, then it might help to clarify that this example of recovering bytes is specific to lucky 13.

@maddeleine maddeleine merged commit 14c0ad5 into main Jun 3, 2024
36 checks passed
@maddeleine maddeleine deleted the blinding branch June 3, 2024 20:28
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.

Support configurable s2n blinding delay
3 participants