chore: backport #20926 (remove epk sign from message payload) to v4#20960
Closed
chore: backport #20926 (remove epk sign from message payload) to v4#20960
Conversation
This frees up one byte of capacity, but more importantly it reduces the leakage in the logs as they'll no longer contain a byte that is either 0 or 1.
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.
Backport of #20926 to v4.
This removes the ephemeral public key sign byte from the encrypted message payload. Instead, the sender now generates ephemeral key pairs with guaranteed positive y-coordinates, so the sign byte is no longer needed. This frees up one byte of capacity and reduces information leakage in the logs.
The automatic cherry-pick failed due to conflicts in
encoding.nrandaes128.nr, caused by differences betweennextandv4(differentMESSAGE_CIPHERTEXT_LENvalues and the absence ofAES128_PKCS7_EXPANSION_IN_BYTESon v4). Conflicts were resolved by adapting the changes to v4's constants while preserving the intent of the original PR.Changes:
generate_positive_ephemeral_key_pair()toephemeral.nrEPH_PK_SIGN_BYTE_SIZE_IN_BYTESconstant and its usage fromencoding.nraes128.nrto use positive ephemeral keys and remove sign byte from wire format+ 1for the sign byteClaudeBox log