law ccm_round_trip_if

bend-osdev-crypto@0.1.0.0 · LAWS.bend:264

import bend-osdev-crypto@0.1.0.0/LAWS.bend as LAWS
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
import bend-osdev-cipher-modes@0.1.0.0/ccm.bend as MC
import bend-osdev-crypto@0.1.0.0/crypto.bend as Cr
import bend-osdev-crypto@0.1.0.0/inst_ccm.bend as CC

264# CCM as an AEAD (inst_ccm.bend), for every 128-bit block cipher, key, tag
265# length, nonce, associated data and message: the AEAD round trip, given
266# cipher-modes' ccm_round_trip at the same arguments (h). cipher-modes
267# proves h for every input, but a proof that imports its PROOF.bend fails
268# --verdict (its laws with a template hypothesis), so the two are joined in
269# README.md, not here.
270law ccm_round_trip_if:
271  for ~K: Data
272  for ~enc: K -> M.CmBlock -> M.CmBlock
273  for ~tlen: Nat
274  for +k: K
275  for +nonce: B.Octets
276  for +aad: B.Octets
277  for +p: B.Octets
278  for h: {Result.bind(&2, &2, M.CmError, B.Octets, B.Octets, MC.Ccm.encrypt(~K, ~enc, k, tlen, nonce, aad, p), c => MC.Ccm.decrypt(~K, ~enc, k, tlen, nonce, aad, c)) == Result.map(&2, &2, M.CmError, B.Octets, B.Octets, c => p, MC.Ccm.encrypt(~K, ~enc, k, tlen, nonce, aad, p)) : Result<&2, &2, M.CmError, B.Octets>}
279  {Result.bind(&2, &2, Cr.CrError, B.Octets, B.Octets, CC.CrCcm.seal(~K, ~enc, ~tlen, k, nonce, aad, p), c => CC.CrCcm.open(~K, ~enc, ~tlen, k, nonce, aad, c)) == Result.map(&2, &2, Cr.CrError, B.Octets, B.Octets, c => p, CC.CrCcm.seal(~K, ~enc, ~tlen, k, nonce, aad, p)) : Result<&2, &2, Cr.CrError, B.Octets>}

Uses (14)

Used by (0)

No other definition uses this definition.