feat: add mlkem decap

This commit is contained in:
2024-08-27 17:36:53 +02:00
parent 3922222898
commit 05eb75d932

View File

@@ -94,3 +94,15 @@ pub fn mlkem_encap(pk: &MLKEMPubKey) -> (MLKEMCiphertext, MLKEMSharedKey) {
(ct, ss) (ct, ss)
} }
pub fn mlkem_decap(ct: &MLKEMCiphertext, sk: &MLKEMPrivKey) -> MLKEMSharedKey {
let ss = MLKEMSharedKey(SharedPtr::<32>::new().unwrap());
let mut agent = MLKEMAGENT.lock().unwrap();
unsafe {
agent.perform_ipc_call(1, &[ss.0.get_offset(), ct.0.get_offset(), sk.0.get_offset()]);
}
ss
}