Skip to content

espefuse burn_key doesn't get saved in virtual mode (ESPTOOL-1094) #1099

@j4k0xb

Description

@j4k0xb

Operating System

Manjaro Linux

Esptool Version

v4.9.0

Python Version

Python 3.13.3

Full Esptool Command Line that Was Run

espefuse.py --chip esp32s3 --do-not-confirm --debug --virt --path-efuse-file build/qemu_efuse.bin burn_key --show-sensitive-info BLOCK_KEY0 flash_encryption_key.bin XTS_AES_128_KEY

Esptool Output

espefuse.py v4.9.0
BLOCK0          (                ) [0 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000
MAC_SPI_8M_0    (BLOCK1          ) [1 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_SYS_DATA  (BLOCK2          ) [2 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_USR_DATA  (BLOCK3          ) [3 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY0      (BLOCK4          ) [4 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY1      (BLOCK5          ) [5 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY2      (BLOCK6          ) [6 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY3      (BLOCK7          ) [7 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY4      (BLOCK8          ) [8 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY5      (BLOCK9          ) [9 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_SYS_DATA2 (BLOCK10         ) [10] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

BLOCK0          (                ) [0 ] err__regs: 00000000 00000000 00000000 00000000 00000000 00000000
EFUSE_RD_RS_ERR0_REG        0x00000000
EFUSE_RD_RS_ERR1_REG        0x00000000

=== Run "burn_key" command ===
Burn keys to blocks:
 - BLOCK_KEY0 -> [39 ff 18 c0 94 26 18 8f f7 ae 3a 7f fc 1b 7c 83 be 7e 2a 84 a6 02 dd 83 ae 2e f7 c8 d1 13 48 46]
        Reversing byte order for AES-XTS hardware peripheral
        'KEY_PURPOSE_0': 'USER' -> 'XTS_AES_128_KEY'.
        Disabling write to 'KEY_PURPOSE_0'.
        Disabling read to key block
        Disabling write to key block


Check all blocks for burn...
idx, BLOCK_NAME,          Conclusion
[00] BLOCK0               is empty, will burn the new value
[01] MAC_SPI_8M_0         nothing to burn
[02] BLOCK_SYS_DATA       nothing to burn
[03] BLOCK_USR_DATA       nothing to burn
[04] BLOCK_KEY0           is empty, will burn the new value
[05] BLOCK_KEY1           nothing to burn
[06] BLOCK_KEY2           nothing to burn
[07] BLOCK_KEY3           nothing to burn
[08] BLOCK_KEY4           nothing to burn
[09] BLOCK_KEY5           nothing to burn
[10] BLOCK_SYS_DATA2      nothing to burn
. 
This is an irreversible operation!
BLOCK_KEY0      (BLOCK4          ) [4 ] to_write: c018ff39 8f182694 7f3aaef7 837c1bfc 842a7ebe 83dd02a6 c8f72eae 464813d1
Write data to BLOCK4
Addr 0x60007000, data=0xc018ff39
Addr 0x60007004, data=0x8f182694
Addr 0x60007008, data=0x7f3aaef7
Addr 0x6000700c, data=0x837c1bfc
Addr 0x60007010, data=0x842a7ebe
Addr 0x60007014, data=0x83dd02a6
Addr 0x60007018, data=0xc8f72eae
Addr 0x6000701c, data=0x464813d1
Addr 0x60007020, data=0x19731ec4
Addr 0x60007024, data=0x75c2c852
Addr 0x60007028, data=0x4ebeee5b
BLOCK_KEY0 4ebeee5b75c2c85219731ec4464813d1c8f72eae83dd02a6842a7ebe837c1bfc7f3aaef78f182694c018ff39
BLOCK_KEY0      (BLOCK4          ) [4 ] read_regs: c018ff39 8f182694 7f3aaef7 837c1bfc 842a7ebe 83dd02a6 c8f72eae 464813d1
BURN BLOCK4  - OK (write block == read block)
BLOCK0          (                ) [0 ] to_write: 00800100 00000001 04000000 00000000 00000000 00000000
Write data to BLOCK0
Addr 0x60007000, data=0x00800100
Addr 0x60007004, data=0x00000001
Addr 0x60007008, data=0x04000000
Addr 0x6000700c, data=0x00000000
Addr 0x60007010, data=0x00000000
Addr 0x60007014, data=0x00000000
Addr 0x60007018, data=0x00000000
Addr 0x6000701c, data=0x00000000
BLOCK0 0000000000000000000000000000000000000000040000000000000100800100
BLOCK0          (                ) [0 ] read_regs: 00800100 00000001 04000000 00000000 00000000 00000000
BURN BLOCK0  - OK (write block == read block)
Reading updated efuses...
BLOCK0          (                ) [0 ] read_regs: 00800100 00000001 04000000 00000000 00000000 00000000
MAC_SPI_8M_0    (BLOCK1          ) [1 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_SYS_DATA  (BLOCK2          ) [2 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_USR_DATA  (BLOCK3          ) [3 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY0      (BLOCK4          ) [4 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY1      (BLOCK5          ) [5 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY2      (BLOCK6          ) [6 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY3      (BLOCK7          ) [7 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY4      (BLOCK8          ) [8 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_KEY5      (BLOCK9          ) [9 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK_SYS_DATA2 (BLOCK10         ) [10] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Successful

What is the Expected Behaviour?

Save key to BLOCK_KEY0

More Information

With --no-read-protect it gets saved but qemu_efuse.bin size will also be truncated to 512 bytes.

Other Steps to Reproduce

  • Created key with espsecure.py generate_flash_encryption_key flash_encryption_key.bin
  • Created empty efuses file with dd if=/dev/zero bs=1K count=1 of=build/qemu_efuse.bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions