Skip to content

Commit

Permalink
fix(espefuse): Fix ECDSA_FORCE_USE_HARDWARE_K for ECDSA key (esp32h2)
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinKondrashov authored and radimkarnis committed Nov 8, 2023
1 parent 1b350ce commit f607f19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions espefuse/efuse/esp32h2/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,15 @@ def burn_key(esp, efuses, args, digest=None):
if efuses[block.key_purpose_name].is_writeable():
disable_wr_protect_key_purpose = True

if keypurpose == "ECDSA_KEY":
if efuses["ECDSA_FORCE_USE_HARDWARE_K"].get() == 0:
# For ECDSA key purpose block permanently enable
# the hardware TRNG supplied k mode (most secure mode)
print("\tECDSA_FORCE_USE_HARDWARE_K: 0 -> 1")
efuses["ECDSA_FORCE_USE_HARDWARE_K"].save(1)
else:
print("\tECDSA_FORCE_USE_HARDWARE_K is already '1'")

if disable_wr_protect_key_purpose:
print("\tDisabling write to '%s'." % block.key_purpose_name)
efuses[block.key_purpose_name].disable_write()
Expand Down

0 comments on commit f607f19

Please sign in to comment.