Hi,
I'm implementing HAB for a custom imx6ull (512MB nand) based board. I first tried to use cst version 3.1.0, but it failed to boot after I added the CSF block to the u-boot image. Then I upgraded to version 3.3.2 and tried to reuse the keys generated previously and with the CSF block it produced the board does boot but still fails with many HAB events. I tried burning the SRK fuses, but it did not help so I created new keys with cst 3.3.2.
My CSF text file:
[Header]
Version = 4.2
Hash Algorithm = sha256
Engine = ANY
Engine Configuration = 0
Certificate Format = X509
Signature Format = CMS
[Install SRK]
File = "../crts/srk_1_2_3_4_table.bin"
Source index = 0
[Install CSFK]
File = "../crts/CSF1_1_sha256_2048_65537_v3_usr_crt.pem"
[Authenticate CSF]
[Install Key]
Verification index = 0
Target index = 2
File = "../crts/IMG1_1_sha256_2048_65537_v3_usr_crt.pem"
[Authenticate Data]
Verification index = 2
Blocks = 0x877ff400 0x00000000 0x000a6c00 "/tmp/cst_CODE_SIGN/u-boot.imx"
----END CSF TEXT---
HAB events when using old keys with cst 3.3.2 (SRK Hash burned to these keys)
Event |0xdb|0x0014|0x42| SRCE Field: 33 18 c0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_SIGNATURE (0x18)
| | | | CTX = HAB_CTX_COMMAND (0xC0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Cmd Field: 0xca000c00
| | | | CMD: HAB_CMD_AUT_DAT (0xca)
| | | | LEN: 0x000c
| | | | FLG: 0x00
| | | | FLAGS: AUT_DAT_CLR (0x00)
| | | | KPEC Field: 0x01c50000
| | | | KEY: 0x01
| | | | PCL: HAB_PCL_CMS (0xC5)
| | | | Sig. Start: 0x00000d34
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 7f f4 00 00 00 00 20
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 7f f4 2c 00 00 01 d8
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 7f f4 20 00 00 00 01
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 80 00 00 00 00 00 04
HAB events when using new keys (wrong SRK Hash):
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 7f f4 00 00 00 00 20
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 7f f4 2c 00 00 01 d8
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 7f f4 20 00 00 00 01
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 0c a0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_ASSERTION (0x0C)
| | | | CTX = HAB_CTX_ASSERT (0xA0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Evt Data (hex):
| | | | 00 00 00 00 87 80 00 00 00 00 00 04
------------+----+------+----+-------------------------------------------------
Event |0xdb|0x0014|0x42| SRCE Field: 33 21 c0 00
| | | | STS = HAB_FAILURE (0x33)
| | | | RSN = HAB_INV_CERTIFICATE (0x21)
| | | | CTX = HAB_CTX_COMMAND (0xC0)
| | | | ENG = HAB_ENG_ANY (0x00)
| | | | Cmd Field: 0xbe000c00
| | | | CMD: HAB_CMD_INS_KEY (0xbe)
| | | | LEN: 0x000c
| | | | FLG: 0x03
| | | | FLAGS: NOTHING YET
| | | | PAST Field: 0x03170000
| | | | Crt. addr: 0x00000048
I noticed that the HAB_INV_SIGNATURE event was not present and HAB_INV_CERTIFICATE event was added.
Am I correct in thinking that this means that the signature was correctly read by the device, but SRK Hash check has failed (as expected since the SRK fuses had wrong value)?
EDIT:
IVT of the uboot image
0 = 0x402000d1
1 = 0x87800000
2 = 0x00000000
3 = 0x877ff42c
4 = 0x877ff420
5 = 0x877ff400
6 = 0x878a6000
7 = 0x00000000
I've tried with another device with updated SRK hash, and still there are errors. So something is not right with this setup.
I used 'fuse prog 3 <n> <HASHWORD_n>' command for each of the 8 hash words to burn the SRK hash. Is this correct for imx6ull?
Also, in my final u-boot-nand.imx the IVT starts at 0x400 and the CSF starts at 0xa7000, which is 0x400 + 0xa6c00 (the length of the image). Is this correct?