use base2k::{Backend, Module, Scratch}; use sampling::source::Source; pub trait EncryptSkScratchSpace { fn encrypt_sk_scratch_space(module: &Module, ct_size: usize) -> usize; } pub trait EncryptSk { type Ciphertext; type Plaintext; type SecretKey; fn encrypt_sk( &self, module: &Module, ct: &mut Self::Ciphertext, pt: &Self::Plaintext, sk: &Self::SecretKey, source_xa: &mut Source, source_xe: &mut Source, sigma: f64, bound: f64, scratch: &mut Scratch, ); } pub trait EncryptZeroSkScratchSpace { fn encrypt_zero_sk_scratch_space(module: &Module, ct_size: usize) -> usize; } pub trait EncryptZeroSk { type Ciphertext; type SecretKey; fn encrypt_zero_sk( &self, module: &Module, ct: &mut Self::Ciphertext, sk: &Self::SecretKey, source_xa: &mut Source, source_xe: &mut Source, sigma: f64, bound: f64, scratch: &mut Scratch, ); } pub trait EncryptPkScratchSpace { fn encrypt_pk_scratch_space(module: &Module, ct_size: usize) -> usize; } pub trait EncryptPk { type Ciphertext; type Plaintext; type PublicKey; fn encrypt_pk( &self, module: &Module, ct: &mut Self::Ciphertext, pt: &Self::Plaintext, pk: &Self::PublicKey, source_xu: &mut Source, source_xe: &mut Source, sigma: f64, bound: f64, scratch: &mut Scratch, ); } pub trait EncryptZeroPkScratchSpace { fn encrypt_zero_pk_scratch_space(module: &Module, ct_size: usize) -> usize; } pub trait EncryptZeroPk { type Ciphertext; type PublicKey; fn encrypt_zero_pk( &self, module: &Module, ct: &mut Self::Ciphertext, pk: &Self::PublicKey, source_xu: &mut Source, source_xe: &mut Source, sigma: f64, bound: f64, scratch: &mut Scratch, ); } pub trait Decrypt { type Plaintext; type Ciphertext; type SecretKey; fn decrypt( &self, module: &Module, pt: &mut Self::Plaintext, ct: &Self::Ciphertext, sk: &Self::SecretKey, scratch: &mut Scratch, ); }