File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -257,13 +257,23 @@ static void jump_into_wolfboot(void)
257257/* The image needs to be already verified */
258258int wolfBoot_image_measure (uint8_t * image )
259259{
260- uint16_t hash_len ;
261- uint8_t * hash ;
260+ struct wolfBoot_image img ;
261+ int ret ;
262262
263- hash_len = wolfBoot_find_header (image + IMAGE_HEADER_OFFSET ,
264- WOLFBOOT_SHA_HDR , & hash );
265- wolfBoot_print_hexstr (hash , hash_len , 0 );
266- return wolfBoot_tpm2_extend (WOLFBOOT_MEASURED_PCR_A , hash , __LINE__ );
263+ memset (& img , 0 , sizeof (img ));
264+ ret = wolfBoot_open_image_address (& img , image );
265+ if (ret != 0 ) {
266+ return ret ;
267+ }
268+
269+ ret = wolfBoot_verify_integrity (& img );
270+ if (ret != 0 || img .sha_hash == NULL ) {
271+ return -1 ;
272+ }
273+
274+ wolfBoot_print_hexstr (img .sha_hash , WOLFBOOT_SHA_DIGEST_SIZE , 0 );
275+ return wolfBoot_tpm2_extend (WOLFBOOT_MEASURED_PCR_A , img .sha_hash ,
276+ __LINE__ );
267277}
268278#endif /* WOLFBOOT_MEASURED_BOOT */
269279
You can’t perform that action at this time.
0 commit comments