def Ccm.encrypt.ref

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

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

248# Ccm.encrypt and Ccm.decrypt through the structural forms (the laws' proofs
249# reason about these; PROOF.bend proves them equal to the public defs)
250def Ccm.encrypt.ref(~K: Data, ~enc: K -> M.CmBlock -> M.CmBlock, +k: K, +m: Nat, nonce: B.Octets, aad: B.Octets, p: B.Octets) -> Result<&2, &2, M.CmError, B.Octets>:
251  +nv = B.Octets.to_list(nonce)
252  +pv = B.Octets.to_list(p)
253  ccm.e2(~K, ~enc, k, m, nv, B.Octets.to_list(aad), pv, ccm.checks(m, B.len(nv), B.len(pv)))

Uses (9)

Used by (2)