def Ccm.decrypt

bend-osdev-cipher-modes@0.1.0.0 · ccm.bend:265

import bend-osdev-cipher-modes@0.1.0.0/ccm.bend as Ccm
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M

265# the plaintext of c (the ciphertext, then the m-byte tag), or CmTagMismatch
266# when the tag does not match; no plaintext is released from a message that
267# fails
268def Ccm.decrypt(~K: Data, ~enc: K -> M.CmBlock -> M.CmBlock, +k: K, +m: Nat, nonce: B.Octets, aad: B.Octets, c: B.Octets) -> Result<&2, &2, M.CmError, B.Octets>:
269  +cv = B.Octets.to_list(c)
270  ccm.d2.fast(~K, ~enc, Nat.is_le(m, B.len.fast(cv)), k, m, B.Octets.to_list(nonce), B.Octets.to_list(aad), cv)

Uses (9)

Used by (5)