Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
bootable_recovery
Commits
f3bb31c3
Commit
f3bb31c3
authored
11 years ago
by
Mark Salyzyn
Browse files
Options
Download
Email Patches
Plain Diff
Recovery 64-bit compile issues
Change-Id: I92d5abd1a628feab3b0246924fab7f97ba3b9d34
parent
a7266ef0
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
30 deletions
+33
-30
applypatch/applypatch.c
applypatch/applypatch.c
+6
-6
applypatch/imgpatch.c
applypatch/imgpatch.c
+4
-3
minadbd/sockets.c
minadbd/sockets.c
+2
-1
minadbd/transport.c
minadbd/transport.c
+2
-2
minadbd/usb_linux_client.c
minadbd/usb_linux_client.c
+1
-1
minui/graphics_fbdev.c
minui/graphics_fbdev.c
+4
-3
minui/resources.c
minui/resources.c
+1
-1
recovery.cpp
recovery.cpp
+2
-2
tools/ota/add-property-tag.c
tools/ota/add-property-tag.c
+2
-2
updater/install.c
updater/install.c
+2
-2
verifier.cpp
verifier.cpp
+7
-7
No files found.
applypatch/applypatch.c
View file @
f3bb31c3
...
...
@@ -247,7 +247,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
;
...
...
@@ -274,7 +274,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
;
}
...
...
@@ -402,7 +402,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
;
...
...
@@ -482,20 +482,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
: %
z
d %
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
;
}
...
...
This diff is collapsed.
Click to expand it.
applypatch/imgpatch.c
View file @
f3bb31c3
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
minadbd/sockets.c
View file @
f3bb31c3
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
minadbd/transport.c
View file @
f3bb31c3
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
minadbd/usb_linux_client.c
View file @
f3bb31c3
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
minui/graphics_fbdev.c
View file @
f3bb31c3
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
minui/resources.c
View file @
f3bb31c3
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
recovery.cpp
View file @
f3bb31c3
...
...
@@ -174,11 +174,11 @@ get_args(int *argc, char ***argv) {
get_bootloader_message
(
&
boot
);
// this may fail, leaving a zeroed structure
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
...
...
This diff is collapsed.
Click to expand it.
tools/ota/add-property-tag.c
View file @
f3bb31c3
...
...
@@ -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
);
}
}
...
...
This diff is collapsed.
Click to expand it.
updater/install.c
View file @
f3bb31c3
...
...
@@ -864,7 +864,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
;
}
...
...
@@ -877,7 +877,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
;
}
...
...
This diff is collapsed.
Click to expand it.
verifier.cpp
View file @
f3bb31c3
...
...
@@ -152,7 +152,7 @@ int verify_file(const char* path, const Certificate* pKeys, unsigned int numKeys
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
)
{
...
...
@@ -292,24 +292,24 @@ int verify_file(const char* path, const Certificate* pKeys, unsigned int numKeys
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
;
}
...
...
@@ -317,11 +317,11 @@ int verify_file(const char* path, const Certificate* pKeys, unsigned int numKeys
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
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment