opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

[kmac] sideload key error hangs the DUT

Open udinator opened this issue 5 years ago • 9 comments

Hi Eunchan,

Currently, the StKeyMgrErrKeyNotValid state in kmac_app does not have any way to transition back to the Idle/Reset states, so if I create an error on the AppKeyMgr interface by not providing a valid sideload key, the DUT hangs until a full reset is issued.

My understanding (please correct me if I'm wrong) was that these errors should be read and cleared by SW, not requiring a reset due to terminal design state, should this state be fixed to reset the App interface once the error is cleared?

udinator avatar May 21 '21 18:05 udinator

At this moment, there's no clear error handling process yet in KMAC.

I think your idea is better. Wait SW's response and give a way for SW to move the state back to Idle.

On May 22, 2021, at 3:47 AM, udinator @.***> wrote:

Hi Eunchan,

Currently, the StKeyMgrErrKeyNotValid state in kmac_app does not have any way to transition back to the Idle/Reset states, so if I create an error on the AppKeyMgr interface by not providing a valid sideload key, the DUT hangs until a full reset is issued.

My understanding (please correct me if I'm wrong) was that these errors should be read and cleared by SW, not requiring a reset due to terminal design state, should this state be fixed to reset the App interface once the error is cleared?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/lowRISC/opentitan/issues/6672, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJDG3XMUECU35T7J54SNBTTO2TCJANCNFSM45JVWOLA.

eunchan avatar May 21 '21 19:05 eunchan

quick question, when this error occurs, does an error get sent back to key manager as well?

tjaychen avatar Jun 14 '21 18:06 tjaychen

@eunchan can correct me if I'm mistaken, but I don't believe any report will be sent to the keymgr if this error occurs, the KMAC will just hang and report the error externally to SW.

udinator avatar Jun 14 '21 18:06 udinator

ah then we might need to make sure we handle the keymgr side gracefully also. otherwise i think the key manager side can get out of sync also and that is probably going to be bad.

for example, would it make sense to say that when keymgr starts sending over data, if key is not already available, an error should be reported back?

tjaychen avatar Jun 14 '21 19:06 tjaychen

doing something like that would make sense to me, let's wait for eunchan to weigh in though

udinator avatar Jun 14 '21 19:06 udinator

ah then we might need to make sure we handle the keymgr side gracefully also. otherwise i think the key manager side can get out of sync also and that is probably going to be bad.

for example, would it make sense to say that when keymgr starts sending over data, if key is not already available, an error should be reported back?

Sounds good. In this scenario, do you expect KMAC accepts all the data then report an error with dummy digest value? I will revise the KMAC soon after landing #6753

eunchan avatar Jun 14 '21 23:06 eunchan

ading @cindychip for visibility

udinator avatar Oct 08 '21 00:10 udinator

@eunchan just want to check if there is any updates on this issue? Thank you!

cindychip avatar Feb 08 '22 17:02 cindychip

It was implemented. We can close now.

KMAC, if no side load key exists, moves to Error state and when any application interface requests the last message data, it returns with all 0 digest.

eunchan avatar Feb 08 '22 18:02 eunchan