You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose AesGcm bits necessary to build a constant time decrypt - #188
As discussed in #184, aes-gcm decrypt is not constant time. @tarcieri suggested that for our use case, it would be better to build a custom crate rather than put a constant time decrypt in the base repo, since overwriting the buffer if the mac check fails is necessary to avoid leaking information.
We attempted to build a constant time decrypt module without duplicating the entire aes-gcm crate; unfortunately, the AesGcm struct does not allow access to the critical data and functions. So I'm offering this PR, which simply makes one struct field and two functions pub.
I'd be okay with moving Ctr32 somewhere it can be pub, possibly the ctr crate (it could be unified with the Ctr32 used by AES-GCM-SIV, which is effectively the same thing, but little endian).
I'm somewhat reluctant to expose methods like init_ctr and compute_tag though, as these are effectively internals of the implementation.
If you had that, would you be okay with duplicating the rest of the crate? Especially if you went back to a slightly earlier version of aes-gcm before support for variable-sized nonces was added, the bulk of the remaining implementation is ~80 LOC, much of which I imagine you'd want to customize to get the behavior you desire:
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
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.
As discussed in #184, aes-gcm decrypt is not constant time. @tarcieri suggested that for our use case, it would be better to build a custom crate rather than put a constant time decrypt in the base repo, since overwriting the buffer if the mac check fails is necessary to avoid leaking information.
We attempted to build a constant time decrypt module without duplicating the entire aes-gcm crate; unfortunately, the AesGcm struct does not allow access to the critical data and functions. So I'm offering this PR, which simply makes one struct field and two functions pub.