[ARCH-338] Add a comment about nonce reuse in ECDH-P256#1996
Merged
pavel-raykov merged 1 commit intomainfrom Apr 23, 2026
Merged
[ARCH-338] Add a comment about nonce reuse in ECDH-P256#1996pavel-raykov merged 1 commit intomainfrom
pavel-raykov merged 1 commit intomainfrom
Conversation
📊 API Diff Results
|
f286144 to
2c2f618
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ECDH-P256 anonymous encryption implementation’s inline documentation to add cautionary context around how the AES-GCM nonce is handled.
Changes:
- Adds an expanded comment describing AAD contents (nonce + ephemeral public key) and referencing RFC 5116 guidance.
- Adds commentary about nonce “reuse” between HKDF salt and AES-GCM nonce.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+309
to
+315
| // Including nonce in AAD is in line with https://www.ietf.org/rfc/rfc5116: | ||
| // <<<The nonce is authenticated internally to the algorithm, and it is not | ||
| // necessary to include it in the AD input. The nonce MAY be included | ||
| // in P or A if it is convenient to the application.>>> | ||
| // However, the second nonce reuse in gcm.Seal(nil, nonce...) is not conventional - this means that we reuse the | ||
| // same nonce both for the symmetric key and the block cipher counter. | ||
| // It is not clear why we don't use new nonce here (by just extending nonceSizeECDHP256 size). |
jmank88
approved these changes
Apr 22, 2026
harry-anderson
approved these changes
Apr 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.