Skip to content

Commit

Permalink
chore: add parameters getters for CompactPublicKey types
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Nov 14, 2024
1 parent cf56e58 commit f9e8df4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tfhe/src/high_level_api/keys/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ impl IntegerCompactPublicKey {
pub fn from_raw_parts(key: CompactPublicKey) -> Self {
Self { key }
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

#[derive(Clone, Debug, Serialize, Deserialize, Versionize)]
Expand Down Expand Up @@ -455,6 +459,10 @@ impl IntegerCompressedCompactPublicKey {
key: CompressedCompactPublicKey::decompress(&self.key),
}
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

#[allow(clippy::struct_field_names)]
Expand Down
8 changes: 8 additions & 0 deletions tfhe/src/high_level_api/keys/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ impl CompactPublicKey {
tag,
}
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

impl Tagged for CompactPublicKey {
Expand Down Expand Up @@ -227,6 +231,10 @@ impl CompressedCompactPublicKey {
tag: self.tag.clone(),
}
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

impl Tagged for CompressedCompactPublicKey {
Expand Down
12 changes: 12 additions & 0 deletions tfhe/src/integer/public_key/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl<C: Container<Element = u64>> CompactPrivateKey<C> {
pub fn key(&self) -> &ShortintCompactPrivateKey<C> {
&self.key
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

impl CompactPrivateKey<Vec<u64>> {
Expand Down Expand Up @@ -158,6 +162,10 @@ impl CompactPublicKey {
pub fn size_bytes(&self) -> usize {
self.key.size_bytes()
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Versionize)]
Expand Down Expand Up @@ -203,6 +211,10 @@ impl CompressedCompactPublicKey {
key: self.key.decompress(),
}
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.key.parameters()
}
}

impl ParameterSetConformant for CompactPublicKey {
Expand Down
8 changes: 8 additions & 0 deletions tfhe/src/shortint/public_key/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ impl CompactPublicKey {
pub fn size_bytes(&self) -> usize {
self.key.size_bytes()
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.parameters
}
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Versionize)]
Expand Down Expand Up @@ -552,6 +556,10 @@ impl CompressedCompactPublicKey {
parameters: self.parameters,
}
}

pub fn parameters(&self) -> CompactPublicKeyEncryptionParameters {
self.parameters
}
}

impl ParameterSetConformant for CompactPublicKey {
Expand Down

0 comments on commit f9e8df4

Please sign in to comment.