Perform a round.
(round stat constants alpha partial-first-p mds prime full-p) → new-stat
We add the round constants, we apply the S-box substitution, and we multiply by the MDS matrix. The round may be full or partial, which affects only the S-box substitution.
Function:
(defun round (stat constants alpha partial-first-p mds prime full-p) (declare (xargs :guard (and (integerp alpha) (booleanp partial-first-p) (primep prime) (booleanp full-p) (fe-listp stat prime) (fe-listp constants prime) (fe-list-listp mds prime)))) (declare (xargs :guard (and (equal (len constants) (len stat)) (all-len-equal-p mds (len stat))))) (let ((__function__ 'round)) (declare (ignorable __function__)) (b* ((stat (add-round-constants stat constants prime)) (stat (sub-words stat alpha partial-first-p prime full-p)) (stat (mix-layer mds stat prime))) stat)))
Theorem:
(defthm fe-listp-of-round (implies (primep prime) (b* ((new-stat (round stat constants alpha partial-first-p mds prime full-p))) (fe-listp new-stat prime))) :rule-classes :rewrite)
Theorem:
(defthm len-of-round (implies (equal (len mds) (len stat)) (b* ((?new-stat (round stat constants alpha partial-first-p mds prime full-p))) (equal (len new-stat) (len stat)))))