diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index 0362d6bf..54b72e61 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -225,6 +225,26 @@ void futurerestore::loadAPTickets(const vector &apticketPaths){ } } +uint64_t futurerestore::getBasebandGoldCertIDFromDevice(){ + if (!_client->preflight_info){ + normal_get_preflight_info(_client, &_client->preflight_info); + } + plist_t node; + node = plist_dict_get_item(_client->preflight_info, "CertID"); + if (!node || plist_get_node_type(node) != PLIST_UINT) { + error("Unable to find required BbGoldCertId in parameters\n"); + return 0; + } + uint64_t val = 0; + plist_get_uint_val(node, &val); + return val; +} + +const char *futurerestore::getDeviceModelNoCopy(){ + return _client->device->product_type; +} + + int futurerestore::doRestore(const char *ipsw, bool noerase){ int err = 0; //some memory might not get freed if this function throws an exception, but you probably don't want to catch that anyway. diff --git a/futurerestore/futurerestore.hpp b/futurerestore/futurerestore.hpp index 3e1b0147..1454b2b7 100644 --- a/futurerestore/futurerestore.hpp +++ b/futurerestore/futurerestore.hpp @@ -80,6 +80,8 @@ public: const char *sepPath(){return _sepPath;}; const char *basebandPath(){return _basebandPath;}; + uint64_t getBasebandGoldCertIDFromDevice(); + const char *getDeviceModelNoCopy(); int doRestore(const char *ipsw, bool noerase); diff --git a/futurerestore/main.cpp b/futurerestore/main.cpp index 4a3a4568..ff65d63e 100644 --- a/futurerestore/main.cpp +++ b/futurerestore/main.cpp @@ -164,15 +164,20 @@ int main(int argc, const char * argv[]) { client.setBasebandManifestPath(basebandManifestPath); } + devVals.deviceModel = (char*)client.getDeviceModelNoCopy(); versVals.basebandMode = kBasebandModeWithoutBaseband; - if (!(isSepManifestSigned = isManifestSignedForDevice(client.sepManifestPath(), NULL, &devVals, &versVals))){ + if (!(isSepManifestSigned = isManifestSignedForDevice(client.sepManifestPath(), &devVals, &versVals))){ reterror(-3,"sep firmware isn't signed\n"); } versVals.basebandMode = kBasebandModeOnlyBaseband; - if (!(isBasebandSigned = isManifestSignedForDevice(client.basebandManifestPath(), NULL, &devVals, &versVals))){ - reterror(-3,"baseband firmware isn't signed\n"); + if ((devVals.bbgcid = client.getBasebandGoldCertIDFromDevice())){ + if (!(isBasebandSigned = isManifestSignedForDevice(client.basebandManifestPath(), &devVals, &versVals))) { + reterror(-3,"baseband firmware isn't signed\n"); + } + }else{ + reterror(-3,"unable to get bbgcid from device\n"); } client.putDeviceIntoRecovery();