Merge 46bbb57bf63e2d24b82a1ea914859c7afd830e71 on remote branch
Change-Id: I2d1e3caa83bbe3b260ba2c6f08760fa56b5c3565
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index a16f083..534db14 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1645,6 +1645,12 @@
boot_verifier_init();
#endif
+#if VERIFIED_BOOT_2
+ /* read full partition if device is unlocked */
+ if (device.is_unlocked)
+ imagesize_actual = image_size;
+#endif
+
if (check_aboot_addr_range_overlap((uintptr_t) image_addr, imagesize_actual))
{
dprintf(CRITICAL, "Boot image buffer address overlaps with aboot addresses.\n");
@@ -1705,18 +1711,22 @@
device.is_unlocked,
device.is_tampered);
#if VERIFIED_BOOT_2
- offset = imagesize_actual;
- if (check_aboot_addr_range_overlap((uintptr_t)image_addr + offset, page_size))
+ /* if device is unlocked skip reading signature, as full partition is read */
+ if (!device.is_unlocked)
{
- dprintf(CRITICAL, "Signature read buffer address overlaps with aboot addresses.\n");
- return -1;
- }
+ offset = imagesize_actual;
+ if (check_aboot_addr_range_overlap((uintptr_t)image_addr + offset, page_size))
+ {
+ dprintf(CRITICAL, "Signature read buffer address overlaps with aboot addresses.\n");
+ return -1;
+ }
- /* Read signature */
- if(mmc_read(ptn + offset, (void *)(image_addr + offset), page_size))
- {
- dprintf(CRITICAL, "ERROR: Cannot read boot image signature\n");
- return -1;
+ /* Read signature */
+ if(mmc_read(ptn + offset, (void *)(image_addr + offset), page_size))
+ {
+ dprintf(CRITICAL, "ERROR: Cannot read boot image signature\n");
+ return -1;
+ }
}
/* load and validate dtbo partition */
@@ -3011,6 +3021,9 @@
}
#if VERIFIED_BOOT_2
+ /* Pass size of boot partition, as imgsize, to avoid
+ read fewer bytes error */
+ image_actual = partition_get_size(partition_get_index("boot"));
/* load and validate dtbo partition */
load_validate_dtbo_image(&dtbo_image_buf, &dtbo_image_sz);
diff --git a/platform/msm8952/acpuclock.c b/platform/msm8952/acpuclock.c
index 57e4d0c..9efe09b 100644
--- a/platform/msm8952/acpuclock.c
+++ b/platform/msm8952/acpuclock.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015, 2018-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -418,22 +418,6 @@
}
}
-/* Function to asynchronously reset CE.
- * Function assumes that all the CE clocks are off.
- */
-static void ce_async_reset(uint8_t instance)
-{
- /* Start the block reset for CE */
- writel(1, GCC_CRYPTO_BCR);
-
- udelay(2);
-
- /* Take CE block out of reset */
- writel(0, GCC_CRYPTO_BCR);
-
- udelay(2);
-}
-
void clock_ce_enable(uint8_t instance)
{
int ret;
@@ -521,7 +505,5 @@
clock_ce_disable(instance);
- ce_async_reset(instance);
-
clock_ce_enable(instance);
}
diff --git a/platform/msm_shared/avb/VerifiedBoot.c b/platform/msm_shared/avb/VerifiedBoot.c
index d2b1a74..19ebe4d 100644
--- a/platform/msm_shared/avb/VerifiedBoot.c
+++ b/platform/msm_shared/avb/VerifiedBoot.c
@@ -484,6 +484,7 @@
loadedindex < SlotData->num_loaded_partitions; loadedindex++) {
dprintf(DEBUG, "Loaded Partition: %s\n",
SlotData->loaded_partitions[loadedindex].partition_name);
+ UINTN PartIndex = Info->num_loaded_images;
if (!strncmp(((const char *)RequestedPartition[ReqIndex]),
SlotData->loaded_partitions[loadedindex].partition_name,MAX_GPT_NAME_SIZE))
{
@@ -497,13 +498,22 @@
Info->boot_state = RED;
goto out;
}
- Info->images[Info->num_loaded_images].name =
- SlotData->loaded_partitions[loadedindex].partition_name;
- Info->images[Info->num_loaded_images].image_buffer =
- SlotData->loaded_partitions[loadedindex].data;
- Info->images[Info->num_loaded_images].imgsize =
- SlotData->loaded_partitions[loadedindex].data_size;
- Info->num_loaded_images++;
+
+ if (!strncmp("boot", SlotData->loaded_partitions[loadedindex].partition_name, strlen("boot")))
+ PartIndex = IMG_BOOT;
+ else if (!strncmp("dtbo", SlotData->loaded_partitions[loadedindex].partition_name, strlen("dtbo")))
+ PartIndex = IMG_DTBO;
+ else if (!strncmp("recovery", SlotData->loaded_partitions[loadedindex].partition_name,
+ strlen("recovery")))
+ PartIndex = IMG_RECOVERY;
+ else
+ Info->num_loaded_images++;
+ Info->images[PartIndex].name =
+ SlotData->loaded_partitions[loadedindex].partition_name;
+ Info->images[PartIndex].image_buffer =
+ SlotData->loaded_partitions[loadedindex].data;
+ Info->images[PartIndex].imgsize =
+ SlotData->loaded_partitions[loadedindex].data_size;
break;
}
}
diff --git a/platform/msm_shared/rpmb/rpmb_ufs.c b/platform/msm_shared/rpmb/rpmb_ufs.c
index 15e42cc..95aac66 100644
--- a/platform/msm_shared/rpmb/rpmb_ufs.c
+++ b/platform/msm_shared/rpmb/rpmb_ufs.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015,2019 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -104,7 +104,7 @@
req_upiu.cdb = (addr_t) cdb_out_param;
req_upiu.data_buffer_addr = (addr_t) req_buf;
- req_upiu.data_len = bytes_to_transfer;
+ req_upiu.data_len = RPMB_FRAME_SIZE;
req_upiu.flags = UPIU_FLAGS_WRITE;
req_upiu.lun = UFS_WLUN_RPMB;
req_upiu.dd = UTRD_TARGET_TO_SYSTEM;