Skip to content

Commit 5f1b376

Browse files
committed
Merge branch 'devel'
2 parents e733383 + 767bcca commit 5f1b376

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

inc/switchtec/switchtec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ struct switchtec_fw_image_info {
239239
void *metadata;
240240

241241
unsigned long secure_version;
242+
bool signed_image;
242243
};
243244

244245
struct switchtec_fw_part_summary {

lib/fw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ static int switchtec_fw_file_info_gen3(int fd,
603603
info->type = switchtec_fw_id_to_type(info);
604604

605605
info->secure_version = 0;
606+
info->signed_image = 0;
606607

607608
return 0;
608609

@@ -616,6 +617,7 @@ static int switchtec_fw_file_info_gen4(int fd,
616617
{
617618
int ret;
618619
struct switchtec_fw_metadata_gen4 hdr = {};
620+
uint8_t exp_zero[4] = {};
619621

620622
ret = read(fd, &hdr, sizeof(hdr));
621623
lseek(fd, 0, SEEK_SET);
@@ -667,6 +669,8 @@ static int switchtec_fw_file_info_gen4(int fd,
667669
info->type = switchtec_fw_id_to_type(info);
668670

669671
info->secure_version = le32toh(hdr.secure_version);
672+
info->signed_image = !!memcmp(hdr.public_key_exponent, exp_zero, 4);
673+
670674
return 0;
671675

672676
invalid_file:
@@ -727,6 +731,9 @@ int switchtec_fw_file_secure_version_newer(struct switchtec_dev *dev,
727731
if (ret)
728732
return 0;
729733

734+
if (!info.signed_image)
735+
return 0;
736+
730737
ret = switchtec_sn_ver_get(dev, &sn_info);
731738
if (ret) {
732739
sn_info.ver_bl2 = 0xffffffff;

0 commit comments

Comments
 (0)