LAWS.bend
bend-osdev-aria@0.1.0.0 · 36 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-aria@0.1.0.0/aria.bend as A
9
10
11
12law aria_round_trip:
13 for k: A.LcAriaKey
14 for +b: M.CmBlock
15 {A.LcAria.decrypt(k, A.LcAria.encrypt(k, b)) == b : M.CmBlock}
16
17law aria_round_trip_dual:
18 for k: A.LcAriaKey
19 for +b: M.CmBlock
20 {A.LcAria.encrypt(k, A.LcAria.decrypt(k, b)) == b : M.CmBlock}
21
22
23
24
25
26
27
28
29law aria_rfc5794:
30 {Result.map(&2, &2, L.LcError, A.LcAriaKey, M.CmBlock, k => A.LcAria.encrypt(k, M.CmBlock{1122867, 1146447479, 2291772091, 3437096703}), A.LcAria.key(B.Octets.of_list([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]))) == Done{M.CmBlock{3608738774, 2875477107, 2645122875, 3863287672}} : Result<&2, &2, L.LcError, M.CmBlock>}
31
32
33law aria_bad_key_length:
34 {Result.map(&2, &2, L.LcError, A.LcAriaKey, Unit, k => Unit{}, A.LcAria.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>}
35
36