summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-07-17 16:52:33 +0200
committerGravatar Nikias Bassen2012-07-17 16:52:33 +0200
commit45dc110c6b923a8d9c4e79ab7667a13726c50699 (patch)
tree1120b38f461684bf556918beea7d2675e7968ce0 /src
parent7585007e35ab84750f8ace8e1cc43f6b53c75c38 (diff)
downloadidevicerestore-45dc110c6b923a8d9c4e79ab7667a13726c50699.tar.gz
idevicerestore-45dc110c6b923a8d9c4e79ab7667a13726c50699.tar.bz2
mbn: Correctly calculate offset for signature
Diffstat (limited to 'src')
-rw-r--r--src/mbn.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/mbn.c b/src/mbn.c
index 0e76425..b6bce0b 100644
--- a/src/mbn.c
+++ b/src/mbn.c
@@ -37,7 +37,6 @@ mbn_file* mbn_parse(unsigned char* data, unsigned int 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);
- mbn->parsed_sig_offset = mbn->header.sig_offset - (mbn->header.data_size & 0xFF);
if (mbn->parsed_size != mbn->size) {
printf("size mismatch?!\n");
}
@@ -56,15 +55,11 @@ void mbn_free(mbn_file* mbn)
int mbn_update_sig_blob(mbn_file* mbn, const unsigned char* sigdata, unsigned int siglen)
{
+ mbn->parsed_sig_offset = mbn->parsed_size - siglen;
if (!mbn) {
error("ERROR: %s: no data\n", __func__);
return -1;
}
- if (!mbn->parsed_sig_offset || (mbn->parsed_sig_offset >= mbn->parsed_size)) {
- error("ERROR: %s: invalid signature offset in mbn header\n", __func__);
- return -1;
- }
-
if ((mbn->parsed_sig_offset + siglen) > mbn->parsed_size) {
error("ERROR: %s: signature is larger than mbn file size\n", __func__);
return -1;