mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-10 07:08:03 -05:00
feat: add missing into/from_raw_parts functions for compressed KSK material
This commit is contained in:
@@ -223,6 +223,19 @@ impl CompressedKeySwitchingKeyMaterial {
|
||||
material: self.material.decompress(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_raw_parts(
|
||||
material: crate::shortint::key_switching_key::CompressedKeySwitchingKeyMaterial,
|
||||
) -> Self {
|
||||
Self { material }
|
||||
}
|
||||
|
||||
pub fn into_raw_parts(
|
||||
self,
|
||||
) -> crate::shortint::key_switching_key::CompressedKeySwitchingKeyMaterial {
|
||||
let Self { material } = self;
|
||||
material
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, Versionize)]
|
||||
|
||||
@@ -843,6 +843,28 @@ impl CompressedKeySwitchingKeyMaterial {
|
||||
destination_key: self.destination_key,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_raw_parts(
|
||||
key_switching_key: SeededLweKeyswitchKeyOwned<u64>,
|
||||
cast_rshift: i8,
|
||||
destination_key: EncryptionKeyChoice,
|
||||
) -> Self {
|
||||
Self {
|
||||
key_switching_key,
|
||||
cast_rshift,
|
||||
destination_key,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_raw_parts(self) -> (SeededLweKeyswitchKeyOwned<u64>, i8, EncryptionKeyChoice) {
|
||||
let Self {
|
||||
key_switching_key,
|
||||
cast_rshift,
|
||||
destination_key,
|
||||
} = self;
|
||||
|
||||
(key_switching_key, cast_rshift, destination_key)
|
||||
}
|
||||
}
|
||||
|
||||
// This is used to have the ability to build a keyswitching key without owning the ServerKey
|
||||
|
||||
Reference in New Issue
Block a user