* commit '4b6de1ba1ce0fff95c18a8abb7ba6e5762006d49': Recovery 64-bit compile issues
This commit is contained in:
commit
679baa06b7
11 changed files with 33 additions and 30 deletions
|
@ -231,7 +231,7 @@ static int LoadPartitionContents(const char* filename, FileContents* file) {
|
|||
break;
|
||||
}
|
||||
if (next != read) {
|
||||
printf("short read (%d bytes of %d) for partition \"%s\"\n",
|
||||
printf("short read (%zu bytes of %zu) for partition \"%s\"\n",
|
||||
read, next, partition);
|
||||
free(file->data);
|
||||
file->data = NULL;
|
||||
|
@ -258,7 +258,7 @@ static int LoadPartitionContents(const char* filename, FileContents* file) {
|
|||
if (memcmp(sha_so_far, parsed_sha, SHA_DIGEST_SIZE) == 0) {
|
||||
// we have a match. stop reading the partition; we'll return
|
||||
// the data we've read so far.
|
||||
printf("partition read matched size %d sha %s\n",
|
||||
printf("partition read matched size %zu sha %s\n",
|
||||
size[index[i]], sha1sum[index[i]]);
|
||||
break;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ int WriteToPartition(unsigned char* data, size_t len,
|
|||
|
||||
size_t written = mtd_write_data(ctx, (char*)data, len);
|
||||
if (written != len) {
|
||||
printf("only wrote %d of %d bytes to MTD %s\n",
|
||||
printf("only wrote %zu of %zu bytes to MTD %s\n",
|
||||
written, len, partition);
|
||||
mtd_write_close(ctx);
|
||||
return -1;
|
||||
|
@ -460,20 +460,20 @@ int WriteToPartition(unsigned char* data, size_t len,
|
|||
if (errno == EINTR) {
|
||||
read_count = 0;
|
||||
} else {
|
||||
printf("verify read error %s at %d: %s\n",
|
||||
printf("verify read error %s at %zu: %s\n",
|
||||
partition, p, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ((size_t)read_count < to_read) {
|
||||
printf("short verify read %s at %d: %d %d %s\n",
|
||||
printf("short verify read %s at %zu: %zd %zu %s\n",
|
||||
partition, p, read_count, to_read, strerror(errno));
|
||||
}
|
||||
so_far += read_count;
|
||||
}
|
||||
|
||||
if (memcmp(buffer, data+p, to_read)) {
|
||||
printf("verification failed starting at %d\n", p);
|
||||
printf("verification failed starting at %zu\n", p);
|
||||
start = p;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
// format.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
@ -35,7 +36,7 @@
|
|||
* file, and update the SHA context with the output data as well.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
|
||||
int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size __unused,
|
||||
const Value* patch,
|
||||
SinkFn sink, void* token, SHA_CTX* ctx,
|
||||
const Value* bonus_data) {
|
||||
|
@ -132,7 +133,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
|
|||
|
||||
unsigned char* expanded_source = malloc(expanded_len);
|
||||
if (expanded_source == NULL) {
|
||||
printf("failed to allocate %d bytes for expanded_source\n",
|
||||
printf("failed to allocate %zu bytes for expanded_source\n",
|
||||
expanded_len);
|
||||
return -1;
|
||||
}
|
||||
|
@ -163,7 +164,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
|
|||
// We should have filled the output buffer exactly, except
|
||||
// for the bonus_size.
|
||||
if (strm.avail_out != bonus_size) {
|
||||
printf("source inflation short by %d bytes\n", strm.avail_out-bonus_size);
|
||||
printf("source inflation short by %zu bytes\n", strm.avail_out-bonus_size);
|
||||
return -1;
|
||||
}
|
||||
inflateEnd(&strm);
|
||||
|
|
|
@ -319,7 +319,8 @@ static void local_socket_event_func(int fd, unsigned ev, void *_s)
|
|||
|
||||
while(avail > 0) {
|
||||
r = adb_read(fd, x, avail);
|
||||
D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%d\n", s->id, s->fd, r, r<0?errno:0, avail);
|
||||
D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%zu\n",
|
||||
s->id, s->fd, r, r<0?errno:0, avail);
|
||||
if(r > 0) {
|
||||
avail -= r;
|
||||
x += r;
|
||||
|
|
|
@ -713,7 +713,7 @@ int readx(int fd, void *ptr, size_t len)
|
|||
char *p = ptr;
|
||||
int r;
|
||||
#if ADB_TRACE
|
||||
int len0 = len;
|
||||
size_t len0 = len;
|
||||
#endif
|
||||
D("readx: fd=%d wanted=%d\n", fd, (int)len);
|
||||
while(len > 0) {
|
||||
|
@ -734,7 +734,7 @@ int readx(int fd, void *ptr, size_t len)
|
|||
}
|
||||
|
||||
#if ADB_TRACE
|
||||
D("readx: fd=%d wanted=%d got=%d\n", fd, len0, len0 - len);
|
||||
D("readx: fd=%d wanted=%zu got=%zu\n", fd, len0, len0 - len);
|
||||
dump_hex( ptr, len0 );
|
||||
#endif
|
||||
return 0;
|
||||
|
|
|
@ -388,7 +388,7 @@ static int bulk_read(int bulk_out, char *buf, size_t length)
|
|||
ret = adb_read(bulk_out, buf + count, length - count);
|
||||
if (ret < 0) {
|
||||
if (errno != EINTR) {
|
||||
D("[ bulk_read failed fd=%d length=%d count=%d ]\n",
|
||||
D("[ bulk_read failed fd=%d length=%zu count=%zu ]\n",
|
||||
bulk_out, length, count);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -55,7 +56,7 @@ minui_backend* open_fbdev() {
|
|||
return &my_backend;
|
||||
}
|
||||
|
||||
static void fbdev_blank(minui_backend* backend, bool blank)
|
||||
static void fbdev_blank(minui_backend* backend __unused, bool blank)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -174,7 +175,7 @@ static gr_surface fbdev_init(minui_backend* backend) {
|
|||
return gr_draw;
|
||||
}
|
||||
|
||||
static gr_surface fbdev_flip(minui_backend* backend) {
|
||||
static gr_surface fbdev_flip(minui_backend* backend __unused) {
|
||||
if (double_buffered) {
|
||||
// Change gr_draw to point to the buffer currently displayed,
|
||||
// then flip the driver so we're displaying the other buffer
|
||||
|
@ -189,7 +190,7 @@ static gr_surface fbdev_flip(minui_backend* backend) {
|
|||
return gr_draw;
|
||||
}
|
||||
|
||||
static void fbdev_exit(minui_backend* backend) {
|
||||
static void fbdev_exit(minui_backend* backend __unused) {
|
||||
close(fb_fd);
|
||||
fb_fd = -1;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ int res_create_surface(const char* name, gr_surface* pSurface) {
|
|||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
int color_type, bit_depth;
|
||||
size_t width, height;
|
||||
png_uint_32 width, height;
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
||||
&color_type, NULL, NULL, NULL);
|
||||
|
||||
|
|
|
@ -177,11 +177,11 @@ get_args(int *argc, char ***argv) {
|
|||
stage = strndup(boot.stage, sizeof(boot.stage));
|
||||
|
||||
if (boot.command[0] != 0 && boot.command[0] != 255) {
|
||||
LOGI("Boot command: %.*s\n", sizeof(boot.command), boot.command);
|
||||
LOGI("Boot command: %.*s\n", (int)sizeof(boot.command), boot.command);
|
||||
}
|
||||
|
||||
if (boot.status[0] != 0 && boot.status[0] != 255) {
|
||||
LOGI("Boot status: %.*s\n", sizeof(boot.status), boot.status);
|
||||
LOGI("Boot status: %.*s\n", (int)sizeof(boot.status), boot.status);
|
||||
}
|
||||
|
||||
// --- if arguments weren't supplied, look in the bootloader control block
|
||||
|
|
|
@ -57,9 +57,9 @@ void write_tagged(FILE *out, const char *line, const char *tag, int number) {
|
|||
const char *end = line + strlen(line);
|
||||
while (end > line && isspace(end[-1])) --end;
|
||||
if (number > 0) {
|
||||
fprintf(out, "%.*s%s%d%s", end - line, line, tag, number, end);
|
||||
fprintf(out, "%.*s%s%d%s", (int)(end - line), line, tag, number, end);
|
||||
} else {
|
||||
fprintf(out, "%.*s%s%s", end - line, line, tag, end);
|
||||
fprintf(out, "%.*s%s%s", (int)(end - line), line, tag, end);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -955,7 +955,7 @@ Value* FileGetPropFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||
|
||||
buffer = malloc(st.st_size+1);
|
||||
if (buffer == NULL) {
|
||||
ErrorAbort(state, "%s: failed to alloc %lld bytes", name, st.st_size+1);
|
||||
ErrorAbort(state, "%s: failed to alloc %lld bytes", name, (long long)st.st_size+1);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -968,7 +968,7 @@ Value* FileGetPropFn(const char* name, State* state, int argc, Expr* argv[]) {
|
|||
|
||||
if (fread(buffer, 1, st.st_size, f) != st.st_size) {
|
||||
ErrorAbort(state, "%s: failed to read %lld bytes from %s",
|
||||
name, st.st_size+1, filename);
|
||||
name, (long long)st.st_size+1, filename);
|
||||
fclose(f);
|
||||
goto done;
|
||||
}
|
||||
|
|
14
verifier.cpp
14
verifier.cpp
|
@ -140,7 +140,7 @@ int verify_file(unsigned char* addr, size_t length,
|
|||
|
||||
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",
|
||||
LOGI("comment is %zu bytes; signature %zu bytes from end\n",
|
||||
comment_size, signature_start);
|
||||
|
||||
if (signature_start <= FOOTER_SIZE) {
|
||||
|
@ -252,24 +252,24 @@ int verify_file(unsigned char* addr, size_t length,
|
|||
if (pKeys[i].key_type == Certificate::RSA) {
|
||||
if (sig_der_length < RSANUMBYTES) {
|
||||
// "signature" block isn't big enough to contain an RSA block.
|
||||
LOGI("signature is too short for RSA key %d\n", i);
|
||||
LOGI("signature is too short for RSA key %zu\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!RSA_verify(pKeys[i].rsa, sig_der, RSANUMBYTES,
|
||||
hash, pKeys[i].hash_len)) {
|
||||
LOGI("failed to verify against RSA key %d\n", i);
|
||||
LOGI("failed to verify against RSA key %zu\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
LOGI("whole-file signature verified against RSA key %d\n", i);
|
||||
LOGI("whole-file signature verified against RSA key %zu\n", i);
|
||||
free(sig_der);
|
||||
return VERIFY_SUCCESS;
|
||||
} else if (pKeys[i].key_type == Certificate::EC
|
||||
&& pKeys[i].hash_len == SHA256_DIGEST_SIZE) {
|
||||
p256_int r, s;
|
||||
if (!dsa_sig_unpack(sig_der, sig_der_length, &r, &s)) {
|
||||
LOGI("Not a DSA signature block for EC key %d\n", i);
|
||||
LOGI("Not a DSA signature block for EC key %zu\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -277,11 +277,11 @@ int verify_file(unsigned char* addr, size_t length,
|
|||
p256_from_bin(hash, &p256_hash);
|
||||
if (!p256_ecdsa_verify(&(pKeys[i].ec->x), &(pKeys[i].ec->y),
|
||||
&p256_hash, &r, &s)) {
|
||||
LOGI("failed to verify against EC key %d\n", i);
|
||||
LOGI("failed to verify against EC key %zu\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
LOGI("whole-file signature verified against EC key %d\n", i);
|
||||
LOGI("whole-file signature verified against EC key %zu\n", i);
|
||||
free(sig_der);
|
||||
return VERIFY_SUCCESS;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue