SST: Unpack tfm_sst_buf_t for read and write APIs

This patch updates the read and write SST APIs to use
the data, offset and size attributes instead of
tfm_sst_buf_t structure.

Change-Id: Ie3d872c3b1d17b49a54f419d8d6ec164c66b544c
Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
diff --git a/interface/include/tfm_sst_api.h b/interface/include/tfm_sst_api.h
index 58d9333..6ffd25b 100644
--- a/interface/include/tfm_sst_api.h
+++ b/interface/include/tfm_sst_api.h
@@ -114,15 +114,18 @@
  * \param[in]  token_size  Must be set to 0, reserved for future use.
  *                         Token size. In case the token is not provided
  *                         the token size has to be 0.
- * \param[out] data        Pointer to data vector \ref tfm_sst_buf_t to store
- *                         data, size and offset
+ * \param[in]  size        Size of the data to read
+ * \param[in]  offset      Offset within asset to start to read
+ * \param[out] data        Pointer to data vector to store data
  *
  * \return Returns error code as specified in \ref tfm_sst_err_t
  */
 enum tfm_sst_err_t tfm_sst_read(uint32_t asset_uuid,
                                 const uint8_t* token,
                                 uint32_t token_size,
-                                struct tfm_sst_buf_t* data);
+                                uint32_t size,
+                                uint32_t offset,
+                                uint8_t *data);
 
 /**
  * \brief Writes data into an asset referenced by asset UUID.
@@ -136,15 +139,19 @@
  * \param[in] token_size  Must be set to 0, reserved for future use.
  *                        Token size. In case the token is not provided
  *                        the token size has to be 0.
- * \param[in] data        Pointer to data vector \ref tfm_sst_buf_t which
- *                        contains the data to write
+ * \param[in] size        Size of the data to start to write
+ * \param[in] offset      Offset within asset to write the data
+ * \param[in] data        Pointer to data vector which contains the data to
+ *                        write
  *
  * \return Returns error code as specified in \ref tfm_sst_err_t
  */
 enum tfm_sst_err_t tfm_sst_write(uint32_t asset_uuid,
                                  const uint8_t* token,
                                  uint32_t token_size,
-                                 struct tfm_sst_buf_t* data);
+                                 uint32_t size,
+                                 uint32_t offset,
+                                 const uint8_t *data);
 
 /**
  * \brief Deletes the asset referenced by the asset UUID.
diff --git a/interface/src/tfm_sst_api.c b/interface/src/tfm_sst_api.c
index ab47fd8..6af6320 100644
--- a/interface/src/tfm_sst_api.c
+++ b/interface/src/tfm_sst_api.c
@@ -81,36 +81,52 @@
 enum tfm_sst_err_t tfm_sst_read(uint32_t asset_uuid,
                                 const uint8_t* token,
                                 uint32_t token_size,
-                                struct tfm_sst_buf_t* data)
+                                uint32_t size,
+                                uint32_t offset,
+                                uint8_t *data)
 {
     struct tfm_sst_token_t s_token;
+    struct tfm_sst_buf_t   s_data;
 
     /* Pack the token information in the token structure */
     s_token.token = token;
     s_token.token_size = token_size;
 
+    /* Pack buffer information in the buffer structure */
+    s_data.size = size;
+    s_data.offset = offset;
+    s_data.data = data;
+
     return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_READ,
                                     asset_uuid,
                                     (uint32_t)&s_token,
-                                    (uint32_t)data,
+                                    (uint32_t)&s_data,
                                     0);
 }
 
 enum tfm_sst_err_t tfm_sst_write(uint32_t asset_uuid,
                                  const uint8_t* token,
                                  uint32_t token_size,
-                                 struct tfm_sst_buf_t* data)
+                                 uint32_t size,
+                                 uint32_t offset,
+                                 const uint8_t *data)
 {
     struct tfm_sst_token_t s_token;
+    struct tfm_sst_buf_t   s_data;
 
     /* Pack the token information in the token structure */
     s_token.token = token;
     s_token.token_size = token_size;
 
+    /* Pack buffer information in the buffer structure */
+    s_data.size = size;
+    s_data.offset = offset;
+    s_data.data = (uint8_t *)data;
+
     return tfm_ns_lock_svc_dispatch(SVC_TFM_SST_WRITE,
                                     asset_uuid,
                                     (uint32_t)&s_token,
-                                    (uint32_t)data,
+                                    (uint32_t)&s_data,
                                     0);
 }