Skip to content

Commit

Permalink
tss: Revert strict 'Trusted' check and only bail out when not trusted…
Browse files Browse the repository at this point in the history
… and without RestoreRequestRules

The recent change caused TSS requests to be incomplete resulting
in restore failures. This commit should fix that.
  • Loading branch information
nikias committed Jun 12, 2024
1 parent 57e073e commit 9e52f1c
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/tss.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,11 @@ int tss_request_add_ap_recovery_tags(plist_t request, plist_t parameters, plist_
continue;
}

if (!plist_dict_get_bool(manifest_entry, "Trusted")) {
debug("DEBUG: %s: Skipping '%s' as it is not trusted\n", __func__, key);
continue;
}

if (plist_dict_get_bool(parameters, "_OnlyFWComponents")) {
if (!plist_dict_get_bool(manifest_entry, "Trusted")) {
debug("DEBUG: %s: Skipping '%s' as it is not trusted\n", __func__, key);
continue;
}
if (!is_fw_payload(info_dict)) {
debug("DEBUG: %s: Skipping '%s' as it is not a firmware payload\n", __func__, key);
continue;
Expand All @@ -659,7 +658,7 @@ int tss_request_add_ap_recovery_tags(plist_t request, plist_t parameters, plist_
}

/* Make sure we have a Digest key for Trusted items even if empty */
if (!plist_dict_get_item(manifest_entry, "Digest")) {
if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) {
debug("DEBUG: No Digest data, using empty value for entry %s\n", key);
plist_dict_set_item(tss_entry, "Digest", plist_new_data(NULL, 0));
}
Expand Down Expand Up @@ -729,12 +728,18 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid
continue;
}

if (!plist_dict_get_bool(manifest_entry, "Trusted")) {
debug("DEBUG: %s: Skipping '%s' as it is not trusted\n", __func__, key);
continue;
if (plist_dict_get_bool(parameters, "ApSupportsImg4")) {
if (!plist_dict_get_item(info_dict, "RestoreRequestRules") && !plist_dict_get_bool(manifest_entry, "Trusted")) {
debug("DEBUG: %s: Skipping '%s' as it doesn't have RestoreRequestRules and is not Trusted\n", __func__, key);
continue;
}
}

if (plist_dict_get_bool(parameters, "_OnlyFWComponents")) {
if (!plist_dict_get_bool(manifest_entry, "Trusted")) {
debug("DEBUG: %s: Skipping '%s' as it is not trusted\n", __func__, key);
continue;
}
if (!is_fw_payload(info_dict)) {
debug("DEBUG: %s: Skipping '%s' as it is not a firmware payload\n", __func__, key);
continue;
Expand Down Expand Up @@ -764,7 +769,7 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid
}

/* Make sure we have a Digest key for Trusted items even if empty */
if (!plist_dict_get_item(manifest_entry, "Digest")) {
if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) {
debug("DEBUG: No Digest data, using empty value for entry %s\n", key);
plist_dict_set_item(tss_entry, "Digest", plist_new_data(NULL, 0));
}
Expand Down

0 comments on commit 9e52f1c

Please sign in to comment.