summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-09-26 06:52:30 +0200
committerGravatar Nikias Bassen2019-09-26 06:52:30 +0200
commit83087efe7197dcae77d94a8ff56e1eb70907aa9e (patch)
treef9c8c79831cef679701e07e5abb4d318cbdd8988
parent618969dcfbc331361162289e39960679cb91ef02 (diff)
downloadidevicerestore-83087efe7197dcae77d94a8ff56e1eb70907aa9e.tar.gz
idevicerestore-83087efe7197dcae77d94a8ff56e1eb70907aa9e.tar.bz2
img4: Add new TBMDigests key for stashbag local manifest
-rw-r--r--src/img4.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/img4.c b/src/img4.c
index 06fda7f..c088926 100644
--- a/src/img4.c
+++ b/src/img4.c
@@ -500,7 +500,7 @@ void _manifest_write_component(unsigned char **p, unsigned int *length, const ch
unsigned int inner_length = 0;
asn1_write_element(&inner_start, &inner_length, ASN1_IA5_STRING, (void*)tag, -1);
- unsigned char tmp_[256] = { 0, };
+ unsigned char tmp_[512] = { 0, };
unsigned int tmp_len = 0;
unsigned char *tmp = &tmp_[0];
@@ -542,6 +542,25 @@ void _manifest_write_component(unsigned char **p, unsigned int *length, const ch
_manifest_write_key_value(&tmp, &tmp_len, "ESEC", ASN1_BOOLEAN, &int_bool_val, -1);
}
+ node = plist_dict_get_item(comp, "TBMDigests");
+ if (node) {
+ char *data = NULL;
+ uint64_t datalen = 0;
+ plist_get_data_val(node, &data, &datalen);
+ const char *tbmtag = NULL;
+ if (!strcmp(tag, "sepi")) {
+ tbmtag = "tbms";
+ } else if (!strcmp(tag, "rsep")) {
+ tbmtag = "tbmr";
+ }
+ if (!tbmtag) {
+ error("ERROR: Unexpected TMBDigests for comp '%s'\n", tag);
+ } else {
+ _manifest_write_key_value(&tmp, &tmp_len, tbmtag, ASN1_OCTET_STRING, data, datalen);
+ }
+ free(data);
+ }
+
asn1_write_element_header(ASN1_SET | ASN1_CONSTRUCTED, tmp_len, &inner_start, &inner_length);
memcpy(inner_start, tmp_, tmp_len);
inner_start += tmp_len;