summaryrefslogtreecommitdiffstats
path: root/verifier.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--verifier.cpp (renamed from verifier.c)13
1 files changed, 7 insertions, 6 deletions
diff --git a/verifier.c b/verifier.cpp
index 729e085cf..58ca72393 100644
--- a/verifier.c
+++ b/verifier.cpp
@@ -16,6 +16,7 @@
#include "common.h"
#include "verifier.h"
+#include "ui.h"
#include "mincrypt/rsa.h"
#include "mincrypt/sha.h"
@@ -69,8 +70,8 @@ int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKey
return VERIFY_FAILURE;
}
- int comment_size = footer[4] + (footer[5] << 8);
- int signature_start = footer[0] + (footer[1] << 8);
+ size_t comment_size = footer[4] + (footer[5] << 8);
+ size_t signature_start = footer[0] + (footer[1] << 8);
LOGI("comment is %d bytes; signature %d bytes from end\n",
comment_size, signature_start);
@@ -99,7 +100,7 @@ int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKey
// bytes) and the comment data.
size_t signed_len = ftell(f) + EOCD_HEADER_SIZE - 2;
- unsigned char* eocd = malloc(eocd_size);
+ unsigned char* eocd = (unsigned char*)malloc(eocd_size);
if (eocd == NULL) {
LOGE("malloc for EOCD record failed\n");
fclose(f);
@@ -120,7 +121,7 @@ int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKey
return VERIFY_FAILURE;
}
- int i;
+ size_t i;
for (i = 4; i < eocd_size-3; ++i) {
if (eocd[i ] == 0x50 && eocd[i+1] == 0x4b &&
eocd[i+2] == 0x05 && eocd[i+3] == 0x06) {
@@ -138,7 +139,7 @@ int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKey
SHA_CTX ctx;
SHA_init(&ctx);
- unsigned char* buffer = malloc(BUFFER_SIZE);
+ unsigned char* buffer = (unsigned char*)malloc(BUFFER_SIZE);
if (buffer == NULL) {
LOGE("failed to alloc memory for sha1 buffer\n");
fclose(f);
@@ -149,7 +150,7 @@ int verify_file(const char* path, const RSAPublicKey *pKeys, unsigned int numKey
size_t so_far = 0;
fseek(f, 0, SEEK_SET);
while (so_far < signed_len) {
- int size = BUFFER_SIZE;
+ size_t size = BUFFER_SIZE;
if (signed_len - so_far < size) size = signed_len - so_far;
if (fread(buffer, 1, size, f) != size) {
LOGE("failed to read data from %s (%s)\n", path, strerror(errno));