8.4.1 ota blob

This commit is contained in:
Dora2 2021-09-06 00:46:54 +09:00
commit fb111571f7
9 changed files with 675 additions and 238 deletions

Binary file not shown.

View file

@ -309,7 +309,7 @@ int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** no
return -1;
}
}
const struct irecv_device_info *device_info = irecv_get_device_info(client->dfu->client);
if (!device_info) {
return -1;

View file

@ -0,0 +1,45 @@
#ifndef DIGEST_H
#define DIGEST_H
// RestoreRamdisk digest
unsigned char s5l8940x_841_rdsk_digest[] = {
0xe9, 0x84, 0xfc, 0x92,
0x66, 0x6d, 0xa3, 0xbe,
0x9b, 0x60, 0x62, 0x1a,
0xa6, 0x93, 0xa4, 0x72,
0xa8, 0x38, 0x82, 0xa8
};
unsigned char s5l8942x_841_rdsk_digest[] = {
0x5b, 0x5b, 0x3d, 0x87,
0x4a, 0x3e, 0x3b, 0x23,
0x66, 0xfa, 0xcd, 0xdf,
0x07, 0x11, 0x50, 0x41,
0x1a, 0x0b, 0x35, 0xb0
};
unsigned char s5l8945x_841_rdsk_digest[] = {
0x88, 0x80, 0x31, 0x85,
0x45, 0xea, 0x56, 0x6c,
0xfe, 0xe3, 0x86, 0x62,
0x3f, 0x4c, 0x10, 0x00,
0xd6, 0x1f, 0x34, 0x8f
};
unsigned char s5l8950x_841_rdsk_digest[] = {
0x22, 0xc7, 0x1e, 0x79,
0x5a, 0x90, 0x08, 0xb0,
0x90, 0x3a, 0xe5, 0x58,
0x59, 0x14, 0x60, 0x87,
0x27, 0x0e, 0x00, 0x4f
};
unsigned char s5l8955x_841_rdsk_digest[] = {
0x74, 0xaa, 0x37, 0x2a,
0x7f, 0x51, 0xf0, 0xf7,
0x91, 0xe4, 0x7e, 0x98,
0x9d, 0xc3, 0xa6, 0x7c,
0x4c, 0x26, 0xf2, 0xe8
};
#endif

View file

@ -52,18 +52,21 @@
#include "locking.h"
#include "ubid_list.h"
#define VERSION_XML "version.xml"
#include <openssl/sha.h>
#ifndef IDEVICERESTORE_NOMAIN
static struct option longopts[] = {
{ "debug", no_argument, NULL, 'd' },
{ "ota", no_argument, NULL, 'o' },
{ "oldota", no_argument, NULL, 'a' },
{ "forcelatestbb", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "rerestore", no_argument, NULL, 'r' },
{ "debug", no_argument, NULL, 'd' },
{ "ota-bbfw", no_argument, NULL, 'o' },
{ "old-ota-bbfw", no_argument, NULL, 'a' },
{ "force-latest-bbfw", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "rerestore", no_argument, NULL, 'r' },
{ "ota-blob", no_argument, NULL, 'b' },
//{ "baseband", required_argument, NULL, 'b' },
//{ "manifest", required_argument, NULL, 'm' },
{ NULL, 0, NULL, 0 }
@ -72,13 +75,14 @@ static struct option longopts[] = {
void usage(int argc, char* argv[]) {
char* name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS] IPSW\n\n", (name ? name + 1 : argv[0]));
printf(" -r, --rerestore\ttake advantage of the 9.x 32 bit re-restore bug\n");
printf(" -r, --rerestore\t\ttake advantage of the 9.x 32 bit re-restore bug\n");
//printf(" -b, --baseband\tspecify baseband to use instead of the latest OTA baseband\n");
//printf(" -m, --manifest\tspecify manifest to use with the specified baseband\n");
printf(" -o, --ota\t\tuse 8.4.1 OTA baseband for 32-bit devices (except iPhone 5c)\n");
printf(" -a, --oldota\t\tuse 6.1.3 OTA baseband for A5 (s5l8940x) devices\n");
printf(" -f, --forcelatestbb\tuse the latest baseband provided for Qualcomm MDM9615M (Mav7Mav8) baseband chip. [dangerous]\n");
printf(" -d, --debug\t\tprint debug information\n");
printf(" -b, --ota-blob\t\tuse 8.4.1 OTA SHSH blob for 32 bit devices and restore with custom firmware. (Except for iPhone 5c).\n");
printf(" -o, --ota-bbfw\t\tuse 8.4.1 OTA baseband for 32-bit devices (except iPhone 5c)\n");
printf(" -a, --old-ota-bbfw\t\tuse 6.1.3 OTA baseband for A5 (s5l8940x) devices\n");
printf(" -f, --force-latest-bbfw\tuse the latest baseband provided for Qualcomm MDM9615M (Mav7Mav8) baseband chip. [dangerous]\n");
printf(" -d, --debug\t\t\tprint debug information\n");
printf("\n");
printf("Homepage: https://downgrade.party\n");
printf("Based on idevicerestore by libimobiledevice.\n");
@ -141,6 +145,137 @@ static const char *phoenix_712_path = "Firmware/Phoenix-3.0.04.Release.bbfw";
static int idevicerestore_keep_pers = 0;
static void get_ubid(const char* product, unsigned char** data, size_t* size) {
// s5l8940x
if (!strcmp(product, "iPhone4,1")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, n94_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad2,1")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, k93_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad2,2")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, k94_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad2,3")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, k95_841_ubid, *size);
return;
}
// s5l8942x
if (!strcmp(product, "iPad2,4")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, k93a_841_ubid, *size);
return;
}
if (!strcmp(product, "iPod5,1")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, n78_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad2,5")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, p105_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad2,6")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, p106_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad2,7")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, p107_841_ubid, *size);
return;
}
// s5l8945x
if (!strcmp(product, "iPad3,1")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, j1_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad3,2")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, j2_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad3,3")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, j2a_841_ubid, *size);
return;
}
// s5l8950x
if (!strcmp(product, "iPhone5,1")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, n41_841_ubid, *size);
return;
}
if (!strcmp(product, "iPhone5,2")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, n42_841_ubid, *size);
return;
}
//s5l8955x
if (!strcmp(product, "iPad3,4")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, p101_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad3,5")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, p102_841_ubid, *size);
return;
}
if (!strcmp(product, "iPad3,6")) {
*size = 20;
*data = malloc(*size);
memcpy(*data, p103_841_ubid, *size);
return;
}
return;
}
static int load_version_data(struct idevicerestore_client_t* client)
{
if (!client) {
@ -2080,7 +2215,7 @@ int main(int argc, char* argv[]) {
}
//while ((opt = getopt_long(argc, argv, "dhofcersxtplui:nC:k:b:m:", longopts, &optindex)) > 0) {
while ((opt = getopt_long(argc, argv, "dhofacersxtplui:nC:k:", longopts, &optindex)) > 0) {
while ((opt = getopt_long(argc, argv, "dhbofacersxtplui:nC:k:", longopts, &optindex)) > 0) {
switch (opt) {
case 'h':
usage(argc, argv);
@ -2091,6 +2226,10 @@ int main(int argc, char* argv[]) {
break;
/* beta */
case 'b':
client->flags |= FLAG_OTA_BLOB;
break;
case 'o':
client->flags |= FLAG_OTA_BBFW;
break;
@ -2530,6 +2669,10 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident
info("Using local SHSH\n");
return 0;
}
else if ((client->flags & FLAG_RERESTORE) &&
(client->flags & FLAG_OTA_BLOB)) {
info("Trying to fetch new OTA SHSH blob\n");
}
else if (client->flags & FLAG_RERESTORE) {
info("Attempting to check Cydia TSS server for SHSH blobs\n");
client->tss_url = strdup("http://cydia.saurik.com/TSS/controller?action=2");
@ -2563,6 +2706,22 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident
tss_parameters_add_from_manifest(parameters, build_identity);
if (client->flags & FLAG_OTA_BLOB) {
info("Trying to create request for OTA SHSH blob\n");
plist_dict_remove_item(parameters, "UniqueBuildID");
unsigned char* ubid;
size_t ubid_size=0;
get_ubid(client->device->product_type, &ubid, &ubid_size);
if (ubid_size != 0){
plist_dict_set_item(parameters, "UniqueBuildID", plist_new_data((const char*)ubid, ubid_size));
} else {
error("ERROR: Unable to find UniqueBuildID node for OTA SHSH blob\n");
plist_free(parameters);
return -1;
}
}
/* create basic request */
request = tss_request_new(NULL);
if (request == NULL) {
@ -2580,7 +2739,7 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident
}
/* add tags from manifest */
if (tss_request_add_ap_tags(request, parameters, NULL) < 0) {
if (tss_request_add_ap_tags(request, parameters, NULL, client) < 0) {
error("ERROR: Unable to add common tags to TSS request\n");
plist_free(request);
plist_free(parameters);

View file

@ -46,6 +46,7 @@ extern "C" {
#define FLAG_OTA_BBFW 1 << 11
#define FLAG_UNOFFICIAL_BBFW 1 << 12
#define FLAG_OLD_OTA_BBFW 1 << 13
#define FLAG_OTA_BLOB 1 << 14
struct idevicerestore_client_t;

View file

@ -1982,230 +1982,230 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_
}
} else if (!strcmp(client->device->product_type, "iPhone4,1")) {
/*
device_name : iPhone 4s
product_type : iPhone4,1
Baseband : Trek
signed fw : 9.3.6
signed otafw : 6.1.3, 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
partialzip_download_file(n94_613_fw, trek_613_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(n94_841_fw, trek_841_path, client->basebandPath);
/*
device_name : iPhone 4s
product_type : iPhone4,1
Baseband : Trek
signed fw : 9.3.6
signed otafw : 6.1.3, 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
partialzip_download_file(n94_613_fw, trek_613_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(n94_841_fw, trek_841_path, client->basebandPath);
} else {
partialzip_download_file(n94_fw, trek_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,2")) {
/*
device_name : iPad 2
product_type : iPad2,2
Baseband : ICE3
signed fw : 9.3.5
signed otafw : 6.1.3, 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
partialzip_download_file(k94_613_fw, ice3_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(k94_841_fw, ice3_path, client->basebandPath);
} else {
partialzip_download_file(k94_fw, ice3_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,3")) {
/*
device_name : iPad 2
product_type : iPad2,3
Baseband : Phoenix
signed fw : 9.3.6
signed otafw : 6.1.3, 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
partialzip_download_file(k95_613_fw, phoenix_841_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(k95_841_fw, phoenix_841_path, client->basebandPath);
} else {
partialzip_download_file(k95_fw, phoenix_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,1")) {
/*
device_name : iPhone 5
product_type : iPhone5,1
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(n41_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,2")) {
/*
device_name : iPhone 5
product_type : iPhone5,2
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(n42_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,6")) {
/*
device_name : iPad mini
product_type : iPad2,6
Baseband : Mav5
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p106_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p106_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p106_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,7")) {
/*
device_name : iPad mini
product_type : iPad2,7
Baseband : Mav5
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p107_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p107_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p107_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,2")) {
/*
device_name : iPad 3rd generation
product_type : iPad3,2
Baseband : Mav4
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav4-6.7.00.\n");
partialzip_download_file(j2_fw, mav4_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(j2_841_fw, mav4_841_path, client->basebandPath);
} else {
partialzip_download_file(j2_fw, mav4_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,3")) {
/*
device_name : iPad 3rd generation
product_type : iPad3,3
Baseband : Mav4
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav4-6.7.00.\n");
partialzip_download_file(j3_fw, mav4_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(j3_841_fw, mav4_841_path, client->basebandPath);
} else {
partialzip_download_file(j3_fw, mav4_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,5")) {
/*
device_name : iPad 4th generation
product_type : iPad3,5
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p102_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,6")) {
/*
device_name : iPad 4th generation
product_type : iPad3,6
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p103_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,3")) {
/*
device_name : iPhone 5c
product_type : iPhone5,3
Baseband : Mav7Mav8
signed fw : 10.3.3
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
error("ERROR: 8.4.1 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_UNOFFICIAL_BBFW){
partialzip_download_file(n51_fw, mav7mav8_1254_path, client->basebandPath);
} else {
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,4")) {
/*
device_name : iPhone 5c
product_type : iPhone5,4
Baseband : Mav7Mav8
signed fw : 10.3.3
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
error("ERROR: 8.4.1 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_UNOFFICIAL_BBFW){
partialzip_download_file(n51_fw, mav7mav8_1254_path, client->basebandPath);
} else {
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
}
} else {
partialzip_download_file(n94_fw, trek_path, client->basebandPath);
partialzip_download_file(fwurl, bbfwpath, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,2")) {
/*
device_name : iPad 2
product_type : iPad2,2
Baseband : ICE3
signed fw : 9.3.5
signed otafw : 6.1.3, 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
partialzip_download_file(k94_613_fw, ice3_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(k94_841_fw, ice3_path, client->basebandPath);
} else {
partialzip_download_file(k94_fw, ice3_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,3")) {
/*
device_name : iPad 2
product_type : iPad2,3
Baseband : Phoenix
signed fw : 9.3.6
signed otafw : 6.1.3, 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
partialzip_download_file(k95_613_fw, phoenix_841_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(k95_841_fw, phoenix_841_path, client->basebandPath);
} else {
partialzip_download_file(k95_fw, phoenix_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,1")) {
/*
device_name : iPhone 5
product_type : iPhone5,1
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(n41_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,2")) {
/*
device_name : iPhone 5
product_type : iPhone5,2
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(n42_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(n41n42_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,6")) {
/*
device_name : iPad mini
product_type : iPad2,6
Baseband : Mav5
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p106_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p106_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p106_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad2,7")) {
/*
device_name : iPad mini
product_type : iPad2,7
Baseband : Mav5
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p107_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p107_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p107_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,2")) {
/*
device_name : iPad 3rd generation
product_type : iPad3,2
Baseband : Mav4
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav4-6.7.00.\n");
partialzip_download_file(j2_fw, mav4_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(j2_841_fw, mav4_841_path, client->basebandPath);
} else {
partialzip_download_file(j2_fw, mav4_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,3")) {
/*
device_name : iPad 3rd generation
product_type : iPad3,3
Baseband : Mav4
signed fw : 9.3.6
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav4-6.7.00.\n");
partialzip_download_file(j3_fw, mav4_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(j3_841_fw, mav4_841_path, client->basebandPath);
} else {
partialzip_download_file(j3_fw, mav4_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,5")) {
/*
device_name : iPad 4th generation
product_type : iPad3,5
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p102_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPad3,6")) {
/*
device_name : iPad 4th generation
product_type : iPad3,6
Baseband : Mav5
signed fw : 10.3.4
signed otafw : 8.4.1
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav5-11.80.00.\n");
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
partialzip_download_file(p103_841_fw, mav5_841_path, client->basebandPath);
} else {
partialzip_download_file(p102p103_fw, mav5_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,3")) {
/*
device_name : iPhone 5c
product_type : iPhone5,3
Baseband : Mav7Mav8
signed fw : 10.3.3
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
error("ERROR: 8.4.1 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_UNOFFICIAL_BBFW){
partialzip_download_file(n51_fw, mav7mav8_1254_path, client->basebandPath);
} else {
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
}
} else if (!strcmp(client->device->product_type, "iPhone5,4")) {
/*
device_name : iPhone 5c
product_type : iPhone5,4
Baseband : Mav7Mav8
signed fw : 10.3.3
*/
if (client->flags & FLAG_OLD_OTA_BBFW){
error("ERROR: 6.1.3 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_OTA_BBFW){
error("ERROR: 8.4.1 OTA SHSH is not provided for this device. Download and use Mav7Mav8-7.60.00.\n");
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
} else if (client->flags & FLAG_UNOFFICIAL_BBFW){
partialzip_download_file(n51_fw, mav7mav8_1254_path, client->basebandPath);
} else {
partialzip_download_file(n48n49_fw, mav7mav8_path, client->basebandPath);
}
} else {
partialzip_download_file(fwurl, bbfwpath, client->basebandPath);
}
}
FILE *bb = fopen(client->basebandPath, "r");

View file

@ -32,6 +32,7 @@
#include "img3.h"
#include "common.h"
#include "idevicerestore.h"
#include "digest.h"
#define TSS_CLIENT_VERSION_STRING "libauthinstall-293.1.16"
#define ECID_STRSIZE 0x20
@ -41,6 +42,70 @@ typedef struct {
char* content;
} tss_response;
static void get_rdsk_digest(const char* product, unsigned char** data, size_t* size) {
// s5l8940x
if (!strcmp(product, "iPhone4,1") ||
!strcmp(product, "iPad2,1") ||
!strcmp(product, "iPad2,2") ||
!strcmp(product, "iPad2,3"))
{
*size = 20;
*data = malloc(*size);
memcpy(*data, s5l8940x_841_rdsk_digest, *size);
return;
}
// s5l8942x
if (!strcmp(product, "iPad2,4") ||
!strcmp(product, "iPad5,5") ||
!strcmp(product, "iPad2,6") ||
!strcmp(product, "iPad2,7") ||
!strcmp(product, "iPod5,1"))
{
*size = 20;
*data = malloc(*size);
memcpy(*data, s5l8942x_841_rdsk_digest, *size);
return;
}
// s5l8945x
if (!strcmp(product, "iPad3,1") ||
!strcmp(product, "iPad3,2") ||
!strcmp(product, "iPad3,3"))
{
*size = 20;
*data = malloc(*size);
memcpy(*data, s5l8945x_841_rdsk_digest, *size);
return;
}
// s5l8950x
if (!strcmp(product, "iPhone5,1") ||
!strcmp(product, "iPhone5,2"))
{
*size = 20;
*data = malloc(*size);
memcpy(*data, s5l8950x_841_rdsk_digest, *size);
return;
}
// s5l8955x
if (!strcmp(product, "iPad3,4") ||
!strcmp(product, "iPad3,5") ||
!strcmp(product, "iPad3,6"))
{
*size = 20;
*data = malloc(*size);
memcpy(*data, s5l8955x_841_rdsk_digest, *size);
return;
}
return;
}
char* ecid_to_string(uint64_t ecid) {
char* ecid_string = malloc(ECID_STRSIZE);
memset(ecid_string, '\0', ECID_STRSIZE);
@ -452,7 +517,7 @@ static void tss_entry_apply_restore_request_rules(plist_t tss_entry, plist_t par
}
}
int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrides) {
int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrides, struct idevicerestore_client_t* client) {
/* loop over components from build manifest */
plist_t manifest_node = plist_dict_get_item(parameters, "Manifest");
if (!manifest_node || plist_get_node_type(manifest_node) != PLIST_DICT) {
@ -509,6 +574,26 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid
plist_dict_set_item(tss_entry, "Digest", plist_new_data(NULL, 0));
}
}
if (!strcmp(key, "RestoreRamDisk")) {
if (client->flags & FLAG_OTA_BLOB) {
debug("DEBUG: Found %s\n", key);
if (node && plist_get_node_type(node) == PLIST_BOOLEAN) {
uint8_t trusted;
plist_get_bool_val(node, &trusted);
if(trusted && plist_access_path(manifest_entry, 1, "Digest")){
debug("DEBUG: Add OTA Digest data\n", key);
unsigned char* rdsk_digest;
size_t rdsk_digest_size=0;
get_rdsk_digest(client->device->product_type, &rdsk_digest, &rdsk_digest_size);
if(rdsk_digest != 0) {
plist_dict_remove_item(tss_entry, "Digest");
plist_dict_set_item(tss_entry, "Digest", plist_new_data((const char *)rdsk_digest, rdsk_digest_size));
}
}
}
}
}
/* finally add entry to request */
plist_dict_set_item(request, key, tss_entry);

View file

@ -29,7 +29,8 @@ extern "C" {
#endif
#include <plist/plist.h>
#include <idevicerestore.h>
/* parameters */
int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity);
@ -37,7 +38,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity)
plist_t tss_request_new(plist_t overrides);
int tss_request_add_common_tags(plist_t request, plist_t parameters, plist_t overrides);
int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrides);
int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrides, struct idevicerestore_client_t* client);
int tss_request_add_baseband_tags(plist_t request, plist_t parameters, plist_t overrides);
int tss_request_add_se_tags(plist_t request, plist_t parameters, plist_t overrides);

View file

@ -0,0 +1,146 @@
#ifndef UBID_LIST_H
#define UBID_LIST_H
// UniqueBuildID
// s5l8940x
unsigned char n94_841_ubid[] = {
0x78, 0xc3, 0x14, 0x68,
0x5a, 0x7e, 0xa2, 0xdf,
0x8e, 0x30, 0x86, 0x47,
0x0b, 0x3a, 0xf0, 0xad,
0x4f, 0x39, 0x5b, 0xad
};
unsigned char k93_841_ubid[] = {
0xb0, 0x0e, 0x40, 0xa6,
0xfd, 0xc3, 0x90, 0xb6,
0x2e, 0xac, 0xcb, 0x1e,
0x7f, 0x1c, 0x20, 0x73,
0x61, 0x78, 0x7b, 0x0c
};
unsigned char k94_841_ubid[] = {
0x43, 0x94, 0xd1, 0xe8,
0x01, 0x49, 0x02, 0x3c,
0x7f, 0xd0, 0xfb, 0xd8,
0x79, 0x36, 0x27, 0x52,
0xb4, 0xb9, 0x07, 0xf4
};
unsigned char k95_841_ubid[] = {
0xa4, 0x32, 0x81, 0xc2,
0x6d, 0x66, 0xeb, 0x2c,
0xf6, 0xf9, 0xfa, 0x8f,
0xbe, 0xaa, 0x7d, 0x6c,
0x36, 0x01, 0xa5, 0xa5
};
// s5l8942x
unsigned char k93a_841_ubid[] = {
0x90, 0x39, 0x82, 0x7d,
0x37, 0x04, 0x60, 0x7e,
0x01, 0xcb, 0xc4, 0xcd,
0x52, 0x11, 0x7c, 0x1c,
0x1b, 0x1c, 0x2f, 0xb1
};
unsigned char n78_841_ubid[] = {
0x84, 0xa0, 0xb5, 0x64,
0xd5, 0xdd, 0x55, 0xdf,
0x24, 0xb6, 0x2d, 0x70,
0xd9, 0x69, 0x69, 0x0b,
0x8b, 0x06, 0xdb, 0xc7
};
unsigned char p105_841_ubid[] = {
0x14, 0x9f, 0xfb, 0x70,
0x61, 0xa1, 0x6c, 0x9d,
0x35, 0x9b, 0xa7, 0xc0,
0x02, 0x91, 0x92, 0x4c,
0x6d, 0xb9, 0x57, 0xda
};
unsigned char p106_841_ubid[] = {
0xcf, 0x89, 0x06, 0xa8,
0xa6, 0xb6, 0xb9, 0x66,
0x4d, 0xfb, 0x0f, 0x5e,
0x44, 0x5f, 0x9b, 0x02,
0xb3, 0x95, 0xa4, 0x22
};
unsigned char p107_841_ubid[] = {
0xea, 0x4e, 0x9a, 0x78,
0x92, 0x7a, 0x6e, 0x95,
0xd9, 0x5b, 0xe3, 0xf7,
0xa7, 0x53, 0xe6, 0xcb,
0xd3, 0x6d, 0xb6, 0xe3
};
// s5l8945x
unsigned char j1_841_ubid[] = {
0x45, 0xbc, 0xc0, 0x5d,
0xe1, 0x60, 0x36, 0xaf,
0xd8, 0x62, 0x29, 0x8b,
0xf2, 0xfe, 0xcb, 0xeb,
0x13, 0xef, 0x23, 0x64
};
unsigned char j2_841_ubid[] = {
0xb3, 0xdb, 0x7e, 0x36,
0x0a, 0xec, 0xe4, 0x5d,
0xc6, 0xc3, 0x47, 0x6f,
0x83, 0x87, 0x15, 0xbe,
0x08, 0x05, 0x3f, 0xc9
};
unsigned char j2a_841_ubid[] = {
0xe0, 0x14, 0x4c, 0xd9,
0xa3, 0x7d, 0x2f, 0x96,
0x41, 0x28, 0x94, 0x66,
0x4a, 0xea, 0xff, 0x2c,
0x74, 0x9e, 0x6f, 0x04
};
// s5l8950x
unsigned char n41_841_ubid[] = {
0x3a, 0xb8, 0x69, 0xb7,
0x56, 0x56, 0x83, 0x0d,
0xb5, 0x5b, 0xf8, 0xdf,
0xd4, 0x08, 0xcd, 0x32,
0x2b, 0x8c, 0x71, 0xfb
};
unsigned char n42_841_ubid[] = {
0xc9, 0xb1, 0xc4, 0xa3,
0x71, 0x6f, 0xd3, 0x2f,
0xfa, 0x21, 0x8a, 0x74,
0x5f, 0x8e, 0x61, 0xc6,
0xa0, 0xd8, 0xef, 0x33
};
// s5l8955x
unsigned char p101_841_ubid[] = {
0x70, 0x09, 0x37, 0x15,
0x99, 0x38, 0xd3, 0xc8,
0xb0, 0xe4, 0x83, 0x22,
0x48, 0x0b, 0xe3, 0xdb,
0x58, 0x51, 0x65, 0x61
};
unsigned char p102_841_ubid[] = {
0x28, 0x86, 0xd8, 0x80,
0xd1, 0x8f, 0xee, 0xa3,
0xde, 0xe1, 0xcb, 0xf2,
0x25, 0xb9, 0x57, 0x7a,
0xf4, 0xa5, 0x46, 0x3b
};
unsigned char p103_841_ubid[] = {
0x02, 0xaf, 0xd3, 0x33,
0xdf, 0x9f, 0xcd, 0xf0,
0xa1, 0x4f, 0x21, 0xc8,
0xde, 0x8b, 0x2d, 0x73,
0x54, 0x46, 0x1a, 0x41
};
#endif