Skip to content

Conversation

@luismarques
Copy link

The descrambling for the token loading path will be done in a separate PR.

@luismarques luismarques force-pushed the ot_otp_eg_descrambling branch from bad7426 to 16c16db Compare October 22, 2025 16:26
@AlexJones0 AlexJones0 force-pushed the ot_otp_eg_descrambling branch from 16c16db to d735823 Compare October 22, 2025 19:56
AlexJones0 and others added 6 commits October 22, 2025 21:00
Load the OTP scrambling keys from hex-string configured properties.
These keys are used for decoding the scrambled data stored in secret
partitions (`SECRET0`, `SECRET1`, etc.)

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Load the OTP scrambling keys from hex-string configured properties.
These keys are used for decoding the scrambled data stored in secret
partitions (`SECRET0`, `SECRET1`, etc.)

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Parse the hard-coded OTP scrambling key constants out of the relevant SV
partition SV files into the generated OT configuration files, so that
they can be used in the OTP.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Unscramble DAI reads from secret partitions, which are scrambled with a
scrambling key (configured per-partition as a netlist constant) via a
simple Present block cipher.

Co-authored-by: Alex Jones <alex.jones@lowrisc.org>
Signed-off-by: Luís Marques <luismarques@lowrisc.org>
Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Unscramble DAI reads from secret partitions, which are scrambled with a
scrambling key (configured per-partition as a netlist constant) via a
simple Present block cipher.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
These files need to include the new OTP scrambling keys, so regenerate
them from the latest commits on the `master` branch (for Darjeeling) and
the `earlgrey_1.0.0` branch (for Earlgrey).

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
@AlexJones0 AlexJones0 force-pushed the ot_otp_eg_descrambling branch from d735823 to c70a4cd Compare October 22, 2025 20:01
@AlexJones0
Copy link

This should be working on Earlgrey going via cfggen.py to load the constants (at least, //sw/device/tests:otp_ctrl_descrambling_test_sim_qemu_rom_with_fake_keys passes when lowRISC/opentitan#28541 is merged upstream).

I've tried to add the support for Darjeeling as well, but don't have an easy way to test it. I can see the keys are being parsed into the configuration file correctly at least. @rivos-eblot would it be possible for you could check the Darjeeling implementation?

@AlexJones0 AlexJones0 changed the title ot_otp_eg: perform partition descrambling in DAI ot_otp: perform partition descrambling in DAI Oct 22, 2025
Copy link

@rivos-eblot rivos-eblot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rivos-eblot
Copy link

. @rivos-eblot would it be possible for you could check the Darjeeling implementation?

I can give it a try, but I do not know how. Let me check if we have some way to test it and get back to you.
Meanwhile, I think it is safe to merge this PR. Thanks.

@luismarques luismarques merged commit 007293e into lowRISC:ot-9.2.0 Oct 23, 2025
7 of 9 checks passed
except KeyError as exc:
raise ValueError('No scrambling key constants found') from exc
if len(key_values) <= idx:
raise ValueError(f'No such key {name} in the key array') from exc

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I tried to push this change but you had already merged the PR 😅

Suggested change
raise ValueError(f'No such key {name} in the key array') from exc
raise ValueError(f'No such key {name} in the key array')

It'll likely just throw an UnboundLocalError instead of a ValueError on this error case, so not a huge deal.

I'll open a PR to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants