Trait mc_oblivious_aes_gcm::CtAeadDecrypt
source · pub trait CtAeadDecrypt: AeadInPlace {
fn ct_decrypt_in_place_detached(
&self,
nonce: &GenericArray<u8, Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &GenericArray<u8, Self::TagSize>
) -> CtDecryptResult;
}
Expand description
API for Aead in-place decryption which is constant-time with respect to the mac check failing
This is meant to extend the AeadInPlace trait and be implemented by those AEAD’s which have a constant-time decrypt operation.
Required Methods§
sourcefn ct_decrypt_in_place_detached(
&self,
nonce: &GenericArray<u8, Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &GenericArray<u8, Self::TagSize>
) -> CtDecryptResult
fn ct_decrypt_in_place_detached(
&self,
nonce: &GenericArray<u8, Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &GenericArray<u8, Self::TagSize>
) -> CtDecryptResult
Decrypt a buffer using given aead nonce, validating associated data under the mac (tag).
This API promises to be branchless and constant time, particularly, not branching on whether or not the mac check succeeded.
Returns: Choice::from(true): The mac check succeeded and the buffer contains the plaintext Choice::from(false): Decryption failed, and the buffer contains failed decryption. The caller SHOULD zeroize buffer before it is discarded.