-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[zk-token-sdk] Limit max seed length for key derivations #33700
[zk-token-sdk] Limit max seed length for key derivations #33700
Conversation
Codecov Report
@@ Coverage Diff @@
## master #33700 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 806 806
Lines 218058 218120 +62
=======================================
+ Hits 178415 178473 +58
- Misses 39643 39647 +4 |
joncinque
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R+ with nits addressed
Co-authored-by: Jon Cinque <[email protected]>
joncinque
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just a couple more so that it'll pass CI
| return Err(AuthenticatedEncryptionError::SeedLengthTooShort.into()); | ||
| } | ||
| if seed.len() > MAXIMUM_SEED_LEN { | ||
| return Err(AuthenticatedEncryptionError::SeedLengthTooLarge.into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, you'll also need this!
| return Err(AuthenticatedEncryptionError::SeedLengthTooLarge.into()); | |
| return Err(AuthenticatedEncryptionError::SeedLengthTooLong.into()); |
| return Err(ElGamalError::SeedLengthTooShort); | ||
| } | ||
| if seed.len() > MAXIMUM_SEED_LEN { | ||
| return Err(ElGamalError::SeedLengthTooLarge); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return Err(ElGamalError::SeedLengthTooLarge); | |
| return Err(ElGamalError::SeedLengthTooLong); |
* limit max seed length for elgamal keypairs * limit max seed length for authenticated encryption keys * Apply suggestions from code review Co-authored-by: Jon Cinque <[email protected]> * rename `SeedLengthTooLarge` to `SeedLengthTooLong` --------- Co-authored-by: Jon Cinque <[email protected]> (cherry picked from commit dd2b1bb)
…port of #33700) (#33795) [zk-token-sdk] Limit max seed length for key derivations (#33700) * limit max seed length for elgamal keypairs * limit max seed length for authenticated encryption keys * Apply suggestions from code review Co-authored-by: Jon Cinque <[email protected]> * rename `SeedLengthTooLarge` to `SeedLengthTooLong` --------- Co-authored-by: Jon Cinque <[email protected]> (cherry picked from commit dd2b1bb) Co-authored-by: samkim-crypto <[email protected]>
Problem
#33508
Summary of Changes
Add a maximum length (2^16 bytes, which should be plenty for any practical usecase) check on the maximum seed length for ElGamal and AES keypairs.
Fixes #