in core/host_fw/host_fw_util.c [251:319]
bool host_fw_are_images_different (const struct pfm_image_list *img_list1,
const struct pfm_image_list *img_list2)
{
size_t i;
if ((img_list1 == NULL) || (img_list2 == NULL)) {
if ((img_list1 == NULL) && (img_list2 == NULL)) {
return false;
}
return true;
}
if (img_list1->count != img_list2->count) {
return true;
}
if ((img_list1->images_sig && img_list2->images_hash) ||
(img_list1->images_hash && img_list2->images_sig)) {
return true;
}
for (i = 0; i < img_list1->count; i++) {
if (img_list1->images_sig) {
if (!rsa_same_public_key (&img_list1->images_sig[i].key,
&img_list2->images_sig[i].key)) {
return true;
}
if ((img_list1->images_sig[i].sig_length != img_list2->images_sig[i].sig_length) ||
(img_list1->images_sig[i].always_validate !=
img_list2->images_sig[i].always_validate)) {
return true;
}
if (buffer_compare (img_list1->images_sig[i].signature,
img_list2->images_sig[i].signature, img_list1->images_sig->sig_length) != 0) {
return true;
}
if (host_fw_are_regions_different (img_list1->images_sig[i].regions,
img_list1->images_sig[i].count, img_list2->images_sig[i].regions,
img_list2->images_sig[i].count)) {
return true;
}
}
else {
if ((img_list1->images_hash[i].hash_length != img_list2->images_hash[i].hash_length) ||
(img_list1->images_hash[i].hash_type != img_list2->images_hash[i].hash_type) ||
(img_list1->images_hash[i].always_validate !=
img_list2->images_hash[i].always_validate)) {
return true;
}
if (buffer_compare (img_list1->images_hash[i].hash, img_list2->images_hash[i].hash,
img_list1->images_hash->hash_length) != 0) {
return true;
}
if (host_fw_are_regions_different (img_list1->images_hash[i].regions,
img_list1->images_hash[i].count, img_list2->images_hash[i].regions,
img_list2->images_hash[i].count)) {
return true;
}
}
}
return false;
}