SST: Add asset types and attributes

This patch adds asset types and attributes to be used by the asset
manager to complement the asset policy in the future (i.e. if an
asset has expired, do not return the asset content in a read
request). The asset type and attributes can also be used by other
services to use the asset in different ways based on the set of
attributes.

The patch also updates the SST code as follows:
- add macros to check the asset types and attributes
- update object header store the new types and attributes
- add get and set asset attributes APIs in all the SST service layers
- add a simple test to verify new APIs (get and set attributes)
- add tfm_sst_asset_info_t and updates APIs in all the SST service
  layers
- increase veneers regions to fit the new get/set assets attributes
  APIs in all the reference targets

Change-Id: I5c678834ffdc9e2447ab046ab4131785d341ed26
Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
diff --git a/interface/include/tfm_sst_asset_macros.h b/interface/include/tfm_sst_asset_macros.h
new file mode 100644
index 0000000..e97ccbe
--- /dev/null
+++ b/interface/include/tfm_sst_asset_macros.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_SST_ASSET_MACROS_H__
+#define __TFM_SST_ASSET_MACROS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "tfm_sst_asset_defs.h"
+
+/*!
+ * \def TFM_SST_ASSET_IS_ASSET_CAT(sst_def_cat_type, type)
+ *
+ * \brief Macro to check if the asset category type (type) is equal to the
+ *        TF-M SST asset defined category types (sst_def_cat_type).
+ *
+ * \param[in] sst_def_cat_type  TF-M SST asset defined category type
+ * \param[in] type              Asset type
+ *
+ * \return Returns 1 if the asset type is equal to the TF-M SST asset defined
+ *         type. Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_IS_ASSET_CAT(sst_def_cat_type, type) \
+        (((type & TFM_SST_ASSET_CAT_VENDOR_DEFINED) != 0) && \
+          ((type & TFM_SST_ASSET_CAT_TYPE_MASK) == sst_def_cat_type))
+
+/*!
+ * \def TFM_SST_ASSET_IS_ASSET_TYPE(sst_def_type, type)
+ *
+ * \brief Macro to check if the asset type (type) is equal to the
+ *        TF-M SST asset defined type (sst_def_type).
+ *
+ * \param[in] sst_def_type  TF-M SST asset defined type
+ * \param[in] type          Asset type
+ *
+ * \return Returns 1 if the asset type is equal to the TF-M SST asset defined
+ *         type. Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_IS_ASSET_TYPE(sst_def_type, type) \
+        (((type & TFM_SST_ASSET_CAT_VENDOR_DEFINED) != 0) && \
+          (type == sst_def_type))
+
+/*!
+ * \def TFM_SST_ASSET_IS_VENDOR_DEFINED(type)
+ *
+ * \brief Macro to check if the asset type is vendor defined.
+ *
+ * \param[in] type  Asset type
+ *
+ * \return Returns 1 if the asset type is equal to TFM_SST_ASSET_VENDOR_DEFINED.
+ *         Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_IS_VENDOR_DEFINED(type) \
+        ((type & TFM_SST_ASSET_VENDOR_DEFINED) != 0)
+
+/*!
+ * \def TFM_SST_ASSET_IS_KEY_TYPE(type)
+ *
+ * \brief Macro to check if the asset type is a key.
+ *
+ * \param[in] type  Asset type
+ *
+ * \return Returns 1 if it is a key. Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_IS_KEY_TYPE(type) \
+        ((type & TFM_SST_ASSET_KEY_MASK) != 0)
+
+/*!
+ * \def TFM_SST_ASSET_IS_ASYMMETRIC_KEY_TYPE(type)
+ *
+ * \brief Macro to check if the asset type is a symmetric key.
+ *
+ * \param[in] type  Asset type
+ *
+ * \return Returns 1 if it is an asymmetric key. Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_IS_ASYMMETRIC_KEY_TYPE(type) \
+        ((type & TFM_SST_ASSET_KEY_ASYMMETRIC_MASK) != 0)
+
+/*!
+ * \def TFM_SST_ASSET_HAS_ATTR(sst_def_asset_attr, attrs)
+ *
+ * \brief Macro to check if the asset attributes (attrs) have a specific TF-M
+ *        SST asset defined bit attribute (sst_def_asset_attr).
+ *
+ * \param[in] sst_def_type  TF-M SST asset defined bit attribute
+ * \param[in] attrs         Asset attributes
+ *
+ * \return Returns 1 if the asset has the TF-M SST asset defined
+ *         attribute. Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_HAS_ATTR(sst_def_asset_attr, attrs) \
+        (((attrs & sst_def_asset_attr) != 0) && \
+         ((attrs & TFM_SST_ASSET_ATTR_VENDOR_DEFINED) == 0))
+
+/*!
+ * \def TFM_SST_ASSET_HAS_ATTR_VENDOR_DEFINED(attrs)
+ *
+ * \brief Macro to check if the asset attributes are vendor defined.
+ *
+ * \param[in] attrs  Asset attributes
+ *
+ * \return Returns 1 if the asset type is equal to TFM_SST_ASSET_VENDOR_DEFINED.
+ *         Otherwise, it returns 0.
+ */
+#define TFM_SST_ASSET_HAS_ATTR_VENDOR_DEFINED(attrs) \
+        ((attrs & TFM_SST_ASSET_ATTR_VENDOR_DEFINED) != 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_SST_ASSET_MACROS_H__ */