ocb_encrypt

Function ocb_encrypt 

Source
pub fn ocb_encrypt(
    cipher: &Aes128,
    plain: &[u8],
    nonce: &[u8; 16],
    modify_on_xexstar_attack: bool,
) -> (bool, Vec<u8>, [u8; 16])
Expand description

OCB2 encryption of plain under cipher with the given nonce.

Returns (authentic, ciphertext, tag). authentic is false only when a XEX*-critical block is detected and modify_on_xexstar_attack is false — the path used only to exercise ocb_decrypt’s detection. With the flag true (the production setting), a critical block has a bit flipped so encryption stays authentic while defeating the attack.

REF: CryptStateOCB2.cpp : ocb_encrypt.