#[unsafe(no_mangle)]pub unsafe extern "C" fn pamoja_session_open(
session: *mut PamojaSession,
sealed: PamojaSealed,
buf: *mut u8,
len: usize,
aad: *const u8,
aad_len: usize,
) -> PamojaStatusExpand description
Opens a message from the peer, verifying it and decrypting it in place.
A message is rejected if its counter repeats or is older than the replay
window still tracks, and if its tag does not authenticate. On any rejection
buf is left zeroed, so a failed open never yields readable bytes.
§Arguments
session- the session.sealed- the counter and tag that arrived with the ciphertext.buf- the ciphertext, replaced by the plaintext on success.len- the length ofbuf.aad- the same associated data the sender authenticated.aad_len- the length ofaad.
§Returns
PamojaStatus::Ok if the message is authentic and fresh, or
PamojaStatus::Auth if it is not, with the message from
pamoja_last_error_message saying whether
it failed authentication or repeated a counter.
§Safety
session must be a live handle from pamoja_session_establish, buf must
point to at least len readable and writable bytes or be null when len is
0, and aad must point to at least aad_len readable bytes or be null when
aad_len is 0.