[kmac] kmac counter hardening
it would be good to harden the kmac key_index counter.
This will ensure that an attack cannot shorten the key counter and thus potentially have a very weak key during MAC calculation.
Since the key length is known (only a few choices), we could employ a count down / count up approach. There is such an unverified implementation in keymgr right now, we could consider making it a prim so other modules can make use of it.
adding @weicaiyang and @cindychip for visibility (Cindy now owns KMAC tb).
See #9041
(Whoops, looks like @eunchan connected the dots here already)
https://github.com/lowRISC/opentitan/commit/63bd755d052a9a7f1282d632caf075b38dc141d6 covers that.
thank you @m-temp