You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ot] hw/opentitan: ot_hmac: Restore correct msg_length with HMAC_EN
HMAC can operate either with HMAC_EN, using HMAC algorithms, or without,
using standard SHA algorithms. The HMAC algorithms introduce additional
logic surrounding a key, and inner and outer padding. Relevant to this
commit is that when computing HMAC, we first process a block of inner
padding XORed with the key. This means that the message length reported
to software in the msg_length register diverges from the message length
reported by the tomcrypt cryptographic library's state. Specifically,
with HMAC_EN=1, it undercounts by a block.
This caused an error where, when saving and restoring context with
HMAC_EN=1, the hash length would be undercounted by a block and thus the
incorrect digest would be computed. This meant that save/restore and
streaming operations were not working properly with HMAC_EN.
This commit introduces the additional logic to fix this edge case.
Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
0 commit comments