Skip to content

Ns/chore/conformance unwrap #2212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tfhe/src/core_crypto/commons/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct GgswCiphertextCount(pub usize);
pub struct LweSize(pub usize);

impl LweSize {
/// Return the associated [`LweDimension`, Versionize].
/// Return the associated [`LweDimension`].
pub fn to_lwe_dimension(&self) -> LweDimension {
LweDimension(self.0 - 1)
}
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl From<std::convert::Infallible> for Error {
pub enum InvalidRangeError {
/// The upper bound of the range is greater than the size of the integer
SliceTooBig,
/// The upper gound is smaller than the lower bound
/// The upper bound is smaller than the lower bound
WrongOrder,
}

Expand Down
20 changes: 12 additions & 8 deletions tfhe/src/high_level_api/keys/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,12 @@ impl ParameterSetConformant for IntegerServerKey {
) {
(None, None) => true,
(Some((cpk_params, ks_params)), Some(cpk_key_switching_key_material)) => {
let cpk_param = (parameter_set.sk_param, *cpk_params, *ks_params)
.try_into()
.unwrap();
cpk_key_switching_key_material.is_conformant(&cpk_param)
if let Ok(cpk_param) = (parameter_set.sk_param, *cpk_params, *ks_params).try_into()
{
cpk_key_switching_key_material.is_conformant(&cpk_param)
} else {
return false;
}
}
_ => return false,
};
Expand Down Expand Up @@ -593,10 +595,12 @@ impl ParameterSetConformant for IntegerCompressedServerKey {
) {
(None, None) => true,
(Some((cpk_params, ks_params)), Some(cpk_key_switching_key_material)) => {
let cpk_param = (parameter_set.sk_param, *cpk_params, *ks_params)
.try_into()
.unwrap();
cpk_key_switching_key_material.is_conformant(&cpk_param)
if let Ok(cpk_param) = (parameter_set.sk_param, *cpk_params, *ks_params).try_into()
{
cpk_key_switching_key_material.is_conformant(&cpk_param)
} else {
return false;
}
}
_ => return false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl ServerKey {
}
/// Decompresses a signed compressed ciphertext
/// This operation costs a PBS
///
///
/// See [`CompressedModulusSwitchedSignedRadixCiphertext#example`] for usage
pub fn decompress_signed_parallelized(
&self,
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/shortint/key_switching_key/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module defines KeySwitchingKey
//!
//! - [KeySwitchingKey] allows switching the keys of a ciphertext, from a cleitn key to another.
//! - [KeySwitchingKey] allows switching the keys of a ciphertext, from a client key to another.

use crate::conformance::ParameterSetConformant;
use crate::core_crypto::prelude::{
Expand Down
Loading