platform: msm_shared: Add offset of 1024 before loading image to add salt.

For image verification, salt is added copied to start of image,
and hash is calculated. Change enable to add buffer at start of
image for copying salt and verify the image.

Change-Id: I5030bc4186e8dc947d11129bb62d33ad2657dc6e
diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c
index 6a99514..2df16f0 100644
--- a/platform/msm_shared/dev_tree.c
+++ b/platform/msm_shared/dev_tree.c
@@ -47,6 +47,7 @@
 #include <libufdt_sysdeps.h>
 #include <ufdt_overlay.h>
 #include <boot_stats.h>
+#include <verifiedboot.h>
 
 #define BOOT_DEV_MAX_LEN        64
 #define NODE_PROPERTY_MAX_LEN   64
@@ -245,7 +246,7 @@
 		dtbo_image_buf = target_get_scratch_address() +
 					(target_get_max_flash_size() - DTBO_IMG_BUF);
 		dtbo_image_buf =
-			(void *)ROUND_TO_PAGE((addr_t)dtbo_image_buf, (ADDR_ALIGNMENT-1) );
+			(void *)ROUND_TO_PAGE((addr_t)dtbo_image_buf, (ADDR_ALIGNMENT-1));
 		if(dtbo_image_buf == (void *)UINT_MAX)
 		{
 			dprintf(CRITICAL, "ERROR: Invalid DTBO image buf addr\n");
@@ -253,6 +254,8 @@
 			goto out;
 		}
 
+		/* Add offset for salt buffer for verification */
+		dtbo_image_buf += SALT_BUFF_OFFSET;
 		/* Read dtbo partition with header */
 		if (mmc_read(ptn, (uint32_t *)(dtbo_image_buf), dtbo_partition_size))
 		{
diff --git a/platform/msm_shared/include/verifiedboot.h b/platform/msm_shared/include/verifiedboot.h
index 7534c14..e2eb3c2 100644
--- a/platform/msm_shared/include/verifiedboot.h
+++ b/platform/msm_shared/include/verifiedboot.h
@@ -55,6 +55,10 @@
 
 #define EFIERR(_a)		(-1 * (_a))
 
+#define SALT_BUFF_OFFSET (1024)
+#define ADD_SALT_BUFF_OFFSET(addr) (SALT_BUFF_OFFSET + (addr))
+#define SUB_SALT_BUFF_OFFSET(addr) ((addr) - SALT_BUFF_OFFSET)
+
 #define EFI_SUCCESS               0
 #define EFI_LOAD_ERROR            EFIERR (1)
 #define EFI_INVALID_PARAMETER     EFIERR (2)