Boot: Introduce new protected TLV format

Introduce new protected TLV format in MCUBoot as part of a partial
synchronization with the mainstream MCUBoot repository. The hash of the
source commit: 510fddb8e06d76e2442b2a4603d3e1cbefe28be4.

Adapt image.py Python script to the new TLV format.

Change-Id: I760927cea3fbc66536623c1ed6606debb97a2e74
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/bl2/ext/mcuboot/bootutil/src/image_validate.c b/bl2/ext/mcuboot/bootutil/src/image_validate.c
index 83bf50e..3b18010 100644
--- a/bl2/ext/mcuboot/bootutil/src/image_validate.c
+++ b/bl2/ext/mcuboot/bootutil/src/image_validate.c
@@ -20,7 +20,7 @@
 /*
  * Original code taken from mcuboot project at:
  * https://github.com/JuulLabs-OSS/mcuboot
- * Git SHA of the original version: 61fd888a7f4d741714553f36839dd49fb0065731
+ * Git SHA of the original version: 510fddb8e06d76e2442b2a4603d3e1cbefe28be4
  * Modifications are Copyright (c) 2018-2019 Arm Limited.
  */
 
@@ -77,12 +77,8 @@
     /* Hash is computed over image header and image itself. */
     size = BOOT_TLV_OFF(hdr);
 
-    /* If protected TLVs are present (e.g. security counter TLV) then the
-     * TLV info header and these TLVs must be included in the hash calculation.
-     */
-    if (hdr->ih_protect_tlv_size != 0) {
-        size += hdr->ih_protect_tlv_size;
-    }
+    /* If protected TLVs are present they are also hashed. */
+    size += hdr->ih_protect_tlv_size;
 
 #ifdef MCUBOOT_RAM_LOADING
     bootutil_sha256_update(&sha256_ctx,(void*)(hdr->ih_load_addr), size);