def tf_round

bend-osdev-legacy-ciphers@0.1.0.0 · PROOF.bend:425

import bend-osdev-legacy-ciphers@0.1.0.0/PROOF.bend as PROOF
import Base
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M
import bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend as L
import bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend as F

425def tf_round(+tb: F.LcTfTabs, +sk: List<&2, U32>, +ka: U32, +kb: U32, s: M.CmBlock) -> {s == F.tf.unop(F.LcTfRound{tb, sk, ka, kb}, F.tf.op(F.LcTfRound{tb, sk, ka, kb}, s)) : M.CmBlock}:
426  match s:
427    case M.CmBlock{+r0, +r1, +r2, +r3}:
428      %rot_1_31(U32.xor(r2, F.tf.f0(F.tf.f(tb, sk, r0, r1, ka, kb)))) : {M.CmBlock{r0, r1, r2, r3} == M.CmBlock{r0, r1, U32.xor(_, F.tf.f0(F.tf.f(tb, sk, r0, r1, ka, kb))), L.lc.rotl31.bits(U32.xor(U32.xor(L.lc.rotl1.bits(r3), F.tf.f1(F.tf.f(tb, sk, r0, r1, ka, kb))), F.tf.f1(F.tf.f(tb, sk, r0, r1, ka, kb))))} : M.CmBlock}
429      %u32_xx(r2, F.tf.f0(F.tf.f(tb, sk, r0, r1, ka, kb))) : {M.CmBlock{r0, r1, r2, r3} == M.CmBlock{r0, r1, _, L.lc.rotl31.bits(U32.xor(U32.xor(L.lc.rotl1.bits(r3), F.tf.f1(F.tf.f(tb, sk, r0, r1, ka, kb))), F.tf.f1(F.tf.f(tb, sk, r0, r1, ka, kb))))} : M.CmBlock}
430      %u32_xx(L.lc.rotl1.bits(r3), F.tf.f1(F.tf.f(tb, sk, r0, r1, ka, kb))) : {M.CmBlock{r0, r1, r2, r3} == M.CmBlock{r0, r1, r2, L.lc.rotl31.bits(_)} : M.CmBlock}
431      %rot_31_1(r3) : {M.CmBlock{r0, r1, r2, r3} == M.CmBlock{r0, r1, r2, _} : M.CmBlock}
432      {==}

Uses (16)

Used by (1)