-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(integer): fix cast in scalar_shift/rotate
In scalar_shift/rotate, we get the number of bits to shift/rotate as a generic type, the can be casted to u64. We compute the total number of bits the ciphertext has, cast that number to the same type as the scalar, and do "shift % num_bits". However, if the number of bits computed exceeds the max value the scalar type can hold, we could end up doing a remainder with 0. e.g 256bits ciphertext and scalar type u8 => 256u64 casted to u8 results in 0. Fix that by casting the scalar value to u64.
- Loading branch information
Showing
3 changed files
with
33 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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