def main
import bend-osdev-aead@0.1.0.0/check.bend as Checkimport Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-osdev-aead@0.1.0.0/aesround.bend as R
190def main() -> IO(Unit):
191 +z16 = B.Octets.zeros(16n)
192 +k = hx("000102030405060708090a0b0c0d0e0f")
193 +n = hx("101112131415161718191a1b1c1d1e1f")
194 +kr = hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")
195 +pr = B.Octets.of_string("A cipher system must not be required to be secret, and it must be able to fall into the hands of the enemy without inconvenience")
196 +ivr = hx("1af38c2dc2b96ffdd86694092341bc04")
197 +ar = B.Octets.of_string("The second principle of Auguste Kerckhoffs")
198 +ak = hx("202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f000102030405060708090a0b0c0d0e0f")
199 +m32 = hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")
200 +sk = hx("000102030405060708090a0b0c0d0e0fa0a1a2a3a4a5a6a7a8a9aaab")
201 do IO<Unit>:
202 IO.print(R.AdBlk.hex(R.AdAes.round(R.AdAes.sbox(), R.AdBlk.of_octets(hx("000102030405060708090a0b0c0d0e0f")), R.AdBlk.of_octets(hx("101112131415161718191a1b1c1d1e1f")))))
203 IO.print(aegis(z16, z16, B.Octets.empty(), B.Octets.empty()))
204 IO.print(aegis(z16, z16, B.Octets.empty(), z16))
205 IO.print(aegis(k, n, hx("0001020304050607"), m32))
206 IO.print(aegis(k, n, hx("00010203"), hx("000102030405060708090a0b0c")))
207 IO.print(aegis(k, n, B.Octets.of_string("associated data, two blocks long"), B.Octets.of_string("a message of sixty-one bytes, which ends in a partial block...")))
208 IO.print(aegis_open(k, n, hx("00010203"), hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c")))
209 IO.print(aegis_seal(hx("000102030405060708090a0b0c0d0e"), n, B.Octets.empty(), B.Octets.empty()))
210 IO.print(aegis_seal(k, hx("101112131415161718191a1b1c1d1e"), B.Octets.empty(), B.Octets.empty()))
211 IO.print(aegis_open(k, n, B.Octets.empty(), hx("000102030405060708090a0b0c0d0e")))
212 IO.print(authenc(~au.seal_m, ~au.open_m, kr, ivr, ar, pr))
213 IO.print(authenc(~au.seal_k, ~au.open_k, kr, ivr, ar, m32))
214 IO.print(authenc_open(~au.open_m, kr, ivr, ar, hx("c80edfa32ddf39d5ef00c0b468834279a2e46a1b8049f792f76bfe54b903a9c9a94ac9b47ad2655c5f10f9aef71427e2fc6f9b3f399a221489f16362c703233609d45ac69864e3321cf82935ac4096c86e133314c54019e8ca7980dfa4b9cf1b384c486f3a54c51078158ee5d79de59fbd34d848b3d69550a67646344427ade54b8851ffb598f7f80074b9473c82e2db652c3fa36b0a7c5b3219fab3a30bc1c5")))
215 IO.print(authenc_open(~au.open_k, kr, ivr, ar, hx("00")))
216 IO.print(essiv(kr, hx("00000000000000000000000000000000"), m32))
217 IO.print(essiv(k, hx("07000000000000000000000000000000"), B.Octets.zeros(64n)))
218 IO.print(seqiv(sk, hx("0000000000000001"), hx("0001020304050607"), B.Octets.of_string("seqiv over AES-CCM")))
219 IO.print(seqiv(sk, hx("00000000000000ff00000002"), B.Octets.empty(), B.Octets.empty()))
220 IO.print(seqiv_open(sk, hx("0000000000000001"), hx("0001020304050607"), hx("a1a1a2a3a4a5a6a7a8a9aaaa0d0593fbd64079e780eac7a612cbc2c361abf939db30bd025719f04d7e5611335a36")))
221 IO.print(seqiv_open(sk, hx("0000000000000001"), hx("0001020304050607"), hx("a0a1a2a3a4a5")))
222 IO.print(echainiv(ak, k, n, hx("0000000000000001"), hx("0001020304050607"), m32))
223 IO.print(echainiv(ak, k, n, hx("0000000000000002"), B.Octets.empty(), B.Octets.zeros(48n)))
224 IO.print(echainiv_open(ak, k, n, hx("0000000000000001"), hx("0001020304050607"), hx("5f7ed55606bdb961c1821f3964f0677519fae8ab350e663f77fc5e7c714699385a8f006affb14b20ca29241a76851a0baf0e8efc707dcaf9a1b324015191ccebd83f61f0f2787a85a647e10061197f69")))
Uses (26)
Used by (0)
No other definition uses this definition.