now verifying APTicket signature prior to attempting to restore

This commit is contained in:
tihmstar 2017-03-23 12:25:53 +01:00
parent 5d2f24dd19
commit 36be0769f2
3 changed files with 13 additions and 9 deletions

2
external/img4tool vendored

@ -1 +1 @@
Subproject commit 17060e500a853a9b4ed860f246d3aa0a90258e31
Subproject commit 8b32c5ce738564bae01f08ff9285e5b3ed8a51f1

View file

@ -459,12 +459,12 @@
LIBRARY_SEARCH_PATHS = (
/usr/local/lib,
/usr/lib,
/usr/local/opt/openssl/lib,
"$(SDKROOT)/usr/lib/system",
/opt/local/lib,
);
OTHER_CFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "/usr/local/include /opt/local/include";
USER_HEADER_SEARCH_PATHS = "/usr/local/opt/openssl/include /usr/local/include";
};
name = Debug;
};
@ -476,12 +476,12 @@
LIBRARY_SEARCH_PATHS = (
/usr/local/lib,
/usr/lib,
/usr/local/opt/openssl/lib,
"$(SDKROOT)/usr/lib/system",
/opt/local/lib,
);
OTHER_CFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "/usr/local/include /opt/local/include";
USER_HEADER_SEARCH_PATHS = "/usr/local/opt/openssl/include /usr/local/include";
};
name = Release;
};

View file

@ -347,7 +347,7 @@ int futurerestore::doRestore(const char *ipsw, bool noerase){
//TODO: make this nicer!
//for now a simple pointercompare should be fine, because both plist_t should point into the same buildidentity inside the buildmanifest
if (ticketIdentity != build_identity){
if (ticketIdentity != build_identity ){
error("BuildIdentity selected for restore does not match APTicket\n\n");
printf("BuildIdentity selected for restore:\n");
printGeneralBuildIdentityInformation(build_identity);
@ -360,6 +360,10 @@ int futurerestore::doRestore(const char *ipsw, bool noerase){
}
reterror(-44, "APTicket can't be used for this restore\n");
}else{
if (verifyIM4MSignature(nonceMatchesIM4Ms())){
printf("IM4M signature is not valid!\n");
reterror(-44, "APTicket can't be used for this restore\n");
}
printf("Verified APTicket to be valid for this restore\n");
}
@ -727,9 +731,9 @@ inline void futurerestore::saveStringToFile(const char *str, const char *path){
char *futurerestore::getNonceFromIM4M(const char* im4m, size_t *nonceSize){
char *ret = NULL;
t_asn1Tag *mainSet = NULL;
t_asn1Tag *manbSet = NULL;
t_asn1Tag *manpSet = NULL;
char *mainSet = NULL;
char *manbSet = NULL;
char *manpSet = NULL;
char *nonceOctet = NULL;
char *bnch = NULL;
char *manb = NULL;