PROOF.bend checks
raw source on the hub · import bend-osdev-cipher-core@0.1.0.0/PROOF.bend as PROOF
7 imports
import Base import bend-osdev-bytes@0.1.1.0/bytes.bend as B import bend-osdev-bytes@0.1.1.0/LAWS.bend as BL import bend-osdev-bytes@0.1.1.0/PROOF.bend as BP import ./cipher_core.bend as L import ./modes64.bend as X import ./LAWS.bend as Laws
Definitions
def bool_xx source · line 12 · raw
@a:Bool -> @b:Bool -> {a == Bool.xor(Bool.xor(a, b), b) : Bool}
def word_xx source · line 23 · raw
@n:Nat -> @a:Word(n) -> @b:Word(n) -> {a == Word.xor(n, Word.xor(n, a, b), b) : Word(n)}
def u32_xx source · line 36 · raw
@a:U32 -> @b:U32 -> {a == U32.xor(U32.xor(a, b), b) : U32}
def rot_1_31 source · line 45 · raw
@x:U32 -> {x == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.rotl1.bits(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.rotl31.bits(x)) : U32}
def rot_31_1 source · line 50 · raw
@x:U32 -> {x == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.rotl31.bits(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.rotl1.bits(x)) : U32}
def bswap2 source · line 55 · raw
@x:U32 -> {x == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.bswap.bits(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.bswap.bits(x)) : U32}
def blk_bytes source · line 61 · raw
@b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> {0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.block_of(0xe0217e1ab38629fddf738452c1f2a82e/bytes.mask(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.block_bytes(b, []))) == Some{b} : Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>}a 64-bit block's bytes, masked and read back
def blk8 source · line 66 · raw
@hi:U32 -> @lo:U32 -> {0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64{hi, lo} == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.block8(0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b0.bits(hi)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b1.bits(hi)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b2.bits(hi)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b3.bits(hi)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b0.bits(lo)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b1.bits(lo)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b2.bits(lo)), 0xe0217e1ab38629fddf738452c1f2a82e/bytes.byte(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.b3.bits(lo))) : 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64}
def b64.mget source · line 113 · raw
@m:Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+d:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64
a block read from 8 bytes is written back as those bytes (on their bits, and then off a list of any length)
def b64.mdisc source · line 120 · raw
@m:Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> Type
def b64.nsome source · line 127 · raw
@+bl:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @h:{None{} == Some{bl} : Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>} -> Empty
def b64.dbits source · line 132 · raw
@a0:U32 -> @a1:U32 -> @a2:U32 -> @a3:U32 -> @a4:U32 -> @a5:U32 -> @a6:U32 -> @a7:U32 -> {0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.to_octets(b64.mget(0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.block_of([a0, a1, a2, a3, a4, a5, a6, a7]), 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64{0, 0})) == 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets.of_list([a0, a1, a2, a3, a4, a5, a6, a7]) : 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets}a block's bytes read from 8 bytes are those bytes (on their bits)
def b64.dualL source · line 139 · raw
@+xs:List<&2, U32> -> @+bl:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @_:{0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.block_of(xs) == Some{bl} : Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>} -> {0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.to_octets(bl) == 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets.of_list(xs) : 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets}a block read from a list of bytes is written back as those bytes
def b64.dual source · line 180 · raw
@+o:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> @+bl:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @em:{0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.of_octets(o) == Some{bl} : Maybe<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>} -> {0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.to_octets(bl) == o : 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets}
def m64_joins source · line 186 · raw
@bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @ys:List<&2, U32> -> List<&2, U32>
the bytes of the blocks bs in front of ys, structurally
def m64_join_rev source · line 193 · raw
@bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+zs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+ys:List<&2, U32> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.join(zs, m64_joins(bs, ys)) == 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.join(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.rev_onto(bs, zs), ys) : List<&2, U32>}
def m64_split_joins source · line 200 · raw
@bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+acc:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.split(0xe0217e1ab38629fddf738452c1f2a82e/bytes.mask(m64_joins(bs, [])), acc) == Some{0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.rev_onto(acc, bs)} : Maybe<&2, List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>>}
def bool_xx2 source · line 218 · raw
@a:Bool -> @b:Bool -> {b == Bool.xor(a, Bool.xor(a, b)) : Bool}
def word_xx2 source · line 229 · raw
@n:Nat -> @a:Word(n) -> @b:Word(n) -> {b == Word.xor(n, a, Word.xor(n, a, b)) : Word(n)}
def u32_xx2 source · line 242 · raw
@a:U32 -> @b:U32 -> {b == U32.xor(a, U32.xor(a, b)) : U32}
def b64_xx2 source · line 248 · raw
@a:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> {b == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.xor(a, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.xor(a, b)) : 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64}
Templates
template fe_unstep_step source · line 76 · raw
@-RK:Data -> @-f:(@_:RK -> @_:U32 -> U32) -> @+k:RK -> @b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> {b == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.unstep(RK, f, k, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.step(RK, f, k, b)) : 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64}
template fe_step_unstep source · line 82 · raw
@-RK:Data -> @-f:(@_:RK -> @_:U32 -> U32) -> @+k:RK -> @b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> {b == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.step(RK, f, k, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.unstep(RK, f, k, b)) : 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64}
template fe_unrun_run source · line 88 · raw
@-RK:Data -> @-f:(@_:RK -> @_:U32 -> U32) -> @ks:List<&2, RK> -> @+b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> {b == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.unrun(RK, f, ks, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.run(RK, f, ks, b)) : 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64}
template fe_run_unrun source · line 96 · raw
@-RK:Data -> @-f:(@_:RK -> @_:U32 -> U32) -> @ks:List<&2, RK> -> @+b:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> {b == 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.run(RK, f, ks, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.lc.fe.unrun(RK, f, ks, b)) : 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64}
template ecb_ref source · line 255 · raw
@-K:Data -> @-f:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+acc:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.ecb.go(K, f, k, bs, acc) == 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.rev_onto(acc, 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.ecb(K, f, k, bs)) : List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>}
template cbc_enc_ref source · line 262 · raw
@-K:Data -> @-enc:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+iv:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @+acc:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.cbc.enc.go(K, enc, k, bs, iv, acc) == 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.rev_onto(acc, 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.cbc.enc(K, enc, k, bs, iv)) : List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>}
template cbc_dec_ref source · line 269 · raw
@-K:Data -> @-dec:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> @+iv:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @+acc:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.cbc.dec.go(K, dec, k, bs, iv, acc) == 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.rev_onto(acc, 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.m64.cbc.dec(K, dec, k, bs, iv)) : List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>}
template cbc_enc_ok source · line 278 · raw
@-K:Data -> @-enc:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @+iv:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @+bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.cbc_encrypt(K, enc, k, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.to_octets(iv), 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(bs)) == Done{0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.cbc_encrypt_blocks(K, enc, k, iv, bs))} : Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets>}
template cbc_dec_ok source · line 283 · raw
@-K:Data -> @-dec:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @+iv:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> @+bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.cbc_decrypt(K, dec, k, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64.to_octets(iv), 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(bs)) == Done{0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.cbc_decrypt_blocks(K, dec, k, iv, bs))} : Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets>}
template ecb_enc_ok source · line 288 · raw
@-K:Data -> @-f:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @+bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {Result.map(&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets, xs => 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.ecb_encrypt_blocks(K, f, k, xs)), 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.blocks_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(bs))) == Done{0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.ecb_encrypt_blocks(K, f, k, bs))} : Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets>}
template ecb_dec_ok source · line 292 · raw
@-K:Data -> @-f:(@_:K -> @_:0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64 -> 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64) -> @+k:K -> @+bs:List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64> -> {Result.map(&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, List<&2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcBlock64>, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets, xs => 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.ecb_decrypt_blocks(K, f, k, xs)), 0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.blocks_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(bs))) == Done{0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.octets_of(0x5c26418ab13c9e565c5b1309d2f085a0/modes64.Lc64.ecb_decrypt_blocks(K, f, k, bs))} : Result<&2, &2, 0x5c26418ab13c9e565c5b1309d2f085a0/cipher_core.LcError, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets>}