-
Notifications
You must be signed in to change notification settings - Fork 13
ot_otp: handle secret partition descrambling at OTP back-end load time
#259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ot_otp: handle secret partition descrambling at OTP back-end load time
#259
Conversation
d7559b3 to
b4888f0
Compare
AlexJones0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking at this, it looks great to me! I'll base my other OTP PR (#258) on the changes in this PR.
You can ignore the CI failure in //sw/device/tests/crypto:aes_kwp_kat_functest_sim_qemu_sival_rom_ext, I need to find some time to look into why all the AES tests are recently flaky on Earlgrey regression CI - no QEMU change was made so some of the OpenTitanLib crypto refactoring must have started doing something differently. The errors are quite strange.
AlexJones0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I've just checked and this is causing the otp_ctrl_descrambling_test to fail again, let me see if I can figure out what's going wrong.
b4888f0 to
de7b785
Compare
|
I have something resembling a fix in my last commit here. At least for Earlgrey it gets the descrambling test passing. The commit message goes into more detail but this ensures that DAI reads from buffered partitions read from the buffer and do not erroneously calculate the ECC on bufferized data (which, if descrambled, will not have the same ECC as the scrambled data). This is probably not entirely correct, as I haven't cross-referenced the RTL nor properly considered the implications on digests at all, but it is sufficient to at least get the descrambling datapath exercised by |
2e770f4 to
a04e37b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this LGTM (apart from the CI lint failure).
Also on the commit for fixing buffered DAI reads (542d0c0), this should be renamed to ot_otp instead of ot_otp_eg?
The CI regression run reports that the otp_ctrl_descrambling_test is passing, so this should be correct for secret partition descrambling.
a04e37b to
94fd1b3
Compare
|
Should be ok, waiting for CI |
a379f03 to
598ac19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work on this, it looks really nice to me.
If you use all the suggestions/fixes from the comments I've left and rebase my OTP PR (#258) on top, then I can see the the Earlgrey OTP tests that we have passing.
Function naming was a bit confusing, rename it to match similar feature. Remove condition known to be always true. Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…IZE} macros
with ot_otp_eg_part_data_byte_{offset,size} static inline function.
This aligns code with Darjeeling version.
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
598ac19 to
aafab66
Compare
aafab66 to
174c3a5
Compare
…ementation - Partially generated with autoreg.py and otptool.py Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…igest management. - unscramble secret partitions at OTP load time - content of buffered partitions is stored, unscrambled, in partition buffers - all partition digest are loaded, ECC-corrected and stored in dedicated partition controller field, whether they are buffered or not - DAI read always access the OTP back-end data, never the buffered copy Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
174c3a5 to
cb32e1c
Compare
Replace this legacy implementation based on partition "type", with the `integrity` partition descriptor to perform ECC. Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
cb32e1c to
473089b
Compare
AlexJones0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is much more closely aligned to the RTL.
With my PR rebased on top, all the OTP tests that I have locally are passing (when the QEMU support is merged I will try and enable them upstream so we get the checks in CI regressions).
Thanks a lot for your help + review + diagnosis. |
No description provided.