LAWS.bend
bend-osdev-camellia@0.1.0.0 · 35 lines · 4 definitions
1
2
3
4import Base
5import bend-osdev-bytes@0.1.1.0/bytes.bend as B
6import bend-osdev-mode-core@0.1.0.0/mode_core.bend as M
7import bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as L
8import bend-osdev-camellia@0.1.0.0/camellia.bend as C
9
10
11
12law camellia_round_trip:
13 for k: C.LcCamelliaKey
14 for +b: M.CmBlock
15 {C.LcCamellia.decrypt(k, C.LcCamellia.encrypt(k, b)) == b : M.CmBlock}
16
17law camellia_round_trip_dual:
18 for k: C.LcCamelliaKey
19 for +b: M.CmBlock
20 {C.LcCamellia.encrypt(k, C.LcCamellia.decrypt(k, b)) == b : M.CmBlock}
21
22
23
24
25
26
27
28law camellia_rfc3713:
29 {Result.map(&2, &2, L.LcError, C.LcCamelliaKey, M.CmBlock, k => C.LcCamellia.encrypt(k, M.CmBlock{19088743, 2309737967, 4275878552, 1985229328}), C.LcCamellia.key(B.Octets.of_list([1, 35, 69, 103, 137, 171, 205, 239, 254, 220, 186, 152, 118, 84, 50, 16]))) == Done{M.CmBlock{1734816056, 1419143539, 139920982, 1223343683}} : Result<&2, &2, L.LcError, M.CmBlock>}
30
31
32law camellia_bad_key_length:
33 {Result.map(&2, &2, L.LcError, C.LcCamelliaKey, Unit, k => Unit{}, C.LcCamellia.key(B.Octets.of_list([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))) == Fail{L.LcBadKeyLength{20n}} : Result<&2, &2, L.LcError, Unit>}
34
35