summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-05-26 04:11:32 +0200
committerGravatar Nikias Bassen2021-05-26 04:11:32 +0200
commit7f53014c01bbefd7fd485563c002b77fe1c2f239 (patch)
tree5f61d176b9c08f3b43e8c3bb3fd9d507ec24f955
parentd80a9a6b60498d8b7f4f87ec69efd08a7679bf6f (diff)
downloadidevicerestore-7f53014c01bbefd7fd485563c002b77fe1c2f239.tar.gz
idevicerestore-7f53014c01bbefd7fd485563c002b77fe1c2f239.tar.bz2
Remove libuuid dependency
-rw-r--r--configure.ac3
-rw-r--r--src/idevicerestore.c23
-rw-r--r--src/idevicerestore.h1
3 files changed, 15 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 38e24c0..2838ef8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,6 @@ PKG_CHECK_MODULES(libplist, libplist-2.0 >= $LIBPLIST_VERSION)
PKG_CHECK_MODULES(libzip, libzip >= $LIBZIP_VERSION)
PKG_CHECK_MODULES(libcurl, libcurl >= $LIBCURL_VERSION)
PKG_CHECK_MODULES(zlib, zlib)
-PKG_CHECK_MODULES(uuid, uuid)
# optional
PKG_CHECK_MODULES(openssl, openssl >= $OPENSSL_VERSION, have_openssl=yes, have_openssl=no)
@@ -52,7 +51,7 @@ AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])],
GLOBAL_CFLAGS="-Wno-multichar -O2"
AC_LDADD=""
-AC_LDFLAGS="-luuid"
+AC_LDFLAGS=""
AC_MSG_CHECKING([whether we need platform-specific build settings])
case ${host_os} in
*mingw32*|*cygwin*)
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 2ceec6d..e530975 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -2472,7 +2472,7 @@ int get_recovery_os_local_policy_tss_response(
uint8_t digest[SHA384_DIGEST_LENGTH];
SHA384(lpol_file, lpol_file_length, digest);
plist_t lpol = plist_new_dict();
- plist_dict_set_item(lpol, "Digest", plist_new_data(digest, SHA384_DIGEST_LENGTH));
+ plist_dict_set_item(lpol, "Digest", plist_new_data((char*)digest, SHA384_DIGEST_LENGTH));
plist_dict_set_item(lpol, "Trusted", plist_new_bool(1));
plist_dict_set_item(parameters, "Ap,LocalPolicy", lpol);
@@ -2483,16 +2483,21 @@ int get_recovery_os_local_policy_tss_response(
plist_dict_set_item(parameters, "Ap,RecoveryOSPolicyNonceHash", plist_copy(nonce_hash));
plist_t vol_uuid_node = plist_dict_get_item(args, "Ap,VolumeUUID");
- char* vol_uuid_str = malloc(40);
+ char* vol_uuid_str = NULL;
plist_get_string_val(vol_uuid_node, &vol_uuid_str);
- uuid_t vol_uuid;
- int ret = uuid_parse(vol_uuid_str, vol_uuid);
- if (ret != 0) {
- error("failed to parse Ap,VolumeUUID (%s) with code %d\n", vol_uuid_str, ret);
+ unsigned int vuuid[16];
+ unsigned char vol_uuid[16];
+ if (sscanf(vol_uuid_str, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", &vuuid[0], &vuuid[1], &vuuid[2], &vuuid[3], &vuuid[4], &vuuid[5], &vuuid[6], &vuuid[7], &vuuid[8], &vuuid[9], &vuuid[10], &vuuid[11], &vuuid[12], &vuuid[13], &vuuid[14], &vuuid[15]) != 16) {
+ error("ERROR: Failed to parse Ap,VolumeUUID (%s)\n", vol_uuid_str);
+ free(vol_uuid_str);
return -1;
}
free(vol_uuid_str);
- plist_dict_set_item(parameters, "Ap,VolumeUUID", plist_new_data(vol_uuid, 16));
+ int i;
+ for (i = 0; i < 16; i++) {
+ vol_uuid[i] = (unsigned char)vuuid[i];
+ }
+ plist_dict_set_item(parameters, "Ap,VolumeUUID", plist_new_data((char*)vol_uuid, 16));
/* create basic request */
request = tss_request_new(NULL);
@@ -2564,7 +2569,7 @@ int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_
uint8_t digest[SHA384_DIGEST_LENGTH];
SHA384(lpol_file, lpol_file_length, digest);
plist_t lpol = plist_new_dict();
- plist_dict_set_item(lpol, "Digest", plist_new_data(digest, SHA384_DIGEST_LENGTH));
+ plist_dict_set_item(lpol, "Digest", plist_new_data((char*)digest, SHA384_DIGEST_LENGTH));
plist_dict_set_item(lpol, "Trusted", plist_new_bool(1));
plist_dict_set_item(parameters, "Ap,LocalPolicy", lpol);
@@ -2576,7 +2581,7 @@ int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_
// Hash it and add it as Ap,NextStageIM4MHash
uint8_t hash[SHA384_DIGEST_LENGTH];
SHA384(ticket, ticket_length, hash);
- plist_dict_set_item(parameters, "Ap,NextStageIM4MHash", plist_new_data(hash, SHA384_DIGEST_LENGTH));
+ plist_dict_set_item(parameters, "Ap,NextStageIM4MHash", plist_new_data((char*)hash, SHA384_DIGEST_LENGTH));
/* create basic request */
request = tss_request_new(NULL);
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index 3d84c89..c9271a8 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -33,7 +33,6 @@ extern "C" {
#include <plist/plist.h>
#include <libirecovery.h>
#include <openssl/sha.h>
-#include <uuid/uuid.h>
// the flag with value 1 is reserved for internal use only. don't use it.
#define FLAG_DEBUG (1 << 1)