LAWS.ccm_round_trip_if: law of bend-osdev-crypto@0.1.0.0 Import: import bend-osdev-crypto@0.1.0.0/LAWS.bend as LAWS Lines 264-279 of bend-osdev-crypto@0.1.0.0/LAWS.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-crypto@0.1.0.0/LAWS.bend&start_line=264&end_line=279 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 # CCM as an AEAD (inst_ccm.bend), for every 128-bit block cipher, key, tag # length, nonce, associated data and message: the AEAD round trip, given # cipher-modes' ccm_round_trip at the same arguments (h). cipher-modes # proves h for every input, but a proof that imports its PROOF.bend fails # --verdict (its laws with a template hypothesis), so the two are joined in # README.md, not here. law ccm_round_trip_if: for ~K: Data for ~enc: K -> M.CmBlock -> M.CmBlock for ~tlen: Nat for +k: K for +nonce: B.Octets for +aad: B.Octets for +p: B.Octets 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>} {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): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result.map https://jend.leeeet.dev/definition.txt?path=bend-osdev-bytes@0.1.1.0/bytes.bend&name=Octets https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/ccm.bend&name=Ccm.decrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/ccm.bend&name=Ccm.encrypt https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=CmBlock https://jend.leeeet.dev/definition.txt?path=bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend&name=CmError https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/LAWS.bend&name=lift_round_trip https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/crypto.bend&name=CrError https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_ccm.bend&name=CrCcm.open https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_ccm.bend&name=CrCcm.seal https://jend.leeeet.dev/definition.txt?path=bend-osdev-crypto@0.1.0.0/inst_cm.bend&name=CrCm.err