summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2024-06-16 15:53:29 +0200
committerGravatar Nikias Bassen2024-06-16 18:49:32 +0200
commit10cd5f7f0fe14fbf51f2142ea2df153da33d1a21 (patch)
tree2b445205092457cfecddd3e3a3396009d0f6c29a /src/ipsw.c
parent4e95bd957981ba6bb1fc56d5f0f9781ed9fa8123 (diff)
downloadidevicerestore-10cd5f7f0fe14fbf51f2142ea2df153da33d1a21.tar.gz
idevicerestore-10cd5f7f0fe14fbf51f2142ea2df153da33d1a21.tar.bz2
Remove OpenSSL dependency in favor of libimobiledevice-glue's hash functions
This also removes the sha1/sha384 code from this repository since we are using the ones from libimobiledevice-glue now.
Diffstat (limited to 'src/ipsw.c')
-rw-r--r--src/ipsw.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/ipsw.c b/src/ipsw.c
index c25f61d..6a747f4 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -34,16 +34,8 @@
#include <sys/types.h>
#include <dirent.h>
#include <zip.h>
-#ifdef HAVE_OPENSSL
-#include <openssl/sha.h>
-#else
-#include "sha1.h"
-#define SHA_CTX SHA1_CTX
-#define SHA1_Init SHA1Init
-#define SHA1_Update SHA1Update
-#define SHA1_Final SHA1Final
-#endif
+#include <libimobiledevice-glue/sha.h>
#include <libimobiledevice-glue/termcolors.h>
#include <plist/plist.h>
@@ -1176,14 +1168,14 @@ static int sha1_verify_fp(FILE* f, unsigned char* expected_sha1)
unsigned char tsha1[20];
char buf[8192];
if (!f) return 0;
- SHA_CTX sha1ctx;
- SHA1_Init(&sha1ctx);
+ sha1_context sha1ctx;
+ sha1_init(&sha1ctx);
rewind(f);
while (!feof(f)) {
size_t sz = fread(buf, 1, 8192, f);
- SHA1_Update(&sha1ctx, (const void*)buf, sz);
+ sha1_update(&sha1ctx, buf, sz);
}
- SHA1_Final(tsha1, &sha1ctx);
+ sha1_final(&sha1ctx, tsha1);
return (memcmp(expected_sha1, tsha1, 20) == 0) ? 1 : 0;
}