feat: add mlkem encap

This commit is contained in:
2024-08-27 16:53:10 +02:00
parent 46c9a6e499
commit 3922222898

View File

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