-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(zk): store inside the pke params the supported zk scheme
- Loading branch information
1 parent
f1eb675
commit 6a3308a
Showing
11 changed files
with
130 additions
and
123 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
39 changes: 36 additions & 3 deletions
39
tfhe/src/shortint/backward_compatibility/parameters/compact_public_key_only.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,47 @@ | ||
use tfhe_versionable::VersionsDispatch; | ||
use std::convert::Infallible; | ||
|
||
use tfhe_versionable::{Upgrade, Version, VersionsDispatch}; | ||
|
||
use super::parameters::compact_public_key_only::CompactPublicKeyEncryptionParameters; | ||
use super::parameters::CompactCiphertextListExpansionKind; | ||
use super::parameters::{ | ||
CompactCiphertextListExpansionKind, DynamicDistribution, SupportedCompactPkeZkScheme, | ||
}; | ||
use super::prelude::*; | ||
|
||
#[derive(VersionsDispatch)] | ||
pub enum CompactCiphertextListExpansionKindVersions { | ||
V0(CompactCiphertextListExpansionKind), | ||
} | ||
|
||
#[derive(Version)] | ||
pub struct CompactPublicKeyEncryptionParametersV0 { | ||
pub encryption_lwe_dimension: LweDimension, | ||
pub encryption_noise_distribution: DynamicDistribution<u64>, | ||
pub message_modulus: MessageModulus, | ||
pub carry_modulus: CarryModulus, | ||
pub ciphertext_modulus: CiphertextModulus, | ||
pub expansion_kind: CompactCiphertextListExpansionKind, | ||
} | ||
|
||
impl Upgrade<CompactPublicKeyEncryptionParameters> for CompactPublicKeyEncryptionParametersV0 { | ||
type Error = Infallible; | ||
|
||
fn upgrade(self) -> Result<CompactPublicKeyEncryptionParameters, Self::Error> { | ||
Ok(CompactPublicKeyEncryptionParameters { | ||
encryption_lwe_dimension: self.encryption_lwe_dimension, | ||
encryption_noise_distribution: self.encryption_noise_distribution, | ||
message_modulus: self.message_modulus, | ||
carry_modulus: self.carry_modulus, | ||
ciphertext_modulus: self.ciphertext_modulus, | ||
expansion_kind: self.expansion_kind, | ||
// TFHE-rs v0.10 and before used only the v1 zk scheme | ||
zk_scheme: SupportedCompactPkeZkScheme::V1, | ||
}) | ||
} | ||
} | ||
|
||
#[derive(VersionsDispatch)] | ||
pub enum CompactPublicKeyEncryptionParametersVersions { | ||
V0(CompactPublicKeyEncryptionParameters), | ||
V0(CompactPublicKeyEncryptionParametersV0), | ||
V1(CompactPublicKeyEncryptionParameters), | ||
} |
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
Oops, something went wrong.