From 89c07747d0396b92c83af8736ff49ef8c09bc176 Mon Sep 17 00:00:00 2001 From: Lionel Debieve Date: Wed, 5 Oct 2022 16:31:28 +0200 Subject: [PATCH] feat(stm32mp1): update ROM code API for header v2 management Add the new definition field for authentication used in header V2 on STM32MP13. Change-Id: Id8f0c2584ca9b74b0d21d82c9a98d286500548c4 Signed-off-by: Lionel Debieve --- plat/st/stm32mp1/include/boot_api.h | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/plat/st/stm32mp1/include/boot_api.h b/plat/st/stm32mp1/include/boot_api.h index 0d397bdc0..1054609a1 100644 --- a/plat/st/stm32mp1/include/boot_api.h +++ b/plat/st/stm32mp1/include/boot_api.h @@ -333,6 +333,8 @@ typedef struct { uint32_t binary_type; /* Pad up to 128 byte total size */ uint8_t pad[16]; + /* Followed by extension header */ + uint8_t ext_header[]; #endif #if STM32MP15 /* @@ -363,4 +365,45 @@ typedef struct { #endif } __packed boot_api_image_header_t; +typedef uint8_t boot_api_sha256_t[BOOT_API_SHA256_DIGEST_SIZE_IN_BYTES]; + +typedef struct { + /* Extension header type: + * BOOT_API_FSBL_DECRYPTION_HEADER_MAGIC_NB or + * BOOT_API_AUTHENTICATION_HEADER_MAGIC_NB + * BOOT_API_PADDING_HEADER_MAGIC_NB + */ + uint32_t type; + /* Extension header len in byte */ + uint32_t len; + /* parameters of this extension */ + uint8_t params[]; +} __packed boot_extension_header_t; + +typedef struct { + /* Idx of ECDSA public key to be used in table */ + uint32_t pk_idx; + /* Number of ECDSA public key in table */ + uint32_t nb_pk; + /* + * Type of ECC algorithm to use : + * value 1 : for P-256 NIST algorithm + * value 2 : for Brainpool 256 algorithm + * See definitions 'BOOT_API_ECDSA_ALGO_TYPE_XXX' above. + */ + uint32_t ecc_algo_type; + /* ECDSA public key to be used to check signature. */ + uint8_t ecc_pubk[BOOT_API_ECDSA_PUB_KEY_LEN_IN_BYTES]; + /* table of Hash of Algo+ECDSA public key */ + boot_api_sha256_t pk_hashes[]; +} __packed boot_ext_header_params_authentication_t; + +typedef struct { + /* Size of encryption key (128 or 256) */ + uint32_t key_size; + uint32_t derivation_cont; + /* 128 msb bits of plain payload SHA256 */ + uint32_t hash[4]; +} __packed boot_ext_header_params_encrypted_fsbl_t; + #endif /* BOOT_API_H */ -- 2.39.5