diff options
author | Martin Szulecki | 2010-07-09 03:36:18 +0200 |
---|---|---|
committer | Martin Szulecki | 2010-07-09 03:36:18 +0200 |
commit | d1a5f28e6d1a3b7a24e406a215b4037dd68d41c9 (patch) | |
tree | 06218e15290ea324f2237c62e53020053ab9de85 /src | |
parent | b472d5347406fc24e9e489b5493dd6bf134dc92c (diff) | |
download | idevicerestore-d1a5f28e6d1a3b7a24e406a215b4037dd68d41c9.tar.gz idevicerestore-d1a5f28e6d1a3b7a24e406a215b4037dd68d41c9.tar.bz2 |
Implement handling unknown img3 element for 8900 chip devices
Diffstat (limited to 'src')
-rw-r--r-- | src/img3.c | 22 | ||||
-rw-r--r-- | src/img3.h | 4 |
2 files changed, 25 insertions, 1 deletions
@@ -155,6 +155,16 @@ img3_file* img3_parse_file(char* data, int size) { debug("Parsed CERT element\n"); break; + case kUnknElement: + image->unkn_element = img3_parse_element(&data[data_offset]); + if (image->unkn_element == NULL) { + error("ERROR: Unable to parse UNKN element\n"); + img3_free(image); + return NULL; + } + debug("Parsed UNKN element\n"); + break; + default: error("ERROR: Unknown IMG3 element type\n"); img3_free(image); @@ -244,6 +254,11 @@ void img3_free(img3_file* image) { image->cert_element = NULL; } + if (image->unkn_element != NULL) { + img3_free_element(image->unkn_element); + image->unkn_element = NULL; + } + free(image); image = NULL; } @@ -336,6 +351,9 @@ int img3_get_data(img3_file* image, char** pdata, int* psize) { if (image->cert_element != NULL) { size += image->cert_element->header->full_size; } + if (image->unkn_element != NULL) { + size += image->unkn_element->header->full_size; + } char* data = (char*) malloc(size); if (data == NULL) { @@ -393,6 +411,10 @@ int img3_get_data(img3_file* image, char** pdata, int* psize) { memcpy(&data[offset], image->cert_element->data, image->cert_element->header->full_size); offset += image->cert_element->header->full_size; } + if (image->unkn_element != NULL) { + memcpy(&data[offset], image->unkn_element->data, image->unkn_element->header->full_size); + offset += image->unkn_element->header->full_size; + } if (offset != size) { error("ERROR: Incorrectly sized image data\n"); @@ -45,7 +45,8 @@ typedef enum { kVersElement = 0x56455253, // VERS kBordElement = 0x424F5244, // BORD kSepoElement = 0x5345504F, // SEPO - kEcidElement = 0x45434944 // ECID + kEcidElement = 0x45434944, // ECID + kUnknElement = 0x53414c54 // FIXME } img3_element_type; typedef struct { @@ -81,6 +82,7 @@ typedef struct { img3_element* ecid_element; img3_element* shsh_element; img3_element* cert_element; + img3_element* unkn_element; } img3_file; void img3_free(img3_file* image); |