def aes.rounds
import bend-osdev-cipher-modes@0.1.0.0/aes.bend as Aesimport Base
114# The inverse cipher over the round keys, last round key first:
115# AddRoundKey(Nr), then Nr - 1 rounds of InvShiftRows, InvSubBytes,
116# AddRoundKey, InvMixColumns, then InvShiftRows, InvSubBytes, AddRoundKey(0)
117def aes.rounds(rest: List<&2, CmAesState>, k: CmAesState, s: CmAesState) -> CmAesState:
118 match rest:
119 case Nil{}:
120 aes.add(aes.inv_shift_sub(s), k)
121 case Con{k2, rest2}:
122 aes.rounds(rest2, k2, aes.inv_mix(aes.add(aes.inv_shift_sub(s), k)))