# Laws about ARIA (aria.bend): for every key (every key size) and block, # decryption undoes encryption and encryption undoes decryption; and RFC # 5794 A.1 and a refused key, proved by computation. import Base import bend-osdev-bytes@0.1.1.0/bytes.bend as B import bend-osdev-mode-core@0.1.0.0/mode_core.bend as M import bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as L import ./aria.bend as A # ARIA (RFC 5794), every key size law aria_round_trip: for k: A.LcAriaKey for +b: M.CmBlock {A.LcAria.decrypt(k, A.LcAria.encrypt(k, b)) == b : M.CmBlock} law aria_round_trip_dual: for k: A.LcAriaKey for +b: M.CmBlock {A.LcAria.encrypt(k, A.LcAria.decrypt(k, b)) == b : M.CmBlock} # Vectors: the specification's test values and refusals, proved by # computation (gen/vectors.py) # BEGIN GENERATED by gen/vectors.py: vectors # RFC 5794, Appendix A.1: ARIA-128, key 000102030405060708090A0B0C0D0E0F, # plaintext 00112233445566778899AABBCCDDEEFF, ciphertext # D718FBD6AB644C739DA95F3BE6451778 law aria_rfc5794: {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>} # an ARIA key of 20 bytes is refused law aria_bad_key_length: {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>} # END GENERATED: vectors