How S32g verify secure boot image

Secure boot refers to a two-stage process of successive authentication of the U-Boot and Linux kernel images. This process requires a "root of trust", which is known to be secure. In this case, the root of trust is HSE itself. Each image is authenticated by the preceding step. Thus, the secure boot flow is the following:

  1. BootROM passes control over to HSE FW;

  2. HSE FW authenticates the U-Boot image;

  3. U-Boot authenticates the Kernel image. U-Boot authentication is currently only supported when booting from an SD card

How uboot gets verified:

To authenticate the U-Boot image, HSE uses Advanced Secure Boot (ASB). The system configuration is saved as a System Image (SYS_IMG), which contains data related to imported keys, Secure Memory Region (SMR) configuration and Core Reset (CR) entry configuration.

  • The SYS_IMG is signed with a device-specific key.

  • The keys used for ASB are stored in a NVM key catalog, which contains multiple slots for multiple key types and authentication schemes.

  • The Secure Memory Region entry is used to define which data needs to be authenticated from the boot media, which key and authentication scheme is required, and where to place the data in memory after authentication.

  • The Core Reset entry is used to define which core should be enabled and what address to jump to after authentication, as well as what action to take in case authentication fails.

The steps to enable secure boot:

1. Read the IVT from the boot media;
2. Configure the HSE NVM and RAM key catalogs if no SYS_IMG;
3. Import the RSA public key into the NVM key catalog;
4. Configure and install the Core Reset entry;
5. Configure and install the Secure Memory Region entry;
6. Generate the signed SYS_IMG and Write the SYS_IMG back onto the boot media;
7. Set the BOOT_SEQ bit and Write the IVT back onto the boot media;
8. reboot board

in uboot, hse_secboot_enable is provided to enable secure boot
do_hse_secboot_enable   (arch/arm/mach-s32/s32-cc/hse_adv_secboot.c)

The boot image signature is located in “tb-fw-cert” entry of the boot image which is read only. the verification RSA public key is copied in boot partition of SD card . Also a certificate can be used to verify the boot image signature. the certificate is signed by the device specific key. In the step 3 of enable secure boot, when the public key is imported to HSM, the device specific key is used to check the authenticate of the certificate.

How S32g uboot authenticate Linux kernel:

Kernel image authentication is provided by U-Boot, using the upstream verified boot method. This method will use an .its file, which defines a dtb/kernel configuration and a signing scheme.

this is a sample its file. the output is an ITB file which should be copied to boot partition of SD card. the signature is embedded in ITB file.

The public key to verify kernel ITB image is attached to the boot loader device tree:

linux kernel authentication steps:

currently uboot provides the RSA verification alog.

This RSA verification is pure software. we can take advantage of HSE on S32g, either use prev-loaded public key or import the public key from device tree and call HSM service to verify the signature.

最后更新于