summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar tihmstar2023-11-15 00:14:43 +0100
committerGravatar Nikias Bassen2023-11-15 00:14:43 +0100
commit85ea3378255cc15e3f39365018f45a42d7469375 (patch)
tree2fee78efd3501c13956ef7b1a00b9ecdcb587bb3 /src
parent10c15d596eb54c9b97cd7e6323ac8416349ca225 (diff)
downloadidevicerestore-85ea3378255cc15e3f39365018f45a42d7469375.tar.gz
idevicerestore-85ea3378255cc15e3f39365018f45a42d7469375.tar.bz2
asr: Fix sending payload without checksum
Diffstat (limited to 'src')
-rw-r--r--src/asr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/asr.c b/src/asr.c
index 304e8a3..bf15dc2 100644
--- a/src/asr.c
+++ b/src/asr.c
@@ -349,11 +349,12 @@ int asr_send_payload(asr_client_t asr, ipsw_file_handle_t file)
SHA1_Init(&sha1);
}
- int size = 0;
i = length;
int retry = 3;
while(i > 0 && retry >= 0) {
- size = ASR_PAYLOAD_CHUNK_SIZE;
+ uint32_t size = ASR_PAYLOAD_CHUNK_SIZE;
+ uint32_t sendsize = 0;
+
if (i < ASR_PAYLOAD_CHUNK_SIZE) {
size = i;
}
@@ -364,11 +365,12 @@ int asr_send_payload(asr_client_t asr, ipsw_file_handle_t file)
continue;
}
+ sendsize = size;
if (asr->checksum_chunks) {
SHA1((unsigned char*)data, size, (unsigned char*)(data+size));
+ sendsize += 20;
}
-
- if (asr_send_buffer(asr, data, size+20) < 0) {
+ if (asr_send_buffer(asr, data, sendsize) < 0) {
error("ERROR: Unable to send filesystem payload\n");
retry--;
continue;