Revert "Fastbootd: flashing certification"
This reverts commit 5ccecfd26d2a7c3a79a139f0118b93ee64be4737.
Change-Id: I0ca31094c115e14982a27c258d9139a723da8428
diff --git a/fastbootd/commands.c b/fastbootd/commands.c
index 2f6e86a..83e86b0 100644
--- a/fastbootd/commands.c
+++ b/fastbootd/commands.c
@@ -52,8 +52,6 @@
static void cmd_boot(struct protocol_handle *phandle, const char *arg)
{
- int sz, atags_sz, new_atags_sz;
- int rv;
unsigned kernel_actual;
unsigned ramdisk_actual;
unsigned second_actual;
@@ -61,11 +59,9 @@
void *ramdisk_ptr;
void *second_ptr;
struct boot_img_hdr *hdr;
- char *ptr = NULL;
- char *atags_ptr = NULL;
- char *new_atags = NULL;
- int data_fd = 0;
-
+ int sz, atags_sz, new_atags_sz;
+ int rv;
+ char *ptr = NULL, *atags_ptr = NULL, *new_atags = NULL;
D(DEBUG, "cmd_boot %s\n", arg);
if (phandle->download_fd < 0) {
@@ -79,18 +75,9 @@
goto error;
}
- // TODO: With cms we can also verify partition name included as
- // cms signed attribute
- if (flash_validate_certificate(phandle->download_fd, &data_fd) != 1) {
- fastboot_fail(phandle, "Access forbiden you need the certificate");
- return;
- }
-
- sz = get_file_size(data_fd);
-
+ sz = get_file_size(phandle->download_fd);
ptr = (char *) mmap(NULL, sz, PROT_READ,
- MAP_POPULATE | MAP_PRIVATE, data_fd, 0);
-
+ MAP_POPULATE | MAP_PRIVATE, phandle->download_fd, 0);
hdr = (struct boot_img_hdr *) ptr;
if (ptr == MAP_FAILED) {
@@ -143,7 +130,6 @@
free(atags_ptr);
munmap(ptr, sz);
free(new_atags);
- close(data_fd);
D(INFO, "Kexec going to reboot");
reboot(LINUX_REBOOT_CMD_KEXEC);
@@ -270,7 +256,6 @@
char data[BOOT_MAGIC_SIZE];
char path[PATH_MAX];
ssize_t header_sz = 0;
- int data_fd = 0;
D(DEBUG, "cmd_flash %s\n", arg);
@@ -288,14 +273,9 @@
return;
}
- if (flash_validate_certificate(phandle->download_fd, &data_fd) != 1) {
- fastboot_fail(phandle, "Access forbiden you need certificate");
- return;
- }
-
// TODO: Maybe its goot idea to check whether the partition is just bootable partition
if (!strcmp(arg, "boot") || !strcmp(arg, "recovery")) {
- if (read_data_once(data_fd, data, BOOT_MAGIC_SIZE) < BOOT_MAGIC_SIZE) {
+ if (read_data_once(phandle->download_fd, data, BOOT_MAGIC_SIZE) < BOOT_MAGIC_SIZE) {
fastboot_fail(phandle, "incoming data read error, cannot read boot header");
return;
}
@@ -307,10 +287,7 @@
partition = flash_get_partiton(path);
- sz = get_file_size64(data_fd);
-
- sz -= header_sz;
-
+ sz = get_file_size64(phandle->download_fd);
if (sz > get_file_size64(partition)) {
flash_close(partition);
D(WARN, "size of file too large");
@@ -327,8 +304,6 @@
D(INFO, "partition '%s' updated\n", arg);
flash_close(partition);
- close(data_fd);
- //TODO: check who is closing phandle->download_fd
fastboot_okay(phandle, "");
}