Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeul-zama committed Aug 21, 2024
1 parent 3a2d9a4 commit 2bfa6ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tfhe/src/core_crypto/commons/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ impl GlweSize {
pub fn to_glwe_dimension(&self) -> GlweDimension {
GlweDimension(self.0 - 1)
}

pub const fn to_glwe_ct_size(self, poly_size: PolynomialSize) -> usize {
self.0 * poly_size.0
}
}

/// The number of polynomials of a GLWE mask, or the size of a GLWE secret key.
Expand Down
6 changes: 4 additions & 2 deletions tfhe/src/core_crypto/entities/glwe_ciphertext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,10 @@ where

check_encrypted_content_respects_mod(self, glwe_ct_parameters.ct_modulus)
&& data.container_len()
== glwe_ct_parameters.glwe_dim.to_glwe_size().0
* glwe_ct_parameters.polynomial_size.0
== glwe_ct_parameters
.glwe_dim
.to_glwe_size()
.to_glwe_ct_size(glwe_ct_parameters.polynomial_size)
&& *polynomial_size == glwe_ct_parameters.polynomial_size
&& *ciphertext_modulus == glwe_ct_parameters.ct_modulus
}
Expand Down

0 comments on commit 2bfa6ee

Please sign in to comment.