-
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: upcasting of signed integer when block decomposing
Some parts of the code did not use the correct way to decompose a clear integer into blocks which could be encrypted or used in scalar ops. The sign extension was not always properly done, leading for example in the encryption of a negative integer stored on a i8 to a SignedRadixCiphertext with a num_blocks greater than i8 to be incorrect: ``` let ct = cks.encrypt_signed(-1i8, 16) // 2_2 parameters let d: i32 = cks.decrypt_signed(&ct); assert_eq!(d, i32::from(-1i8)); // Fails ``` To fix, a BlockDecomposer::with_block_count function is added and used This function will properly do the sign extension when needed
- Loading branch information
Showing
7 changed files
with
161 additions
and
72 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
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
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