HAL: Add missing headers to suppress warnings

Add missing headers for BL1/2 HAL and common Attest HAL. Replace
strlcpy with equivalent using internal check and memcpy

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: Ia4ecbed2b44b034709f169bd41ea4f40dc521e83
diff --git a/bl2/src/shared_data.c b/bl2/src/shared_data.c
index fd2fb7b..8faff6e 100644
--- a/bl2/src/shared_data.c
+++ b/bl2/src/shared_data.c
@@ -231,16 +231,22 @@
 
     switch (slot_id) {
     case BOOT_MEASUREMENT_SLOT_RT_0:
-        strlcpy(metadata.sw_type, "RT_0",
-                sizeof(metadata.sw_type));
+        if (sizeof(metadata.sw_type) < sizeof("RT_0")) {
+            return 1;
+        }
+        memcpy(metadata.sw_type, "RT_0", sizeof("RT_0"));
         break;
     case BOOT_MEASUREMENT_SLOT_RT_1:
-        strlcpy(metadata.sw_type, "RT_1",
-                sizeof(metadata.sw_type));
+        if (sizeof(metadata.sw_type) < sizeof("RT_1")) {
+            return 1;
+        }
+        memcpy(metadata.sw_type, "RT_1", sizeof("RT_1"));
         break;
     case BOOT_MEASUREMENT_SLOT_RT_2:
-        strlcpy(metadata.sw_type, "RT_2",
-                sizeof(metadata.sw_type));
+        if (sizeof(metadata.sw_type) < sizeof("RT_2")) {
+            return 1;
+        }
+        memcpy(metadata.sw_type, "RT_2", sizeof("RT_2"));
         break;
     default:
         /* Proceed without this piece of data. */
diff --git a/platform/ext/common/boot_hal_bl1.c b/platform/ext/common/boot_hal_bl1.c
index 04a6503..51e15b6 100644
--- a/platform/ext/common/boot_hal_bl1.c
+++ b/platform/ext/common/boot_hal_bl1.c
@@ -5,6 +5,7 @@
  *
  */
 
+#include <string.h>
 #include "target_cfg.h"
 #include "region.h"
 #include "cmsis.h"
diff --git a/platform/ext/common/boot_hal_bl2.c b/platform/ext/common/boot_hal_bl2.c
index 46646e4..ceadb74 100644
--- a/platform/ext/common/boot_hal_bl2.c
+++ b/platform/ext/common/boot_hal_bl2.c
@@ -5,6 +5,7 @@
  *
  */
 
+#include <string.h>
 #include "target_cfg.h"
 #include "region.h"
 #include "cmsis.h"
diff --git a/platform/ext/target/arm/rss/attest_hal.c b/platform/ext/target/arm/rss/attest_hal.c
index 680a0f0..ce9b5de 100644
--- a/platform/ext/target/arm/rss/attest_hal.c
+++ b/platform/ext/target/arm/rss/attest_hal.c
@@ -7,10 +7,12 @@
 
 #include <stddef.h>
 #include <stdint.h>
+#include <string.h>
 #include "tfm_attest_hal.h"
 #include "tfm_plat_boot_seed.h"
 #include "tfm_plat_device_id.h"
 #include "tfm_plat_otp.h"
+#include "tfm_strnlen.h"
 
 static enum tfm_security_lifecycle_t map_otp_lcs_to_tfm_slc(enum plat_otp_lcs_t lcs)
 {