diff --git a/src/mlkem.rs b/src/mlkem.rs index 41ed64c..cb5afd8 100644 --- a/src/mlkem.rs +++ b/src/mlkem.rs @@ -94,3 +94,15 @@ pub fn mlkem_encap(pk: &MLKEMPubKey) -> (MLKEMCiphertext, MLKEMSharedKey) { (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 +}