summaryrefslogtreecommitdiffstats
path: root/src/mbn.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-07-08 20:49:53 +0200
committerGravatar Nikias Bassen2016-07-08 20:49:53 +0200
commit2f92d5555302a00a5a10154d8413235888d27c7f (patch)
treee4f352614f4561ab6b3cd9db8de5b095c6dfcc6f /src/mbn.c
parentf91ea09c159af4d4e9e3cec33b397b44dc245d79 (diff)
downloadidevicerestore-2f92d5555302a00a5a10154d8413235888d27c7f.tar.gz
idevicerestore-2f92d5555302a00a5a10154d8413235888d27c7f.tar.bz2
mbn: Updated file parsing to newer file version to suppresss warning
Note: the parsed data is not actually used. The personalization just involves replacing the last N bytes of the file with the blob data (of size N) returned by the signing server. However this at least suppresses a warning message and helps identifying newer format versions.
Diffstat (limited to 'src/mbn.c')
-rw-r--r--src/mbn.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mbn.c b/src/mbn.c
index a01e3cb..a4f514e 100644
--- a/src/mbn.c
+++ b/src/mbn.c
@@ -36,10 +36,17 @@ mbn_file* mbn_parse(unsigned char* data, unsigned int size)
mbn->size = size;
memcpy(mbn->data, data, size);
/* FIXME: header parsing is not big endian safe */
- memcpy(&mbn->header, data, sizeof(mbn_header));
- mbn->parsed_size = mbn->header.data_size + sizeof(mbn_header);
+ if (memcmp(data, MBN_V2_MAGIC, MBN_V2_MAGIC_SIZE) == 0) {
+ mbn->version = 2;
+ memcpy(&mbn->header.v2, data, sizeof(mbn_header_v2));
+ mbn->parsed_size = mbn->header.v2.data_size + sizeof(mbn_header_v2);
+ } else if (memcmp(data, MBN_V1_MAGIC, MBN_V1_MAGIC_SIZE) == 0) {
+ mbn->version = 1;
+ memcpy(&mbn->header.v1, data, sizeof(mbn_header_v1));
+ mbn->parsed_size = mbn->header.v1.data_size + sizeof(mbn_header_v1);
+ }
if (mbn->parsed_size != mbn->size) {
- debug("WARNING: size mismatch when parsing MBN file.\n");
+ info("WARNING: size mismatch when parsing MBN file. Continuing anyway.\n");
}
return mbn;
}