SST: First public draft of PSA SST APIs
This patch releases the first public draft of Platform Security
Architecture (PSA) Secure Storage (SST) APIs.
The APIs are defined in psa_sst_api.h.
More information can be found in tfm_sst_integration_guide.md
The patch also accomodates the SST implementation and tests
accordingly.
Change-Id: Ibe537939f9692a86816fa0c7b2a8d070a502fd2c
Signed-off-by: Marc Moreno <marc.morenoberengue@arm.com>
diff --git a/docs/user_guides/services/tfm_sst_integration_guide.md b/docs/user_guides/services/tfm_sst_integration_guide.md
index 82dd8d2..e111d35 100755
--- a/docs/user_guides/services/tfm_sst_integration_guide.md
+++ b/docs/user_guides/services/tfm_sst_integration_guide.md
@@ -93,22 +93,24 @@
- Cryptographic interfaces
- Assets definitions
-The TF-M public interfaces for SST service are located in `interface/include`
+The PSA interfaces for SST service are located in `interface/include`
-### TF-M public interfaces
+### Platform Security Architecture (PSA) interfaces version 0.1
-The SST service exposes the following public interfaces:
+The SST service exposes the following PSA interfaces:
- - `enum tfm_sst_err_t tfm_sst_create(uint16_t asset_uuid)`
- - `enum tfm_sst_err_t tfm_sst_get_handle(uint16_t asset_uuid, uint32_t* hdl)`
- - `enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_handle, struct tfm_sst_attribs_t* attrib_struct)`
- - `enum tfm_sst_err_t tfm_sst_read(uint32_t asset_handle, struct tfm_sst_buf_t* data)`
- - `enum tfm_sst_err_t tfm_sst_write(uint32_t asset_handle, struct tfm_sst_buf_t* data)`
- - `enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_handle)`
+ - `enum psa_sst_err_t psa_sst_create(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size)`
+ - `enum psa_sst_err_t psa_sst_get_info(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size, struct psa_sst_asset_info_t *info)`
+ - `enum psa_sst_err_t psa_sst_get_attributes(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size, struct psa_sst_asset_attrs_t *attrs)`
+ - `enum psa_sst_err_t psa_sst_set_attributes(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size, const struct psa_sst_asset_attrs_t *attrs)`
+ - `enum psa_sst_err_t psa_sst_read(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size, uint32_t size, uint32_t offset, uint8_t *data)`
+ - `enum psa_sst_err_t psa_sst_write(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size, uint32_t size, uint32_t offset, const uint8_t *data)`
+ - `enum psa_sst_err_t psa_sst_delete(uint32_t asset_uuid, const uint8_t* token, uint32_t token_size)`
-Those interfaces and the TF-M SST service types are defined and documented
-in `interface/include/tfm_sst_api.h` and `interface/include/tfm_sst_defs.h`
+These PSA interfaces and types are defined and documented
+in `interface/include/psa_sst_api.h`, `interface/include/psa_sst_asset_defs.h`
+and `interface/include/psa_sst_asset_macros.h`
### Core Files
@@ -116,9 +118,11 @@
power failure safe operations and required cryptographic operations for SST
service.
-`sst_core_interface.c` - Contains skeleton implementation for access
-serialization, and it is a placeholder for future context management related
-enhancements.
+`sst_object_system.c` - Contains the object system implementation to manage
+all objects in SST area.
+
+`sst_encrypted_object.c` - Contains an implementation to manipulate
+encrypted objects in the SST object system.
`sst_asset_management.c` - Contains asset's access policy management code.
@@ -265,9 +269,10 @@
asset_perms_modes[]` vectors **must** be named as they are in
`sst_asset_defs.c`.
-The asset information structure (`struct sst_asset_info_t`) contains the
+The asset information structure (`struct sst_asset_policy_t`) contains the
following items:
+ - `type` - PSA asset type
- `asset_uuid` - Asset unique ID.
- `max_size` - Asset maximum size.
- `perms_count` - Number of applications specified in `asset_perms_modes`
@@ -281,13 +286,15 @@
An example of `asset_perms` definition can be found below:
```
-struct sst_asset_info_t asset_perms[] = {
+struct sst_asset_policy_t asset_perms[] = {
{
+ .type = PSA_SST_ASSET_KEY_AES,
.asset_uuid = SST_ASSET_ID_AES_KEY_128,
.max_size = SST_ASSET_MAX_SIZE_AES_KEY_128,
.perms_count = SST_ASSET_PERMS_COUNT_AES_KEY_128,
.perms_modes_start_idx = 0,
}, {
+ .type = PSA_SST_ASSET_KEY_AES,
.asset_uuid = SST_ASSET_ID_AES_KEY_192,
.max_size = SST_ASSET_MAX_SIZE_AES_KEY_192,
.perms_count = SST_ASSET_PERMS_COUNT_AES_KEY_192,
diff --git a/interface/include/tfm_sst_api.h b/interface/include/psa_sst_api.h
similarity index 75%
rename from interface/include/tfm_sst_api.h
rename to interface/include/psa_sst_api.h
index 6ffd25b..4ad50d2 100644
--- a/interface/include/tfm_sst_api.h
+++ b/interface/include/psa_sst_api.h
@@ -5,14 +5,51 @@
*
*/
-#ifndef __TFM_SST_API__
-#define __TFM_SST_API__
+/**
+ * \file psa_sst_api.h
+ *
+ * \brief Platform security architecture (PSA) API for secure storage partition
+ */
+
+#ifndef __PSA_SST_API__
+#define __PSA_SST_API__
+
+#include "psa_sst_asset_defs.h"
+#include "psa_sst_asset_macros.h"
+
+#include "tfm_api.h"
#ifdef __cplusplus
extern "C" {
#endif
-#include "tfm_sst_defs.h"
+/*
+ * PSA SST API version
+ */
+#define PSA_SST_API_VERSION_MAJOR 0
+#define PSA_SST_API_VERSION_MINOR 1
+
+/* The return value is shared with the TF-M partition status value.
+ * The SST return codes shouldn't overlap with predefined TFM status values.
+ */
+#define PSA_SST_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN)
+
+/*!
+ * \enum psa_sst_err_t
+ *
+ * \brief Secure storage service error types
+ *
+ */
+enum psa_sst_err_t {
+ PSA_SST_ERR_SUCCESS = 0,
+ PSA_SST_ERR_ASSET_NOT_PREPARED = PSA_SST_ERR_OFFSET,
+ PSA_SST_ERR_ASSET_NOT_FOUND,
+ PSA_SST_ERR_PARAM_ERROR,
+ PSA_SST_ERR_STORAGE_SYSTEM_FULL,
+ PSA_SST_ERR_SYSTEM_ERROR,
+ /* Following entry is only to ensure the error code of int size */
+ PSA_SST_ERR_FORCE_INT_SIZE = INT_MAX
+};
/**
* \brief Allocates space for the asset, referenced by asset UUID,
@@ -28,10 +65,10 @@
* Token size. In case the token is not provided
* the token size has to be 0.
*
- * \return Returns an TFM_SST_ERR_SUCCESS if asset is created correctly.
- * Otherwise, error code as specified in \ref tfm_sst_err_t
+ * \return Returns an PSA_SST_ERR_SUCCESS if asset is created correctly.
+ * Otherwise, error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_create(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_create(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size);
@@ -48,14 +85,14 @@
* Token size. In case the token is not provided
* the token size has to be 0.
* \param[out] info Pointer to store the asset's information
- * \ref tfm_sst_asset_info_t
+ * \ref psa_sst_asset_info_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_get_info(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_get_info(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
- struct tfm_sst_asset_info_t *info);
+ struct psa_sst_asset_info_t *info);
/**
* \brief Gets asset's attributes referenced by asset UUID.
@@ -70,14 +107,14 @@
* Token size. In case the token is not provided
* the token size has to be 0.
* \param[out] attrs Pointer to store the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_get_attributes(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
- struct tfm_sst_asset_attrs_t *attrs);
+ struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Sets asset's attributes referenced by asset UUID.
@@ -92,15 +129,15 @@
* Token size. In case the token is not provided
* the token size has to be 0.
* \param[in] attrs Pointer to new the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_set_attributes(
+enum psa_sst_err_t psa_sst_set_attributes(
uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
- const struct tfm_sst_asset_attrs_t *attrs);
+ const struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Reads asset's data from asset referenced by asset UUID.
@@ -118,9 +155,9 @@
* \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
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_read(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_read(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
uint32_t size,
@@ -144,9 +181,9 @@
* \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
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_write(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_write(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
uint32_t size,
@@ -166,9 +203,9 @@
* Token size. In case the token is not provided
* the token size has to be 0.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_delete(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size);
@@ -176,4 +213,4 @@
}
#endif
-#endif /* __TFM_SST_API__ */
+#endif /* __PSA_SST_API__ */
diff --git a/interface/include/psa_sst_asset_defs.h b/interface/include/psa_sst_asset_defs.h
new file mode 100644
index 0000000..a810c55
--- /dev/null
+++ b/interface/include/psa_sst_asset_defs.h
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/**
+ * \file psa_sst_asset_defs.h
+ *
+ * \brief Platform security architecture (PSA) asset definitions for
+ * secure storage partition.
+ */
+
+#ifndef __PSA_SST_ASSET_DEFS_H__
+#define __PSA_SST_ASSET_DEFS_H__
+
+#include <inttypes.h>
+#include <limits.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* List of PSA SST asset category types */
+/*!
+ * \def PSA_SST_ASSET_CAT_TYPE_NONE
+ *
+ * \brief Asset category type NONE. This is value used in an asset when the
+ * asset category type is not set.
+ */
+#define PSA_SST_ASSET_CAT_TYPE_NONE ((uint32_t)0x00000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_RAW_DATA
+ *
+ * \brief This category type is used for those assets which contains raw data.
+ */
+#define PSA_SST_ASSET_CAT_RAW_DATA ((uint32_t)0x02000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_KEY_SYMMETRIC
+ *
+ * \brief This category type is used for those assets which contains a
+ * symmetric key.
+ */
+#define PSA_SST_ASSET_CAT_KEY_SYMMETRIC ((uint32_t)0x04000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_KEY_PUBLIC
+ *
+ * \brief This category type is used for those assets which contains an
+ * asymmetric public key.
+ */
+#define PSA_SST_ASSET_CAT_KEY_PUBLIC ((uint32_t)0x06000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_KEY_PRIVATE
+ *
+ * \brief This category type is used for those assets which contains an
+ * asymmetric private key.
+ */
+#define PSA_SST_ASSET_CAT_KEY_PRIVATE ((uint32_t)0x07000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_CERTIFICATE
+ *
+ * \brief This category type is used for those assets which contains a
+ * certificate.
+ */
+#define PSA_SST_ASSET_CAT_CERTIFICATE ((uint32_t)0x08000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_VENDOR_DEFINED
+ *
+ * \brief This category type is used when assets is vendor defined.
+ */
+#define PSA_SST_ASSET_CAT_VENDOR_DEFINED ((uint32_t)0x80000000)
+
+/* PSA SST asset category type masks */
+/*!
+ * \def PSA_SST_ASSET_CAT_TYPE_MASK
+ *
+ * \brief Asset category type mask.
+ */
+#define PSA_SST_ASSET_CAT_TYPE_MASK ((uint32_t)0x7f000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_KEY_MASK
+ *
+ * \brief Asset key category mask.
+ */
+#define PSA_SST_ASSET_CAT_KEY_MASK ((uint32_t)0x04000000)
+
+/*!
+ * \def PSA_SST_ASSET_CAT_KEY_ASYMMETRIC_MASK
+ *
+ * \brief Asset asymmetric key mask.
+ */
+#define PSA_SST_ASSET_CAT_KEY_ASYMMETRIC_MASK ((uint32_t)0x06000000)
+
+
+/* Asset types for raw data category */
+/*!
+ * \def PSA_SST_ASSET_KEY_HMAC
+ *
+ * \brief HMAC key.
+ */
+#define PSA_SST_ASSET_KEY_HMAC ((PSA_SST_ASSET_CAT_RAW_DATA)| 0x00000001)
+
+/* Asset types for symmetric key category */
+/*!
+ * \def PSA_SST_ASSET_KEY_AES
+ *
+ * \brief AES key to be used in algorithms based on AES cipher
+ * (cipher, AEAD or MAC).
+ */
+#define PSA_SST_ASSET_KEY_AES ((PSA_SST_ASSET_CAT_KEY_SYMMETRIC)|0x00000001)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_DES
+ *
+ * \brief DES key to be used in algorithms based on DES or 3DES cipher
+ * (cipher or MAC).
+ */
+#define PSA_SST_ASSET_KEY_DES ((PSA_SST_ASSET_CAT_KEY_SYMMETRIC)|0x00000002)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_CAMELLIA
+ *
+ * \brief Camellia key to be used in algorithms based on Camellia cipher
+ * (cipher, AEAD or MAC).
+ */
+#define PSA_SST_ASSET_KEY_CAMELLIA \
+ ((PSA_SST_ASSET_CAT_KEY_SYMMETRIC)|0x00000003)
+
+/* Asset types for asymmetric key category */
+/*!
+ * \def PSA_SST_ASSET_KEY_RSA_PUBLIC
+ *
+ * \brief RSA public key.
+ */
+#define PSA_SST_ASSET_KEY_RSA_PUBLIC ((PSA_SST_ASSET_CAT_KEY_PUBLIC)|0x00010000)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_RSA_PRIVATE
+ *
+ * \brief RSA private key.
+ */
+#define PSA_SST_ASSET_KEY_RSA_PRIVATE \
+ ((PSA_SST_ASSET_CAT_KEY_PRIVATE)|0x00010000)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_DSA_PUBLIC
+ *
+ * \brief DSA public key.
+ */
+#define PSA_SST_ASSET_KEY_DSA_PUBLIC ((PSA_SST_ASSET_CAT_KEY_PUBLIC)|0x00020000)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_DSA_PRIVATE
+ *
+ * \brief DSA private key.
+ */
+#define PSA_SST_ASSET_KEY_DSA_PRIVATE \
+ ((PSA_SST_ASSET_CAT_KEY_PRIVATE)|0x00020000)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_ECC_PUBLIC
+ *
+ * \brief ECC public key.
+ */
+#define PSA_SST_ASSET_KEY_ECC_PUBLIC ((PSA_SST_ASSET_CAT_KEY_PUBLIC)|0x00030000)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_ECC_PRIVATE
+ *
+ * \brief ECC private key.
+ */
+#define PSA_SST_ASSET_KEY_ECC_PRIVATE \
+ ((PSA_SST_ASSET_CAT_KEY_PRIVATE)|0x00030000)
+
+/*!
+ * \def PSA_SST_ASSET_KEY_ECC_CURVE_MASK
+ *
+ * \brief ECC curve mask. This mask allows to encode the curve identifiers which
+ * are aligned with the TLS Supported Groups Registry (formerly known as
+ * the TLS EC Named Curve Registry)
+ * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
+ * The values are defined by RFC 4492, RFC 7027 and RFC 7919.
+ */
+#define PSA_SST_ASSET_KEY_ECC_CURVE_MASK ((uint32_t)0x0000ffff)
+
+/* Asset types for certificate category */
+/*!
+ * \def PSA_SST_ASSET_CERT_X_509
+ *
+ * \brief X509 certificate.
+ */
+#define PSA_SST_ASSET_CERT_X_509 ((PSA_SST_ASSET_CAT_CERTIFICATE)|0x00000001)
+
+/* List of PSA SST asset */
+/*!
+ * \def PSA_SST_ASSET_ATTR_EXPIRED
+ *
+ * \brief Indicates if asset has expired.
+ */
+#define PSA_SST_ASSET_ATTR_EXPIRED ((uint32_t)0x00000001)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_GENERATED_LOCALLY
+ *
+ * \brief Indicates if asset content has been generated locally.
+ */
+#define PSA_SST_ASSET_ATTR_GENERATED_LOCALLY ((uint32_t)0x00000002)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_DERIVATION
+ *
+ * \brief Indicates if asset content can be used in a key derivation (i.e.
+ * if other keys can be derived from this one)
+ *
+ */
+#define PSA_SST_ASSET_ATTR_DERIVATION ((uint32_t)0x00000004)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_TRUSTED
+ *
+ * \brief Indicates if asset content can be trusted.
+ */
+#define PSA_SST_ASSET_ATTR_TRUSTED ((uint32_t)0x00000008)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_WRITE_ONCE
+ *
+ * \brief Indicates if asset content can be modified once a content has been
+ * set.
+ */
+#define PSA_SST_ASSET_ATTR_WRITE_ONCE ((uint32_t)0x00000010)
+
+/* The next 3 bits are reserved */
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_ENCRYPT
+ *
+ * \brief Indicates if asset content may be used to encrypt data.
+ */
+#define PSA_SST_ASSET_ATTR_ENCRYPT ((uint32_t)0x00000100)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_DECRYPT
+ *
+ * \brief Indicates if asset content may be used to decrypt data.
+ */
+#define PSA_SST_ASSET_ATTR_DECRYPT ((uint32_t)0x00000200)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_SIGN
+ *
+ * \brief Indicates if asset content may be used to sign data.
+ */
+#define PSA_SST_ASSET_ATTR_SIGN ((uint32_t)0x00000400)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_VERIFY
+ *
+ * \brief Indicates if asset content may be used to verify signed data.
+ */
+#define PSA_SST_ASSET_ATTR_VERIFY ((uint32_t)0x00000800)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_VERIFY_RECOVER
+ *
+ * \brief Indicates if asset content may be used to verify data where
+ * data is recovered from the signature.
+ */
+#define PSA_SST_ASSET_ATTR_VERIFY_RECOVER ((uint32_t)0x00001000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_WRAP
+ *
+ * \brief Indicates if asset content may be used to wrap other data
+ * (i.e wrap other keys).
+ */
+#define PSA_SST_ASSET_ATTR_WRAP ((uint32_t)0x00002000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_UNWRAP
+ *
+ * \brief Indicates if asset content may be used to unwrap other data
+ * (i.e unwrap other keys).
+ */
+#define PSA_SST_ASSET_ATTR_UNWRAP ((uint32_t)0x00004000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_SENSITIVE
+ *
+ * \brief Indicates if asset content is sensitive and cannot be revealed.
+ */
+#define PSA_SST_ASSET_ATTR_SENSITIVE ((uint32_t)0x00008000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_ALWAYS_SENSITIVE
+ *
+ * \brief Indicates if asset has always had the sensitive attribute. Attribute
+ * cannot be changed once set. It becomes a read only attribute.
+ */
+#define PSA_SST_ASSET_ATTR_ALWAYS_SENSITIVE ((uint32_t)0x00010000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_EXTRACTABLE
+ *
+ * \brief Indicates if asset content is extractable and can be wrapped.
+ */
+#define PSA_SST_ASSET_ATTR_EXTRACTABLE ((uint32_t)0x00020000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_NEVER_EXTRACTABLE
+ *
+ * \brief Indicates if asset has never had the extactable attribute. Attribute
+ * cannot be changed once set. It becomes a read only attribute.
+ */
+#define PSA_SST_ASSET_ATTR_NEVER_EXTRACTABLE ((uint32_t)0x00040000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_ALWAYS_AUTHENTICATE
+ *
+ * \brief Indicates if user has to be authenticate when the asset content has
+ * to be used.
+ */
+#define PSA_SST_ASSET_ATTR_ALWAYS_AUTHENTICATE ((uint32_t)0x00080000)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_MASK
+ *
+ * \brief Asset attributes mask.
+ */
+#define PSA_SST_ASSET_ATTR_MASK ((uint32_t)0x7FFFFFFF)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_VENDOR_DEFINED
+ *
+ * \brief Indicates if the attribute is vendor defined.
+ */
+#define PSA_SST_ASSET_ATTR_VENDOR_DEFINED ((uint32_t)0x80000000)
+
+
+/* PSA SST asset structure definitions */
+/*!
+ * \struct psa_sst_asset_info_t
+ *
+ * \brief Asset information.
+ */
+struct psa_sst_asset_info_t {
+ uint32_t type; /*!< Asset type */
+ uint32_t size_current; /*!< The current size of the asset content */
+ uint32_t size_max; /*!< The maximum size of the asset content in
+ * bytes
+ */
+};
+
+/*!
+ * \struct psa_sst_asset_validity_t
+ *
+ * \brief Asset validity structure.
+ *
+ * \note Start and end values must be set to 0 as they are reserved for future
+ * use.
+ */
+struct psa_sst_asset_validity_t {
+ uint64_t start; /*!< Start date/time on which the asset validity period
+ * begins
+ */
+ uint64_t end; /*!< End date on which the asset validity period ends */
+
+};
+
+/*!
+ * \struct psa_sst_asset_attrs_t
+ *
+ * \brief Asset attributes structure.
+ *
+ */
+struct psa_sst_asset_attrs_t {
+ struct psa_sst_asset_validity_t validity; /*!< Asset validity period */
+ uint32_t attrs; /*!< Asset attributes */
+ uint8_t reserved[4]; /*!< Reserved for future
+ * expansion. Default value is
+ * 0 in all bytes
+ */
+};
+
+/*!
+ * \def PSA_SST_ASSET_INFO_SIZE
+ *
+ * \brief Indicates the asset information structure size.
+ */
+#define PSA_SST_ASSET_INFO_SIZE sizeof(struct psa_sst_asset_info_t)
+
+/*!
+ * \def PSA_SST_ASSET_ATTR_SIZE
+ *
+ * \brief Indicates the asset attributes structure size.
+ */
+#define PSA_SST_ASSET_ATTR_SIZE sizeof(struct psa_sst_asset_attrs_t)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PSA_SST_ASSET_DEFS_H__ */
diff --git a/interface/include/psa_sst_asset_macros.h b/interface/include/psa_sst_asset_macros.h
new file mode 100644
index 0000000..a7fb058
--- /dev/null
+++ b/interface/include/psa_sst_asset_macros.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/**
+ * \file psa_sst_asset_macros.h
+ *
+ * \brief Platform security architecture (PSA) asset macros definitions for
+ * secure storage partition
+ */
+#ifndef __PSA_SST_ASSET_MACROS_H__
+#define __PSA_SST_ASSET_MACROS_H__
+
+#include "psa_sst_asset_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \def PSA_SST_ASSET_IS_ASSET_CAT(psa_sst_def_cat_type, type)
+ *
+ * \brief Macro to check if the asset category type (type) is equal to the
+ * PSA SST asset defined category types (psa_sst_def_cat_type).
+ *
+ * \param[in] psa_sst_def_cat_type PSA SST asset defined category type
+ * \param[in] type Asset type
+ *
+ * \return Returns 1 if the asset type is equal to the PSA SST asset defined
+ * type. Otherwise, it returns 0.
+ */
+#define PSA_SST_ASSET_IS_ASSET_CAT(psa_sst_def_cat_type, type) \
+ (((type & PSA_SST_ASSET_CAT_VENDOR_DEFINED) != 0) && \
+ ((type & PSA_SST_ASSET_CAT_TYPE_MASK) == psa_sst_def_cat_type))
+
+/*!
+ * \def PSA_SST_ASSET_IS_ASSET_TYPE(psa_sst_def_type, type)
+ *
+ * \brief Macro to check if the asset type (type) is equal to the
+ * PSA SST asset defined type (psa_sst_def_type).
+ *
+ * \param[in] psa_sst_def_type PSA SST asset defined type
+ * \param[in] type Asset type
+ *
+ * \return Returns 1 if the asset type is equal to the PSA SST asset defined
+ * type. Otherwise, it returns 0.
+ */
+#define PSA_SST_ASSET_IS_ASSET_TYPE(psa_sst_def_type, type) \
+ (((type & PSA_SST_ASSET_CAT_VENDOR_DEFINED) != 0) && \
+ (type == psa_sst_def_type))
+
+/*!
+ * \def PSA_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 PSA_SST_ASSET_VENDOR_DEFINED.
+ * Otherwise, it returns 0.
+ */
+#define PSA_SST_ASSET_IS_VENDOR_DEFINED(type) \
+ ((type & PSA_SST_ASSET_VENDOR_DEFINED) != 0)
+
+/*!
+ * \def PSA_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 PSA_SST_ASSET_IS_KEY_TYPE(type) \
+ ((type & PSA_SST_ASSET_KEY_MASK) != 0)
+
+/*!
+ * \def PSA_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 PSA_SST_ASSET_IS_ASYMMETRIC_KEY_TYPE(type) \
+ ((type & PSA_SST_ASSET_KEY_ASYMMETRIC_MASK) != 0)
+
+/*!
+ * \def PSA_SST_ASSET_HAS_ATTR(psa_sst_def_asset_attr, attrs)
+ *
+ * \brief Macro to check if the asset attributes (attrs) have a specific PSA
+ * SST asset defined bit attribute (psa_sst_def_asset_attr).
+ *
+ * \param[in] psa_sst_def_type PSA SST asset defined bit attribute
+ * \param[in] attrs Asset attributes
+ *
+ * \return Returns 1 if the asset has the PSA SST asset defined
+ * attribute. Otherwise, it returns 0.
+ */
+#define PSA_SST_ASSET_HAS_ATTR(psa_sst_def_asset_attr, attrs) \
+ (((attrs & psa_sst_def_asset_attr) != 0) && \
+ ((attrs & PSA_SST_ASSET_ATTR_VENDOR_DEFINED) == 0))
+
+/*!
+ * \def PSA_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 PSA_SST_ASSET_VENDOR_DEFINED.
+ * Otherwise, it returns 0.
+ */
+#define PSA_SST_ASSET_HAS_ATTR_VENDOR_DEFINED(attrs) \
+ ((attrs & PSA_SST_ASSET_ATTR_VENDOR_DEFINED) != 0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PSA_SST_ASSET_MACROS_H__ */
diff --git a/interface/include/tfm_sst_asset_defs.h b/interface/include/tfm_sst_asset_defs.h
deleted file mode 100644
index e97d836..0000000
--- a/interface/include/tfm_sst_asset_defs.h
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SST_ASSET_DEFS_H__
-#define __TFM_SST_ASSET_DEFS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-#include <limits.h>
-
-/* List of TF-M SST asset category types */
-/*!
- * \def TFM_SST_ASSET_CAT_TYPE_NONE
- *
- * \brief Asset category type NONE. This is value used in an asset when the
- * asset category type is not set.
- */
-#define TFM_SST_ASSET_CAT_TYPE_NONE ((uint32_t)0x00000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_RAW_DATA
- *
- * \brief This category type is used for those assets which contains raw data.
- */
-#define TFM_SST_ASSET_CAT_RAW_DATA ((uint32_t)0x02000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_KEY_SYMMETRIC
- *
- * \brief This category type is used for those assets which contains a
- * symmetric key.
- */
-#define TFM_SST_ASSET_CAT_KEY_SYMMETRIC ((uint32_t)0x04000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_KEY_PUBLIC
- *
- * \brief This category type is used for those assets which contains an
- * asymmetric public key.
- */
-#define TFM_SST_ASSET_CAT_KEY_PUBLIC ((uint32_t)0x06000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_KEY_PRIVATE
- *
- * \brief This category type is used for those assets which contains an
- * asymmetric private key.
- */
-#define TFM_SST_ASSET_CAT_KEY_PRIVATE ((uint32_t)0x07000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_CERTIFICATE
- *
- * \brief This category type is used for those assets which contains a
- * certificate.
- */
-#define TFM_SST_ASSET_CAT_CERTIFICATE ((uint32_t)0x08000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_VENDOR_DEFINED
- *
- * \brief This category type is used when assets is vendor defined.
- */
-#define TFM_SST_ASSET_CAT_VENDOR_DEFINED ((uint32_t)0x80000000)
-
-/* TF-M SST asset category type masks */
-/*!
- * \def TFM_SST_ASSET_CAT_TYPE_MASK
- *
- * \brief Asset category type mask.
- */
-#define TFM_SST_ASSET_CAT_TYPE_MASK ((uint32_t)0x7f000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_KEY_MASK
- *
- * \brief Asset key category mask.
- */
-#define TFM_SST_ASSET_CAT_KEY_MASK ((uint32_t)0x04000000)
-
-/*!
- * \def TFM_SST_ASSET_CAT_KEY_ASYMMETRIC_MASK
- *
- * \brief Asset asymmetric key mask.
- */
-#define TFM_SST_ASSET_CAT_KEY_ASYMMETRIC_MASK ((uint32_t)0x06000000)
-
-
-/* Asset types for raw data category */
-/*!
- * \def TFM_SST_ASSET_KEY_HMAC
- *
- * \brief HMAC key.
- */
-#define TFM_SST_ASSET_KEY_HMAC ((TFM_SST_ASSET_CAT_RAW_DATA)| 0x00000001)
-
-/* Asset types for symmetric key category */
-/*!
- * \def TFM_SST_ASSET_KEY_AES
- *
- * \brief AES key to be used in algorithms based on AES cipher
- * (cipher, AEAD or MAC).
- */
-#define TFM_SST_ASSET_KEY_AES ((TFM_SST_ASSET_CAT_KEY_SYMMETRIC)|0x00000001)
-
-/*!
- * \def TFM_SST_ASSET_KEY_DES
- *
- * \brief DES key to be used in algorithms based on DES or 3DES cipher
- * (cipher or MAC).
- */
-#define TFM_SST_ASSET_KEY_DES ((TFM_SST_ASSET_CAT_KEY_SYMMETRIC)|0x00000002)
-
-/*!
- * \def TFM_SST_ASSET_KEY_CAMELLIA
- *
- * \brief Camellia key to be used in algorithms based on Camellia cipher
- * (cipher, AEAD or MAC).
- */
-#define TFM_SST_ASSET_KEY_CAMELLIA \
- ((TFM_SST_ASSET_CAT_KEY_SYMMETRIC)|0x00000003)
-
-/* Asset types for asymmetric key category */
-/*!
- * \def TFM_SST_ASSET_KEY_RSA_PUBLIC
- *
- * \brief RSA public key.
- */
-#define TFM_SST_ASSET_KEY_RSA_PUBLIC ((TFM_SST_ASSET_CAT_KEY_PUBLIC)|0x00010000)
-
-/*!
- * \def TFM_SST_ASSET_KEY_RSA_PRIVATE
- *
- * \brief RSA private key.
- */
-#define TFM_SST_ASSET_KEY_RSA_PRIVATE \
- ((TFM_SST_ASSET_CAT_KEY_PRIVATE)|0x00010000)
-
-/*!
- * \def TFM_SST_ASSET_KEY_DSA_PUBLIC
- *
- * \brief DSA public key.
- */
-#define TFM_SST_ASSET_KEY_DSA_PUBLIC ((TFM_SST_ASSET_CAT_KEY_PUBLIC)|0x00020000)
-
-/*!
- * \def TFM_SST_ASSET_KEY_DSA_PRIVATE
- *
- * \brief DSA private key.
- */
-#define TFM_SST_ASSET_KEY_DSA_PRIVATE \
- ((TFM_SST_ASSET_CAT_KEY_PRIVATE)|0x00020000)
-
-/*!
- * \def TFM_SST_ASSET_KEY_ECC_PUBLIC
- *
- * \brief ECC public key.
- */
-#define TFM_SST_ASSET_KEY_ECC_PUBLIC ((TFM_SST_ASSET_CAT_KEY_PUBLIC)|0x00030000)
-
-/*!
- * \def TFM_SST_ASSET_KEY_ECC_PRIVATE
- *
- * \brief ECC private key.
- */
-#define TFM_SST_ASSET_KEY_ECC_PRIVATE \
- ((TFM_SST_ASSET_CAT_KEY_PRIVATE)|0x00030000)
-
-/*!
- * \def TFM_SST_ASSET_KEY_ECC_CURVE_MASK
- *
- * \brief ECC curve mask. This mask allows to encode the curve identifiers which
- * are aligned with the TLS Supported Groups Registry (formerly known as
- * the TLS EC Named Curve Registry)
- * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
- * The values are defined by RFC 4492, RFC 7027 and RFC 7919.
- */
-#define TFM_SST_ASSET_KEY_ECC_CURVE_MASK ((uint32_t)0x0000ffff)
-
-/* Asset types for certificate category */
-/*!
- * \def TFM_SST_ASSET_CERT_X_509
- *
- * \brief X509 certificate.
- */
-#define TFM_SST_ASSET_CERT_X_509 ((TFM_SST_ASSET_CAT_CERTIFICATE)|0x00000001)
-
-/* List of TF-M SST asset */
-/*!
- * \def TFM_SST_ASSET_ATTR_EXPIRED
- *
- * \brief Indicates if asset has expired.
- */
-#define TFM_SST_ASSET_ATTR_EXPIRED ((uint32_t)0x00000001)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_GENERATED_LOCALLY
- *
- * \brief Indicates if asset content has been generated locally.
- */
-#define TFM_SST_ASSET_ATTR_GENERATED_LOCALLY ((uint32_t)0x00000002)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_DERIVATION
- *
- * \brief Indicates if asset content can be used in a key derivation (i.e.
- * if other keys can be derived from this one)
- *
- */
-#define TFM_SST_ASSET_ATTR_DERIVATION ((uint32_t)0x00000004)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_TRUSTED
- *
- * \brief Indicates if asset content can be trusted.
- */
-#define TFM_SST_ASSET_ATTR_TRUSTED ((uint32_t)0x00000008)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_WRITE_ONCE
- *
- * \brief Indicates if asset content can be modified once a content has been
- * set.
- */
-#define TFM_SST_ASSET_ATTR_WRITE_ONCE ((uint32_t)0x00000010)
-
-/* The next 3 bits are reserved */
-
-/*!
- * \def TFM_SST_ASSET_ATTR_ENCRYPT
- *
- * \brief Indicates if asset content may be used to encrypt data.
- */
-#define TFM_SST_ASSET_ATTR_ENCRYPT ((uint32_t)0x00000100)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_DECRYPT
- *
- * \brief Indicates if asset content may be used to decrypt data.
- */
-#define TFM_SST_ASSET_ATTR_DECRYPT ((uint32_t)0x00000200)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_SIGN
- *
- * \brief Indicates if asset content may be used to sign data.
- */
-#define TFM_SST_ASSET_ATTR_SIGN ((uint32_t)0x00000400)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_VERIFY
- *
- * \brief Indicates if asset content may be used to verify signed data.
- */
-#define TFM_SST_ASSET_ATTR_VERIFY ((uint32_t)0x00000800)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_VERIFY_RECOVER
- *
- * \brief Indicates if asset content may be used to verify data where
- * data is recovered from the signature.
- */
-#define TFM_SST_ASSET_ATTR_VERIFY_RECOVER ((uint32_t)0x00001000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_WRAP
- *
- * \brief Indicates if asset content may be used to wrap other data
- * (i.e wrap other keys).
- */
-#define TFM_SST_ASSET_ATTR_WRAP ((uint32_t)0x00002000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_UNWRAP
- *
- * \brief Indicates if asset content may be used to unwrap other data
- * (i.e unwrap other keys).
- */
-#define TFM_SST_ASSET_ATTR_UNWRAP ((uint32_t)0x00004000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_SENSITIVE
- *
- * \brief Indicates if asset content is sensitive and cannot be revealed.
- */
-#define TFM_SST_ASSET_ATTR_SENSITIVE ((uint32_t)0x00008000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_ALWAYS_SENSITIVE
- *
- * \brief Indicates if asset has always had the sensitive attribute. Attribute
- * cannot be changed once set. It becomes a read only attribute.
- */
-#define TFM_SST_ASSET_ATTR_ALWAYS_SENSITIVE ((uint32_t)0x00010000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_EXTRACTABLE
- *
- * \brief Indicates if asset content is extractable and can be wrapped.
- */
-#define TFM_SST_ASSET_ATTR_EXTRACTABLE ((uint32_t)0x00020000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_NEVER_EXTRACTABLE
- *
- * \brief Indicates if asset has never had the extactable attribute. Attribute
- * cannot be changed once set. It becomes a read only attribute.
- */
-#define TFM_SST_ASSET_ATTR_NEVER_EXTRACTABLE ((uint32_t)0x00040000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_ALWAYS_AUTHENTICATE
- *
- * \brief Indicates if user has to be authenticate when the asset content has
- * to be used.
- */
-#define TFM_SST_ASSET_ATTR_ALWAYS_AUTHENTICATE ((uint32_t)0x00080000)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_MASK
- *
- * \brief Asset attributes mask.
- */
-#define TFM_SST_ASSET_ATTR_MASK ((uint32_t)0x7FFFFFFF)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_VENDOR_DEFINED
- *
- * \brief Indicates if the attribute is vendor defined.
- */
-#define TFM_SST_ASSET_ATTR_VENDOR_DEFINED ((uint32_t)0x80000000)
-
-
-/* TF-M SST asset structure definitions */
-/*!
- * \struct tfm_sst_asset_info_t
- *
- * \brief Asset information.
- */
-struct tfm_sst_asset_info_t {
- uint32_t type; /*!< Asset type */
- uint32_t size_current; /*!< The current size of the asset content */
- uint32_t size_max; /*!< The maximum size of the asset content in
- * bytes
- */
-};
-
-/*!
- * \struct tfm_sst_asset_validity_t
- *
- * \brief Asset validity structure.
- *
- * \note Start and end values must be set to 0 as they are reserved for future
- * use.
- */
-struct tfm_sst_asset_validity_t {
- uint64_t start; /*!< Start date/time on which the asset validity period
- * begins
- */
- uint64_t end; /*!< End date on which the asset validity period ends */
-
-};
-
-/*!
- * \struct tfm_sst_asset_attrs_t
- *
- * \brief Asset attributes structure.
- *
- */
-struct tfm_sst_asset_attrs_t {
- struct tfm_sst_asset_validity_t validity; /*!< Asset validity period */
- uint32_t attrs; /*!< Asset attributes */
- uint8_t reserved[4]; /*!< Reserved for future
- * expansion. Default value is
- * 0 in all bytes
- */
-};
-
-/*!
- * \def TFM_SST_ASSET_INFO_SIZE
- *
- * \brief Indicates the asset information structure size.
- */
-#define TFM_SST_ASSET_INFO_SIZE sizeof(struct tfm_sst_asset_info_t)
-
-/*!
- * \def TFM_SST_ASSET_ATTR_SIZE
- *
- * \brief Indicates the asset attributes structure size.
- */
-#define TFM_SST_ASSET_ATTR_SIZE sizeof(struct tfm_sst_asset_attrs_t)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_SST_ASSET_DEFS_H__ */
diff --git a/interface/include/tfm_sst_asset_macros.h b/interface/include/tfm_sst_asset_macros.h
deleted file mode 100644
index e97ccbe..0000000
--- a/interface/include/tfm_sst_asset_macros.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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__ */
diff --git a/interface/include/tfm_sst_defs.h b/interface/include/tfm_sst_defs.h
index 5e1f869..09d3b44 100644
--- a/interface/include/tfm_sst_defs.h
+++ b/interface/include/tfm_sst_defs.h
@@ -14,44 +14,7 @@
#include <inttypes.h>
#include <limits.h>
-#include "tfm_api.h"
-#include "tfm_sst_asset_defs.h"
-#include "tfm_sst_asset_macros.h"
-
-/* FIXME: the secure APP ID should not be share with the non-secure code
- * as it is revealing information about secure code implementation.
- */
-#define S_APP_ID 0xF0000000
-
-/* FIXME:
- * Very descriptive error codes can leak implementation
- * information to caller and may allow exploitation
- * of implementation weaknesses by malicious actors.
- * Potential approaches-
- * a. Just return generic error for any kind of failure
- *
- * OR
- *
- * b. Non-secure callers get the generic failure, the
- * secure side callers get a bit more detailed error
- * codes.
- */
-
-/* The return value is shared with the TFM service status value. The SST return
- * codes shouldn't overlap with predefined TFM status values.
- */
-#define TFM_SST_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN)
-
-enum tfm_sst_err_t {
- TFM_SST_ERR_SUCCESS = 0,
- TFM_SST_ERR_ASSET_NOT_PREPARED = TFM_SST_ERR_OFFSET,
- TFM_SST_ERR_ASSET_NOT_FOUND,
- TFM_SST_ERR_PARAM_ERROR,
- TFM_SST_ERR_STORAGE_SYSTEM_FULL,
- TFM_SST_ERR_SYSTEM_ERROR,
- /* Following entry is only to ensure the error code of int size */
- TFM_SST_ERR_FORCE_INT_SIZE = INT_MAX
-};
+#include "psa_sst_api.h"
/*!
* \struct tfm_sst_token_t
diff --git a/interface/include/tfm_sst_svc_handler.h b/interface/include/tfm_sst_svc_handler.h
index 0cfb4ed..57e2734 100644
--- a/interface/include/tfm_sst_svc_handler.h
+++ b/interface/include/tfm_sst_svc_handler.h
@@ -21,10 +21,10 @@
* \param[in] asset_uuid Asset UUID \ref tfm_sst_asset_id_t
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
*
- * \return Returns an TFM_SST_ERR_SUCCESS if asset is created correctly.
- * Otherwise, error code as specified in \ref tfm_sst_err_t
+ * \return Returns an PSA_SST_ERR_SUCCESS if asset is created correctly.
+ * Otherwise, error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token);
/**
@@ -33,26 +33,26 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] info Pointer to store the asset's information
- * \ref tfm_sst_asset_info_t
+ * \ref psa_sst_asset_info_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info);
+ struct psa_sst_asset_info_t *info);
/**
* \brief SVC funtion to get asset's attributes referenced by asset UUID.
*
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] attrs Pointer to store the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs);
+ struct psa_sst_asset_attrs_t *attrs);
/**
* \brief SVC funtion to set asset's attributes referenced by asset UUID.
@@ -60,13 +60,13 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[in] attrs Pointer to new the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs);
+ const struct psa_sst_asset_attrs_t *attrs);
/**
* \brief SVC funtion to read asset's data from asset referenced by asset UUID.
@@ -76,9 +76,9 @@
* \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
* data, size and offset
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t* data);
@@ -90,9 +90,9 @@
* \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
* contains the data to write
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t* data);
@@ -102,9 +102,9 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token);
#ifdef __cplusplus
diff --git a/interface/include/tfm_sst_veneers.h b/interface/include/tfm_sst_veneers.h
index 95a6b17..80bb3eb 100644
--- a/interface/include/tfm_sst_veneers.h
+++ b/interface/include/tfm_sst_veneers.h
@@ -22,16 +22,15 @@
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[in] asset_uuid Asset UUID \ref tfm_sst_asset_id_t
*
- * \return Returns TFM_SST_ERR_SUCCESS if the asset has been created correctly.
+ * \return Returns PSA_SST_ERR_SUCCESS if the asset has been created correctly.
* If SST area is not prepared, it returns
- * TFM_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns
- * TFM_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the
- * write rights, it returns TFM_SST_ERR_PERMS_NOT_ALLOWED.
+ * PSA_SST_ERR_ASSET_NOT_PREPARED. If SST area is full, it returns
+ * PSA_SST_ERR_STORAGE_SYSTEM_FULL. If application id doesn't have the
+ * write rights, it returns PSA_SST_ERR_PERMS_NOT_ALLOWED.
*/
-enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token);
-
/**
* \brief Gets asset's information referenced by asset UUID.
*
@@ -39,13 +38,13 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] info Pointer to store the asset's information
- * \ref tfm_sst_asset_info_t
+ * \ref psa_sst_asset_info_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info);
+ struct psa_sst_asset_info_t *info);
/**
* \brief Gets asset's attributes referenced by asset UUID.
@@ -56,12 +55,12 @@
* \param[out] attrs Pointer to store the asset's attributes
* \ref tfm_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
+enum psa_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs);
+ struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Sets asset's attributes referenced by asset UUID.
@@ -70,14 +69,14 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[in] attrs Pointer to new the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
+enum psa_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs);
+ const struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Reads asset's data from asset referenced by asset UUID.
@@ -88,10 +87,10 @@
* \param[in/out] data Pointer to data vector \ref tfm_sst_buf_t to
* store data, size and offset
*
- * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t
+ * \return Returns the number of bytes written or a castable \ref psa_sst_err_t
* value
*/
-enum tfm_sst_err_t tfm_sst_veneer_read(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_read(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t *data);
@@ -104,10 +103,10 @@
* \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
* contains the data to write
*
- * \return Returns the number of bytes written or a castable \ref tfm_sst_err_t
+ * \return Returns the number of bytes written or a castable \ref psa_sst_err_t
* value
*/
-enum tfm_sst_err_t tfm_sst_veneer_write(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_write(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t *data);
@@ -118,13 +117,12 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
*
- * \return Returns TFM_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted
- * to by this app ID. Returns TFM_SST_ERR_ASSET_REF_INVALID, if asset
- * no longer exists. Otherwise, TFM_SST_ERR_SUCCESS.
+ * \return Returns PSA_SST_ERR_PERMS_NOT_ALLOWED if the asset can't be deleted
+ * to by this app ID. Returns PSA_SST_ERR_ASSET_REF_INVALID, if asset
+ * no longer exists. Otherwise, PSA_SST_ERR_SUCCESS.
*/
-enum tfm_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token);
-
#ifdef __cplusplus
}
#endif
diff --git a/interface/src/tfm_sst_api.c b/interface/src/tfm_sst_api.c
index 6af6320..790435f 100644
--- a/interface/src/tfm_sst_api.c
+++ b/interface/src/tfm_sst_api.c
@@ -8,7 +8,7 @@
#include "tfm_sst_defs.h"
#include "tfm_ns_lock.h"
-enum tfm_sst_err_t tfm_sst_create(uint32_t asset_uuid, const uint8_t* token,
+enum psa_sst_err_t psa_sst_create(uint32_t asset_uuid, const uint8_t* token,
uint32_t token_size)
{
struct tfm_sst_token_t s_token;
@@ -24,10 +24,10 @@
0);
}
-enum tfm_sst_err_t tfm_sst_get_info(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_get_info(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
- struct tfm_sst_asset_info_t *info)
+ struct psa_sst_asset_info_t *info)
{
struct tfm_sst_token_t s_token;
@@ -42,10 +42,10 @@
0);
}
-enum tfm_sst_err_t tfm_sst_get_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_get_attributes(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
- struct tfm_sst_asset_attrs_t *attrs)
+ struct psa_sst_asset_attrs_t *attrs)
{
struct tfm_sst_token_t s_token;
@@ -60,10 +60,10 @@
0);
}
-enum tfm_sst_err_t tfm_sst_set_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_set_attributes(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
- const struct tfm_sst_asset_attrs_t *attrs)
+ const struct psa_sst_asset_attrs_t *attrs)
{
struct tfm_sst_token_t s_token;
@@ -78,7 +78,7 @@
0);
}
-enum tfm_sst_err_t tfm_sst_read(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_read(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
uint32_t size,
@@ -104,7 +104,7 @@
0);
}
-enum tfm_sst_err_t tfm_sst_write(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_write(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size,
uint32_t size,
@@ -130,7 +130,7 @@
0);
}
-enum tfm_sst_err_t tfm_sst_delete(uint32_t asset_uuid,
+enum psa_sst_err_t psa_sst_delete(uint32_t asset_uuid,
const uint8_t* token,
uint32_t token_size)
{
diff --git a/interface/src/tfm_sst_svc_handler.c b/interface/src/tfm_sst_svc_handler.c
index 8277169c..27b4d90 100644
--- a/interface/src/tfm_sst_svc_handler.c
+++ b/interface/src/tfm_sst_svc_handler.c
@@ -11,7 +11,7 @@
#include "tfm_id_mngr.h"
/* SVC function implementations */
-enum tfm_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token)
{
uint32_t app_id;
@@ -21,9 +21,9 @@
return tfm_sst_veneer_create(app_id, asset_uuid, s_token);
}
-enum tfm_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info)
+ struct psa_sst_asset_info_t *info)
{
uint32_t app_id;
@@ -32,9 +32,9 @@
return tfm_sst_veneer_get_info(app_id, asset_uuid, s_token, info);
}
-enum tfm_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs)
+ struct psa_sst_asset_attrs_t *attrs)
{
uint32_t app_id;
@@ -43,9 +43,9 @@
return tfm_sst_veneer_get_attributes(app_id, asset_uuid, s_token, attrs);
}
-enum tfm_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs)
+ const struct psa_sst_asset_attrs_t *attrs)
{
uint32_t app_id;
@@ -54,7 +54,7 @@
return tfm_sst_veneer_set_attributes(app_id, asset_uuid, s_token, attrs);
}
-enum tfm_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t* data)
{
@@ -65,7 +65,7 @@
return tfm_sst_veneer_read(app_id, asset_uuid, s_token, data);
}
-enum tfm_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t* data)
{
@@ -76,7 +76,7 @@
return tfm_sst_veneer_write(app_id, asset_uuid, s_token, data);
}
-enum tfm_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token)
{
uint32_t app_id;
diff --git a/secure_fw/ns_callable/tfm_sst_veneers.c b/secure_fw/ns_callable/tfm_sst_veneers.c
index 15f838b..f48ca8d 100644
--- a/secure_fw/ns_callable/tfm_sst_veneers.c
+++ b/secure_fw/ns_callable/tfm_sst_veneers.c
@@ -12,7 +12,7 @@
#include "secure_fw/spm/spm_partition_defs.h"
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_create(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token)
{
TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_create,
@@ -20,36 +20,36 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_get_info(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info)
+ struct psa_sst_asset_info_t *info)
{
TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_get_info,
app_id, asset_uuid, s_token, info);
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
+enum psa_sst_err_t tfm_sst_veneer_get_attributes(uint32_t app_id,
uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs)
+ struct psa_sst_asset_attrs_t *attrs)
{
TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_get_attributes,
app_id, asset_uuid, s_token, attrs);
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
+enum psa_sst_err_t tfm_sst_veneer_set_attributes(uint32_t app_id,
uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs)
+ const struct psa_sst_asset_attrs_t *attrs)
{
TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_set_attributes,
app_id, asset_uuid, s_token, attrs);
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_read(uint32_t app_id,
+enum psa_sst_err_t tfm_sst_veneer_read(uint32_t app_id,
uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t *data)
@@ -59,7 +59,7 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_write(uint32_t app_id,
+enum psa_sst_err_t tfm_sst_veneer_write(uint32_t app_id,
uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t *data)
@@ -69,7 +69,7 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t tfm_sst_veneer_delete(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token)
{
TFM_CORE_SFN_REQUEST(TFM_SP_STORAGE_ID, sst_am_delete, app_id,
diff --git a/secure_fw/services/secure_storage/assets/sst_asset_defs.c b/secure_fw/services/secure_storage/assets/sst_asset_defs.c
index a4fd198..58de846 100644
--- a/secure_fw/services/secure_storage/assets/sst_asset_defs.c
+++ b/secure_fw/services/secure_storage/assets/sst_asset_defs.c
@@ -10,62 +10,62 @@
struct sst_asset_policy_t asset_perms[] = {
{
- .type = TFM_SST_ASSET_KEY_AES,
+ .type = PSA_SST_ASSET_KEY_AES,
.asset_uuid = SST_ASSET_ID_AES_KEY_128,
.max_size = SST_ASSET_MAX_SIZE_AES_KEY_128,
.perms_count = SST_ASSET_PERMS_COUNT_AES_KEY_128,
.perms_modes_start_idx = 0,
}, {
- .type = TFM_SST_ASSET_KEY_AES,
+ .type = PSA_SST_ASSET_KEY_AES,
.asset_uuid = SST_ASSET_ID_AES_KEY_256,
.max_size = SST_ASSET_MAX_SIZE_AES_KEY_256,
.perms_count = SST_ASSET_PERMS_COUNT_AES_KEY_256,
.perms_modes_start_idx = 2,
}, {
- .type = TFM_SST_ASSET_KEY_RSA_PUBLIC,
+ .type = PSA_SST_ASSET_KEY_RSA_PUBLIC,
.asset_uuid = SST_ASSET_ID_RSA_KEY_1024,
.max_size = SST_ASSET_MAX_SIZE_RSA_KEY_1024,
.perms_count = SST_ASSET_PERMS_COUNT_RSA_KEY_1024,
.perms_modes_start_idx = 3,
}, {
- .type = TFM_SST_ASSET_KEY_RSA_PUBLIC,
+ .type = PSA_SST_ASSET_KEY_RSA_PUBLIC,
.asset_uuid = SST_ASSET_ID_RSA_KEY_2048,
.max_size = SST_ASSET_MAX_SIZE_RSA_KEY_2048,
.perms_count = SST_ASSET_PERMS_COUNT_RSA_KEY_2048,
.perms_modes_start_idx = 4,
}, {
- .type = TFM_SST_ASSET_KEY_RSA_PRIVATE,
+ .type = PSA_SST_ASSET_KEY_RSA_PRIVATE,
.asset_uuid = SST_ASSET_ID_RSA_KEY_4096,
.max_size = SST_ASSET_MAX_SIZE_RSA_KEY_4096,
.perms_count = SST_ASSET_PERMS_COUNT_RSA_KEY_4096,
.perms_modes_start_idx = 5,
}, {
- .type = TFM_SST_ASSET_CERT_X_509,
+ .type = PSA_SST_ASSET_CERT_X_509,
.asset_uuid = SST_ASSET_ID_X509_CERT_SMALL,
.max_size = SST_ASSET_MAX_SIZE_X509_CERT_SMALL,
.perms_count = SST_ASSET_PERMS_COUNT_X509_CERT_SMALL,
.perms_modes_start_idx = 6,
}, {
- .type = TFM_SST_ASSET_CERT_X_509,
+/* The following assets are used by the SST testsuite */
+ .type = PSA_SST_ASSET_CERT_X_509,
.asset_uuid = SST_ASSET_ID_X509_CERT_LARGE,
.max_size = SST_ASSET_MAX_SIZE_X509_CERT_LARGE,
.perms_count = SST_ASSET_PERMS_COUNT_X509_CERT_LARGE,
.perms_modes_start_idx = 7,
}, {
-/* The following assets are used by the SST testsuite */
- .type = TFM_SST_ASSET_KEY_AES,
+ .type = PSA_SST_ASSET_KEY_AES,
.asset_uuid = SST_ASSET_ID_AES_KEY_192,
.max_size = SST_ASSET_MAX_SIZE_AES_KEY_192,
.perms_count = SST_ASSET_PERMS_COUNT_AES_KEY_192,
.perms_modes_start_idx = 7,
}, {
- .type = TFM_SST_ASSET_KEY_HMAC,
+ .type = PSA_SST_ASSET_KEY_HMAC,
.asset_uuid = SST_ASSET_ID_SHA224_HASH,
.max_size = SST_ASSET_MAX_SIZE_SHA224_HASH,
.perms_count = SST_ASSET_PERMS_COUNT_SHA224_HASH,
.perms_modes_start_idx = 10,
}, {
- .type = TFM_SST_ASSET_KEY_HMAC,
+ .type = PSA_SST_ASSET_KEY_HMAC,
.asset_uuid = SST_ASSET_ID_SHA384_HASH,
.max_size = SST_ASSET_MAX_SIZE_SHA384_HASH,
.perms_count = SST_ASSET_PERMS_COUNT_SHA384_HASH,
diff --git a/secure_fw/services/secure_storage/crypto/sst_crypto_interface.c b/secure_fw/services/secure_storage/crypto/sst_crypto_interface.c
index 0fc3ae2..0036b9a 100644
--- a/secure_fw/services/secure_storage/crypto/sst_crypto_interface.c
+++ b/secure_fw/services/secure_storage/crypto/sst_crypto_interface.c
@@ -29,7 +29,7 @@
/* Static buffer to be used by mbedtls for memory allocation */
static uint8_t mbedtls_mem_buf[SST_MBEDTLS_MEM_BUF_LEN];
-enum tfm_sst_err_t sst_crypto_init(void)
+enum psa_sst_err_t sst_crypto_init(void)
{
mbedtls_gcm_free(&sst_crypto_gcm_ctx);
@@ -44,10 +44,10 @@
* are void. When integrated with crypto engine or service
* a return value may be required.
*/
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_crypto_getkey(uint8_t *key, size_t key_len)
+enum psa_sst_err_t sst_crypto_getkey(uint8_t *key, size_t key_len)
{
/* FIXME: if key diversification is desired, the appid
* can be used to derive a key from the HUK derived key.
@@ -59,10 +59,10 @@
*/
plat_get_crypto_huk(key, key_len);
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_crypto_setkey(const uint8_t *key, size_t key_len)
+enum psa_sst_err_t sst_crypto_setkey(const uint8_t *key, size_t key_len)
{
return mbedtls_gcm_setkey(&sst_crypto_gcm_ctx, MBEDTLS_CIPHER_ID_AES,
key, key_len*8);
@@ -116,7 +116,7 @@
}
-enum tfm_sst_err_t sst_crypto_encrypt_and_tag(
+enum psa_sst_err_t sst_crypto_encrypt_and_tag(
union sst_crypto_t *crypto,
const uint8_t *add, size_t add_len,
const uint8_t *in, uint8_t *out,
@@ -128,7 +128,7 @@
crypto->ref.tag);
}
-enum tfm_sst_err_t sst_crypto_auth_and_decrypt(
+enum psa_sst_err_t sst_crypto_auth_and_decrypt(
const union sst_crypto_t *crypto,
const uint8_t *add, size_t add_len,
const uint8_t *in, uint8_t *out,
@@ -140,17 +140,17 @@
in, out);
}
-enum tfm_sst_err_t sst_crypto_generate_auth_tag(union sst_crypto_t *crypto,
+enum psa_sst_err_t sst_crypto_generate_auth_tag(union sst_crypto_t *crypto,
const uint8_t *add,
uint32_t add_len)
{
- enum tfm_sst_err_t ret;
+ enum psa_sst_err_t ret;
ret = sst_crypto_encrypt_and_tag(crypto, add, add_len, 0, 0, 0);
return ret;
}
-enum tfm_sst_err_t sst_crypto_authenticate(
+enum psa_sst_err_t sst_crypto_authenticate(
const union sst_crypto_t *crypto,
const uint8_t *add, uint32_t add_len)
{
diff --git a/secure_fw/services/secure_storage/crypto/sst_crypto_interface.h b/secure_fw/services/secure_storage/crypto/sst_crypto_interface.h
index c603f3f..ac7a39f 100644
--- a/secure_fw/services/secure_storage/crypto/sst_crypto_interface.h
+++ b/secure_fw/services/secure_storage/crypto/sst_crypto_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -36,9 +36,9 @@
/**
* \brief Initializes the crypto engine.
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_init(void);
+enum psa_sst_err_t sst_crypto_init(void);
/**
* \brief Gets a key for specific app id
@@ -46,9 +46,9 @@
* \param[out] key Cryptographic key
* \param[in] key_len Key len
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_getkey(uint8_t *key, size_t key_len);
+enum psa_sst_err_t sst_crypto_getkey(uint8_t *key, size_t key_len);
/**
* \brief Sets key for crypto operations
@@ -56,9 +56,9 @@
* \param[in] key Cryptographic key
* \param[in] key_len Key len
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_setkey(const uint8_t *key, size_t key_len);
+enum psa_sst_err_t sst_crypto_setkey(const uint8_t *key, size_t key_len);
/**
* \brief Encrypts and tag the given plain text data.
@@ -70,9 +70,9 @@
* \param[out] out Buffer pointer to store the encrypted data
* \param[in] len Input and output buffer lengths
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_encrypt_and_tag(union sst_crypto_t *crypto,
+enum psa_sst_err_t sst_crypto_encrypt_and_tag(union sst_crypto_t *crypto,
const uint8_t *add,
size_t add_len,
const uint8_t *in,
@@ -89,9 +89,9 @@
* \param[out] out Buffer pointer to store the encrypted data
* \param[in] len Input and output buffer lengths
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_auth_and_decrypt(const union sst_crypto_t *crypto,
+enum psa_sst_err_t sst_crypto_auth_and_decrypt(const union sst_crypto_t *crypto,
const uint8_t *add,
size_t add_len,
const uint8_t *in,
@@ -105,9 +105,9 @@
* \param[in] add Starting address of the data to authenticate
* \param[in] add_len Length of data to authenticate
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_generate_auth_tag(union sst_crypto_t *crypto,
+enum psa_sst_err_t sst_crypto_generate_auth_tag(union sst_crypto_t *crypto,
const uint8_t *add,
uint32_t add_len);
@@ -118,9 +118,9 @@
* \param[in] add Starting address of the data to authenticate
* \param[in] add_len Length of data to authenticate
*
- * \return Returns values as described in \ref tfm_sst_err_t
+ * \return Returns values as described in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_crypto_authenticate(const union sst_crypto_t *crypto,
+enum psa_sst_err_t sst_crypto_authenticate(const union sst_crypto_t *crypto,
const uint8_t *add,
uint32_t add_len);
diff --git a/secure_fw/services/secure_storage/flash/sst_flash.c b/secure_fw/services/secure_storage/flash/sst_flash.c
index 7d6331d..c73af4e 100644
--- a/secure_fw/services/secure_storage/flash/sst_flash.c
+++ b/secure_fw/services/secure_storage/flash/sst_flash.c
@@ -40,45 +40,45 @@
return (SST_FLASH_AREA_ADDR + (block_id * SST_BLOCK_SIZE) + offset);
}
-static enum tfm_sst_err_t flash_read(uint32_t flash_addr, uint8_t *buff,
+static enum psa_sst_err_t flash_read(uint32_t flash_addr, uint8_t *buff,
uint32_t size)
{
int32_t err;
err = FLASH_DEV_NAME.ReadData(flash_addr, buff, size);
if (err != ARM_DRIVER_OK) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-static enum tfm_sst_err_t flash_write(uint32_t flash_addr, const uint8_t *buff,
+static enum psa_sst_err_t flash_write(uint32_t flash_addr, const uint8_t *buff,
uint32_t size)
{
int32_t err;
err = FLASH_DEV_NAME.ProgramData(flash_addr, buff, size);
if (err != ARM_DRIVER_OK) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-static enum tfm_sst_err_t flash_erase(uint32_t flash_addr)
+static enum psa_sst_err_t flash_erase(uint32_t flash_addr)
{
int32_t err;
err = FLASH_DEV_NAME.EraseSector(flash_addr);
if (err != ARM_DRIVER_OK) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_flash_read(uint32_t block_id, uint8_t *buff,
+enum psa_sst_err_t sst_flash_read(uint32_t block_id, uint8_t *buff,
uint32_t offset, uint32_t size)
{
uint32_t flash_addr;
@@ -91,7 +91,7 @@
return flash_read(flash_addr, buff, size);
}
-enum tfm_sst_err_t sst_flash_write(uint32_t block_id, const uint8_t *buff,
+enum psa_sst_err_t sst_flash_write(uint32_t block_id, const uint8_t *buff,
uint32_t offset, uint32_t size)
{
uint32_t flash_addr;
@@ -104,14 +104,14 @@
return flash_write(flash_addr, buff, size);
}
-enum tfm_sst_err_t sst_flash_block_to_block_move(uint32_t dst_block,
+enum psa_sst_err_t sst_flash_block_to_block_move(uint32_t dst_block,
uint32_t dst_offset,
uint32_t src_block,
uint32_t src_offset,
uint32_t size)
{
static uint8_t dst_block_data_copy[SST_BLOCK_SIZE];
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t dst_flash_addr;
uint32_t src_flash_addr;
@@ -124,7 +124,7 @@
* destination content.
*/
err = flash_read(src_flash_addr, dst_block_data_copy, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -139,7 +139,7 @@
return err;
}
-enum tfm_sst_err_t sst_flash_erase_block(uint32_t block_id)
+enum psa_sst_err_t sst_flash_erase_block(uint32_t block_id)
{
uint32_t flash_addr;
diff --git a/secure_fw/services/secure_storage/flash/sst_flash.h b/secure_fw/services/secure_storage/flash/sst_flash.h
index 87a83b4..7dc6971 100644
--- a/secure_fw/services/secure_storage/flash/sst_flash.h
+++ b/secure_fw/services/secure_storage/flash/sst_flash.h
@@ -51,10 +51,10 @@
* the range of address, based on blockid + offset + size, are always
* valid in the memory.
*
- * \return Returns TFM_SST_ERR_SUCCESS if the function is executed correctly.
- * Otherwise, it returns TFM_SST_ERR_SYSTEM_ERROR.
+ * \return Returns PSA_SST_ERR_SUCCESS if the function is executed correctly.
+ * Otherwise, it returns PSA_SST_ERR_SYSTEM_ERROR.
*/
-enum tfm_sst_err_t sst_flash_read(uint32_t block_id, uint8_t *buff,
+enum psa_sst_err_t sst_flash_read(uint32_t block_id, uint8_t *buff,
uint32_t offset, uint32_t size);
/**
@@ -69,10 +69,10 @@
* the range of address, based on blockid + offset + size, are always
* valid in the memory.
*
- * \return Returns TFM_SST_ERR_SUCCESS if the function is executed correctly.
- * Otherwise, it returns TFM_SST_ERR_SYSTEM_ERROR.
+ * \return Returns PSA_SST_ERR_SUCCESS if the function is executed correctly.
+ * Otherwise, it returns PSA_SST_ERR_SYSTEM_ERROR.
*/
-enum tfm_sst_err_t sst_flash_write(uint32_t block_id, const uint8_t *buff,
+enum psa_sst_err_t sst_flash_write(uint32_t block_id, const uint8_t *buff,
uint32_t offset, uint32_t size);
/**
@@ -92,10 +92,10 @@
* It also considers that the destination block is already erased and
* ready to be written.
*
- * \return Returns TFM_SST_ERR_SUCCESS if the function is executed correctly.
- * Otherwise, it returns TFM_SST_ERR_SYSTEM_ERROR.
+ * \return Returns PSA_SST_ERR_SUCCESS if the function is executed correctly.
+ * Otherwise, it returns PSA_SST_ERR_SYSTEM_ERROR.
*/
-enum tfm_sst_err_t sst_flash_block_to_block_move(uint32_t dst_block,
+enum psa_sst_err_t sst_flash_block_to_block_move(uint32_t dst_block,
uint32_t dst_offset,
uint32_t src_block,
uint32_t src_offset,
@@ -108,10 +108,10 @@
*
* \note This function considers all input values valids.
*
- * \return Returns TFM_SST_ERR_SUCCESS if the function is executed correctly.
- * Otherwise, it returns TFM_SST_ERR_SYSTEM_ERROR.
+ * \return Returns PSA_SST_ERR_SUCCESS if the function is executed correctly.
+ * Otherwise, it returns PSA_SST_ERR_SYSTEM_ERROR.
*/
-enum tfm_sst_err_t sst_flash_erase_block(uint32_t block_id);
+enum psa_sst_err_t sst_flash_erase_block(uint32_t block_id);
#ifdef __cplusplus
}
diff --git a/secure_fw/services/secure_storage/sst_asset_management.c b/secure_fw/services/secure_storage/sst_asset_management.c
index 3acf6ce..9bad7d0 100644
--- a/secure_fw/services/secure_storage/sst_asset_management.c
+++ b/secure_fw/services/secure_storage/sst_asset_management.c
@@ -79,7 +79,7 @@
*/
static uint16_t sst_am_check_s_ns_policy(uint32_t app_id, uint16_t request_type)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint16_t access;
/* FIXME: based on level 1 tfm isolation, any entity on the secure side
@@ -100,7 +100,7 @@
*/
err = sst_utils_validate_secure_caller();
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
if (app_id != S_APP_ID) {
if (request_type & SST_PERM_READ) {
access = SST_PERM_REFERENCE;
@@ -186,9 +186,9 @@
* \brief Validates the policy database's integrity
* Stub function.
*
- * \return Returns value specified in \ref tfm_sst_err_t
+ * \return Returns value specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t validate_policy_db(void)
+static enum psa_sst_err_t validate_policy_db(void)
{
/* Currently the policy database is inbuilt
* in the code. It's sanity is assumed to be correct.
@@ -196,12 +196,12 @@
* stored differently, it may require sanity check
* as well.
*/
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_am_prepare(void)
+enum psa_sst_err_t sst_am_prepare(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* FIXME: outcome of this function should determine
* state machine of asset manager. If this
* step fails other APIs shouldn't entertain
@@ -214,8 +214,8 @@
err = validate_policy_db();
/* Initialize underlying storage system */
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
err = sst_system_prepare();
@@ -224,7 +224,7 @@
* any content in the boot time. Call the wipe API
* to create a storage structure.
*/
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
sst_system_wipe_all();
/* attempt to initialise again */
err = sst_system_prepare();
@@ -243,9 +243,9 @@
* \param[in] access Access type to be permormed on the given dest->data
* address
*
- * \return Returns value specified in \ref tfm_sst_err_t
+ * \return Returns value specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t validate_copy_validate_iovec(
+static enum psa_sst_err_t validate_copy_validate_iovec(
const struct tfm_sst_buf_t *src,
struct tfm_sst_buf_t *dest,
uint32_t app_id,
@@ -256,11 +256,11 @@
* First validate the pointer for iovec itself, then copy
* the iovec, then validate the local copy of iovec.
*/
- enum tfm_sst_err_t bound_check;
+ enum psa_sst_err_t bound_check;
bound_check = sst_utils_bound_check_and_copy((uint8_t *) src,
(uint8_t *) dest, sizeof(struct tfm_sst_buf_t), app_id);
- if (bound_check == TFM_SST_ERR_SUCCESS) {
+ if (bound_check == PSA_SST_ERR_SUCCESS) {
bound_check = sst_utils_memory_bound_check(dest->data, dest->size,
app_id, access);
}
@@ -268,95 +268,95 @@
return bound_check;
}
-enum tfm_sst_err_t sst_am_get_info(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_get_info(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info)
+ struct psa_sst_asset_info_t *info)
{
- enum tfm_sst_err_t bound_check;
+ enum psa_sst_err_t bound_check;
struct sst_asset_policy_t *db_entry;
- struct tfm_sst_asset_info_t tmp_info;
- enum tfm_sst_err_t err;
+ struct psa_sst_asset_info_t tmp_info;
+ enum psa_sst_err_t err;
uint8_t all_perms = SST_PERM_REFERENCE | SST_PERM_READ | SST_PERM_WRITE;
bound_check = sst_utils_memory_bound_check(info,
- TFM_SST_ASSET_INFO_SIZE,
+ PSA_SST_ASSET_INFO_SIZE,
app_id, TFM_MEMORY_ACCESS_RW);
- if (bound_check != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_PARAM_ERROR;
+ if (bound_check != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_PARAM_ERROR;
}
db_entry = sst_am_get_db_entry(app_id, asset_uuid, all_perms);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
err = sst_object_get_info(asset_uuid, s_token, &tmp_info);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
/* Use tmp_info to not leak information in case the previous function
* returns and error. It avoids to leak information in case of error.
* So, copy the tmp_info content into the attrs only if that tmp_info
* data is valid.
*/
- sst_utils_memcpy(info, &tmp_info, TFM_SST_ASSET_INFO_SIZE);
+ sst_utils_memcpy(info, &tmp_info, PSA_SST_ASSET_INFO_SIZE);
}
return err;
}
-enum tfm_sst_err_t sst_am_get_attributes(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_get_attributes(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs)
+ struct psa_sst_asset_attrs_t *attrs)
{
uint8_t all_perms = SST_PERM_REFERENCE | SST_PERM_READ | SST_PERM_WRITE;
- enum tfm_sst_err_t bound_check;
+ enum psa_sst_err_t bound_check;
struct sst_asset_policy_t *db_entry;
- enum tfm_sst_err_t err;
- struct tfm_sst_asset_attrs_t tmp_attrs;
+ enum psa_sst_err_t err;
+ struct psa_sst_asset_attrs_t tmp_attrs;
bound_check = sst_utils_memory_bound_check(attrs,
- TFM_SST_ASSET_ATTR_SIZE,
+ PSA_SST_ASSET_ATTR_SIZE,
app_id, TFM_MEMORY_ACCESS_RW);
- if (bound_check != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_PARAM_ERROR;
+ if (bound_check != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_PARAM_ERROR;
}
db_entry = sst_am_get_db_entry(app_id, asset_uuid, all_perms);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
err = sst_object_get_attributes(asset_uuid, s_token, &tmp_attrs);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
/* Use tmp_attrs to not leak information incase the previous function
* returns and error. It avoids to leak information in case of error.
* So, copy the tmp_attrs content into the attrs only if that tmp_attrs
* data is valid.
*/
- sst_utils_memcpy(attrs, &tmp_attrs, TFM_SST_ASSET_ATTR_SIZE);
+ sst_utils_memcpy(attrs, &tmp_attrs, PSA_SST_ASSET_ATTR_SIZE);
}
return err;
}
-enum tfm_sst_err_t sst_am_set_attributes(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_set_attributes(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs)
+ const struct psa_sst_asset_attrs_t *attrs)
{
uint8_t all_perms = SST_PERM_REFERENCE | SST_PERM_READ | SST_PERM_WRITE;
- enum tfm_sst_err_t bound_check;
+ enum psa_sst_err_t bound_check;
struct sst_asset_policy_t *db_entry;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
bound_check = sst_utils_memory_bound_check((uint8_t *)attrs,
- TFM_SST_ASSET_ATTR_SIZE,
+ PSA_SST_ASSET_ATTR_SIZE,
app_id, TFM_MEMORY_ACCESS_RO);
- if (bound_check != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_PARAM_ERROR;
+ if (bound_check != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_PARAM_ERROR;
}
db_entry = sst_am_get_db_entry(app_id, asset_uuid, all_perms);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* FIXME: Validity attributes are not supported in the current service
@@ -364,7 +364,7 @@
* to 0.
*/
if (attrs->validity.start != 0 || attrs->validity.end != 0) {
- return TFM_SST_ERR_PARAM_ERROR;
+ return PSA_SST_ERR_PARAM_ERROR;
}
/* FIXME: Check which bit attributes have been changed and check if those
@@ -375,15 +375,15 @@
return err;
}
-enum tfm_sst_err_t sst_am_create(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_create(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_asset_policy_t *db_entry;
db_entry = sst_am_get_db_entry(app_id, asset_uuid, SST_PERM_WRITE);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
err = sst_object_create(asset_uuid, s_token, db_entry->type,
@@ -392,30 +392,30 @@
return err;
}
-enum tfm_sst_err_t sst_am_read(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_read(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t *data)
{
struct tfm_sst_buf_t local_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_asset_policy_t *db_entry;
/* Check application ID permissions */
db_entry = sst_am_get_db_entry(app_id, asset_uuid, SST_PERM_READ);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Make a local copy of the iovec data structure */
err = validate_copy_validate_iovec(data, &local_data,
app_id, TFM_MEMORY_ACCESS_RW);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
#ifndef SST_ENABLE_PARTIAL_ASSET_RW
if (data->offset != 0) {
- return TFM_SST_ERR_PARAM_ERROR;
+ return PSA_SST_ERR_PARAM_ERROR;
}
#endif
@@ -425,38 +425,38 @@
return err;
}
-enum tfm_sst_err_t sst_am_write(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_write(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
const struct tfm_sst_buf_t *data)
{
struct tfm_sst_buf_t local_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_asset_policy_t *db_entry;
/* Check application ID permissions */
db_entry = sst_am_get_db_entry(app_id, asset_uuid, SST_PERM_WRITE);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Make a local copy of the iovec data structure */
err = validate_copy_validate_iovec(data, &local_data,
app_id, TFM_MEMORY_ACCESS_RO);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Boundary check the incoming request */
err = sst_utils_check_contained_in(0, db_entry->max_size,
local_data.offset, local_data.size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
#ifndef SST_ENABLE_PARTIAL_ASSET_RW
if (data->offset != 0) {
- return TFM_SST_ERR_PARAM_ERROR;
+ return PSA_SST_ERR_PARAM_ERROR;
}
#endif
@@ -466,15 +466,15 @@
return err;
}
-enum tfm_sst_err_t sst_am_delete(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_delete(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_asset_policy_t *db_entry;
db_entry = sst_am_get_db_entry(app_id, asset_uuid, SST_PERM_WRITE);
if (db_entry == NULL) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
err = sst_object_delete(asset_uuid, s_token);
diff --git a/secure_fw/services/secure_storage/sst_asset_management.h b/secure_fw/services/secure_storage/sst_asset_management.h
index 34ff46e..be8fbfc 100644
--- a/secure_fw/services/secure_storage/sst_asset_management.h
+++ b/secure_fw/services/secure_storage/sst_asset_management.h
@@ -15,6 +15,11 @@
extern "C" {
#endif
+/* FIXME: the secure APP ID should not be share with the non-secure code
+ * as it is revealing information about secure code implementation.
+ */
+#define S_APP_ID 0xF0000000
+
#define SST_PERM_BYPASS (1<<3) /*!< Permission check bypassed. Used when
* secure a secure entity calls as itself
* (and not on behalf of another NS app)
@@ -42,9 +47,9 @@
/**
* \brief Initializes the secure storage system
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_prepare(void);
+enum psa_sst_err_t sst_am_prepare(void);
/**
* \brief Allocates space for the asset, referenced by asset UUID,
@@ -54,9 +59,9 @@
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[in] asset_uuid Asset UUID
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_create(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_create(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token);
/**
@@ -66,13 +71,13 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] info Pointer to store the asset's information
- * \ref tfm_sst_asset_info_t
+ * \ref psa_sst_asset_info_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_get_info(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_get_info(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info);
+ struct psa_sst_asset_info_t *info);
/**
* \brief Gets the asset's attributes referenced by asset UUID.
@@ -81,13 +86,13 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] attrs Pointer to store the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_get_attributes(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_get_attributes(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs);
+ struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Sets the asset's attributes referenced by asset UUID.
@@ -96,13 +101,13 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[in] attrs Pointer to new the asset's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_set_attributes(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_set_attributes(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs);
+ const struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Reads asset's data referenced by asset UUID.
@@ -113,9 +118,9 @@
* \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
* data, size and offset
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_read(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_read(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
struct tfm_sst_buf_t *data);
@@ -128,9 +133,9 @@
* \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
* contains the data to write
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_write(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_write(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token,
const struct tfm_sst_buf_t *data);
@@ -141,9 +146,9 @@
* \param[in] asset_uuid Asset UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_am_delete(uint32_t app_id, uint32_t asset_uuid,
+enum psa_sst_err_t sst_am_delete(uint32_t app_id, uint32_t asset_uuid,
const struct tfm_sst_token_t *s_token);
#ifdef __cplusplus
diff --git a/secure_fw/services/secure_storage/sst_core.c b/secure_fw/services/secure_storage/sst_core.c
index 1b138e5..f63df70 100644
--- a/secure_fw/services/secure_storage/sst_core.c
+++ b/secure_fw/services/secure_storage/sst_core.c
@@ -315,17 +315,17 @@
*
* \param[in] block_meta Pointer to block meta structure
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_validate_block_meta(
+static enum psa_sst_err_t sst_meta_validate_block_meta(
const struct sst_block_metadata *block_meta)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* for data blocks data start at position 0 */
uint32_t valid_data_start_value = 0;
if (block_meta->phys_id >= SST_TOTAL_NUM_OF_BLOCKS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* boundary check: block data start + free size can not be bigger
@@ -334,8 +334,8 @@
err = sst_utils_check_contained_in(0, SST_BLOCK_SIZE,
block_meta->data_start,
block_meta->free_size);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
if (block_meta->phys_id == SST_METADATA_BLOCK0 ||
@@ -348,10 +348,10 @@
}
if (block_meta->data_start != valid_data_start_value) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
#endif
@@ -361,12 +361,12 @@
* \param[in] lblock Logical block number
* \param[out] block_meta Pointer to block meta structure
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_read_block_metadata(uint32_t lblock,
+static enum psa_sst_err_t sst_meta_read_block_metadata(uint32_t lblock,
struct sst_block_metadata *block_meta)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t pos;
uint32_t metablock;
@@ -376,7 +376,7 @@
pos, sizeof(struct sst_block_metadata));
#ifdef SST_VALIDATE_METADATA_FROM_FLASH
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
err = sst_meta_validate_block_meta(block_meta);
}
#endif
@@ -392,41 +392,41 @@
*
* \param[in] meta Pointer to object meta structure
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_validate_object_meta(
+static enum psa_sst_err_t sst_meta_validate_object_meta(
const struct sst_assetmeta *meta)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SUCCESS;
+ enum psa_sst_err_t err = PSA_SST_ERR_SUCCESS;
/* logical block ID can not be bigger or equal than number of
* active blocks.
*/
if (meta->lblock >= SST_NUM_ACTIVE_DBLOCKS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* meta->unique_id can be 0 if the object is not in use. If it is in
* use, check the metadata.
*/
- if (sst_utils_validate_uuid(meta->unique_id) == TFM_SST_ERR_SUCCESS) {
+ if (sst_utils_validate_uuid(meta->unique_id) == PSA_SST_ERR_SUCCESS) {
/* validate objects values if object is in use */
if (meta->max_size > SST_MAX_OBJECT_SIZE) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* the current object's data size must be smaller or equal than
* object's data max size.
*/
if (meta->cur_size > meta->max_size) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
if (meta->lblock == SST_LOGICAL_DBLOCK0) {
/* in block 0, data index must be located after the metadata */
if (meta->data_index <
sst_meta_object_meta_offset(SST_NUM_ASSETS)) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
}
@@ -445,12 +445,12 @@
* \param[in] object_index Object's index
* \param[out] meta Pointer to object meta structure
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_meta_read_object_meta(uint32_t object_index,
+enum psa_sst_err_t sst_meta_read_object_meta(uint32_t object_index,
struct sst_assetmeta *meta)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t offset;
offset = sst_meta_object_meta_offset(object_index);
@@ -458,7 +458,7 @@
(uint8_t *)meta, offset, sizeof(struct sst_assetmeta));
#ifdef SST_VALIDATE_METADATA_FROM_FLASH
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
err = sst_meta_validate_object_meta(meta);
}
#endif
@@ -474,17 +474,17 @@
static uint16_t sst_get_free_object_index(void)
{
uint16_t i;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_assetmeta tmp_metadata;
for (i = 0; i < SST_NUM_ASSETS; i++) {
err = sst_meta_read_object_meta(i, &tmp_metadata);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
/* Check if this entry is free by checking if unique_id values is an
* invalid UUID.
*/
if (sst_utils_validate_uuid(tmp_metadata.unique_id) !=
- TFM_SST_ERR_SUCCESS) {
+ PSA_SST_ERR_SUCCESS) {
/* Found */
return i;
}
@@ -506,10 +506,10 @@
static uint32_t sst_dblock_lo_to_phy(uint32_t lblock)
{
struct sst_block_metadata block_meta;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_meta_read_block_metadata(lblock, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return SST_BLOCK_INVALID_ID;
}
@@ -526,9 +526,9 @@
* \param[in] offset Offset in the block
* \param[in] size Size of the incoming data
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_dblock_update_scratch(uint32_t cur_logical_block,
+static enum psa_sst_err_t sst_dblock_update_scratch(uint32_t cur_logical_block,
const struct sst_block_metadata *block_meta,
const uint8_t *data,
uint32_t offset,
@@ -536,12 +536,12 @@
{
uint32_t scratch_block;
uint32_t end_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
scratch_block = sst_meta_cur_data_scratch(cur_logical_block);
err = sst_flash_write(scratch_block, data, offset, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -553,7 +553,7 @@
block_meta->phys_id,
block_meta->data_start,
(offset - block_meta->data_start));
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
}
@@ -574,14 +574,14 @@
* \param[in] object_index Object's index in the metadata table
* \param[in] obj_meta Metadata pointer
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_mblock_update_scratch_object_meta(
+static enum psa_sst_err_t sst_mblock_update_scratch_object_meta(
uint32_t object_index,
struct sst_assetmeta *obj_meta)
{
uint32_t scratch_block;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t pos;
scratch_block = sst_meta_cur_meta_scratch();
@@ -595,9 +595,9 @@
/**
* \brief Erases data and meta scratch blocks
*/
-static enum tfm_sst_err_t sst_meta_erase_scratch_blocks(void)
+static enum psa_sst_err_t sst_meta_erase_scratch_blocks(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t scratch_datablock;
uint32_t scratch_metablock;
@@ -608,7 +608,7 @@
* metadata scratch block is erased before data block.
*/
err = sst_flash_erase_block(scratch_metablock);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -632,13 +632,13 @@
* \param[in] lblock Logical block number
* \param[in] block_meta Pointer to block's metadata
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_mblock_update_scratch_block_meta(uint32_t lblock,
+static enum psa_sst_err_t sst_mblock_update_scratch_block_meta(uint32_t lblock,
struct sst_block_metadata *block_meta)
{
uint32_t meta_block;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t pos;
meta_block = sst_meta_cur_meta_scratch();
@@ -655,14 +655,14 @@
*
* \param[in] idx Object index to skip
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_mblock_copy_remaining_object_meta(
+static enum psa_sst_err_t sst_mblock_copy_remaining_object_meta(
uint32_t object_index)
{
uint32_t scratch_block;
uint32_t meta_block;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t end;
uint32_t pos;
@@ -675,7 +675,7 @@
err = sst_flash_block_to_block_move(scratch_block, pos, meta_block, pos,
(object_index *
sizeof(struct sst_assetmeta)));
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -699,12 +699,12 @@
*
* \param[in] lblock Logical block number to skip
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_mblock_copy_remaining_block_meta(uint32_t lblock)
+static enum psa_sst_err_t sst_mblock_copy_remaining_block_meta(uint32_t lblock)
{
struct sst_block_metadata block_meta;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t meta_block;
uint32_t pos;
uint32_t scratch_block;
@@ -723,8 +723,8 @@
* data.
*/
err = sst_meta_read_block_metadata(SST_LOGICAL_DBLOCK0, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Update physical ID for logical block 0 to match with the
@@ -733,8 +733,8 @@
block_meta.phys_id = scratch_block;
err = sst_mblock_update_scratch_block_meta(SST_LOGICAL_DBLOCK0,
&block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Copy the rest of metadata blocks between logical block 0 and
@@ -749,7 +749,7 @@
/* Data before updated content */
err = sst_flash_block_to_block_move(scratch_block, pos, meta_block,
pos, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
}
@@ -774,20 +774,20 @@
* \param[in] size Size to be read
* \param[out] buf Buffer pointer to store the data
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_block_object_read_raw(struct sst_assetmeta *meta,
+static enum psa_sst_err_t sst_block_object_read_raw(struct sst_assetmeta *meta,
uint32_t offset,
uint32_t size,
uint8_t *buf)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t phys_block;
uint32_t pos;
phys_block = sst_dblock_lo_to_phy(meta->lblock);
if (phys_block == SST_BLOCK_INVALID_ID) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
pos = (meta->data_index + offset);
@@ -818,11 +818,11 @@
*
* \param[in] block_id ID of the current metadata block to authenticate
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_auth_and_update(uint32_t block_id)
+static enum psa_sst_err_t sst_meta_auth_and_update(uint32_t block_id)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t size;
uint8_t *addr;
union sst_crypto_t *crypto = &sst_system_ctx.meta_block_header.crypto;
@@ -839,7 +839,7 @@
/* Commit metadata header to flash, except for the non-authenticated part */
err = sst_flash_write(block_id, addr, SST_AUTH_METADATA_OFFSET, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -850,22 +850,22 @@
* FIXME: no need to read back metadata header we just wrote.
*/
err = sst_flash_read(block_id, addr, SST_AUTH_METADATA_OFFSET, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
err = sst_crypto_getkey(sst_system_ctx.sst_key, SST_KEY_LEN_BYTES);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
err = sst_crypto_setkey(sst_system_ctx.sst_key, SST_KEY_LEN_BYTES);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
err = sst_crypto_generate_auth_tag(crypto, addr, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -882,10 +882,10 @@
*
* \return Return offset value in metadata block
*/
-enum tfm_sst_err_t sst_mblock_authenticate(uint32_t block)
+enum psa_sst_err_t sst_mblock_authenticate(uint32_t block)
{
struct sst_metadata_block_header *metablock_header;
- enum tfm_sst_err_t err = 0;
+ enum psa_sst_err_t err = 0;
const uint8_t *addr;
uint32_t addr_len;
@@ -894,7 +894,7 @@
/* Read block table and lookups (all metadata and header) */
err = sst_flash_read(block, (uint8_t *)metablock_header, 0,
SST_ALL_METADATA_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -903,12 +903,12 @@
addr_len = authenticated_meta_data_size();
err = sst_crypto_getkey(sst_system_ctx.sst_key, SST_KEY_LEN_BYTES);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
err = sst_crypto_setkey(sst_system_ctx.sst_key, SST_KEY_LEN_BYTES);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -924,11 +924,11 @@
*
* \param[in] swap_count Swap count to validate
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_validate_swap_count(uint8_t swap_count)
+static enum psa_sst_err_t sst_meta_validate_swap_count(uint8_t swap_count)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SUCCESS;
+ enum psa_sst_err_t err = PSA_SST_ERR_SUCCESS;
/* When a flash block is erased, the default value
* is usually 0xFF (i.e. all 1s). Since the swap count
@@ -943,7 +943,7 @@
* back to previous metablock instead.
*/
if (swap_count == SST_FLASH_DEFAULT_VAL) {
- err = TFM_SST_ERR_SYSTEM_ERROR;
+ err = PSA_SST_ERR_SYSTEM_ERROR;
}
return err;
@@ -954,17 +954,17 @@
*
* \param[in] swap_count Swap count to validate
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_validate_fs_version(uint8_t fs_version)
+static enum psa_sst_err_t sst_meta_validate_fs_version(uint8_t fs_version)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SUCCESS;
+ enum psa_sst_err_t err = PSA_SST_ERR_SUCCESS;
/* Looks for exact version number.
* FIXME: backward compatibility could be considered in future revisions.
*/
if (fs_version != SST_SUPPORTED_VERSION) {
- err = TFM_SST_ERR_SYSTEM_ERROR;
+ err = PSA_SST_ERR_SYSTEM_ERROR;
}
return err;
@@ -977,15 +977,15 @@
*
* \param[in] meta Pointer to metadata block header
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_validate_header_meta(
+static enum psa_sst_err_t sst_meta_validate_header_meta(
struct sst_metadata_block_header *meta)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_meta_validate_fs_version(meta->fs_version);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
err = sst_meta_validate_swap_count(meta->active_swap_count);
}
@@ -995,11 +995,11 @@
/**
* \brief Writes the scratch metadata's header
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_write_scratch_meta_header(void)
+static enum psa_sst_err_t sst_meta_write_scratch_meta_header(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t scratch_metablock;
#ifndef SST_ENCRYPTION
size_t swap_count_offset;
@@ -1012,7 +1012,7 @@
err = sst_meta_validate_swap_count(
sst_system_ctx.meta_block_header.active_swap_count);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
/* Reset the swap count to 0 */
sst_system_ctx.meta_block_header.active_swap_count = 0;
}
@@ -1030,7 +1030,7 @@
err = sst_flash_write(scratch_metablock,
(uint8_t *)(&sst_system_ctx.meta_block_header),
0, swap_count_offset);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1048,16 +1048,16 @@
/**
* \brief Reads the active metadata block header into sst_system_ctx
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_read_meta_header(void)
+static enum psa_sst_err_t sst_meta_read_meta_header(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_flash_read(sst_system_ctx.active_metablock,
(uint8_t *)&sst_system_ctx.meta_block_header, 0,
sizeof(struct sst_metadata_block_header));
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1076,12 +1076,12 @@
* medadata block needs to be copied in the scratch block, unless
* the data of the object processed is located in the logical block 0.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_mblock_migrate_data_to_scratch(void)
+static enum psa_sst_err_t sst_mblock_migrate_data_to_scratch(void)
{
struct sst_block_metadata block_meta;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t current_metablock;
uint32_t scratch_metablock;
uint32_t data_size;
@@ -1090,7 +1090,7 @@
current_metablock = sst_meta_cur_meta_active();
err = sst_meta_read_block_metadata(SST_LOGICAL_DBLOCK0, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1113,13 +1113,13 @@
*
* \return Returns offset value in metadata block
*/
-static enum tfm_sst_err_t sst_meta_update_finalize(void)
+static enum psa_sst_err_t sst_meta_update_finalize(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Commit the metadata block header to flash */
err = sst_meta_write_scratch_meta_header();
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
/* Update the running context */
@@ -1137,35 +1137,35 @@
* \param[out] block_meta Block metadata entry
* \param[in] size Size of the object for which space is reserve
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_meta_reserve_object(
+static enum psa_sst_err_t sst_meta_reserve_object(
struct sst_assetmeta *object_meta,
struct sst_block_metadata *block_meta,
uint32_t size)
{
uint32_t i;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t size_in_flash;
size_in_flash = sst_get_aligned_flash_bytes(size);
for (i = 0; i < SST_NUM_ACTIVE_DBLOCKS; i++) {
err = sst_meta_read_block_metadata(i, block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
if (block_meta->free_size >= size_in_flash) {
object_meta->lblock = i;
object_meta->data_index = SST_BLOCK_SIZE - block_meta->free_size;
block_meta->free_size -= size_in_flash;
object_meta->max_size = size;
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
}
/* No block has large enough space to fit the requested object */
- return TFM_SST_ERR_STORAGE_SYSTEM_FULL;
+ return PSA_SST_ERR_STORAGE_SYSTEM_FULL;
}
/**
@@ -1174,60 +1174,60 @@
* \param[in] obj_uuid ID of the object
* \param[out] obj_idx Index of the object in the object system
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_core_get_object_idx(uint32_t obj_uuid,
+static enum psa_sst_err_t sst_core_get_object_idx(uint32_t obj_uuid,
uint32_t *obj_idx)
{
uint32_t i;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_assetmeta tmp_metadata;
for (i = 0; i < SST_NUM_ASSETS; i++) {
err = sst_meta_read_object_meta(i, &tmp_metadata);
/* Read from flash failed */
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Unique_id with value 0x00 means end of asset meta section */
if (tmp_metadata.unique_id == obj_uuid) {
/* Found */
*obj_idx = i;
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
}
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
-enum tfm_sst_err_t sst_core_object_exist(uint32_t obj_uuid)
+enum psa_sst_err_t sst_core_object_exist(uint32_t obj_uuid)
{
uint32_t idx;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_core_get_object_idx(obj_uuid, &idx);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_core_object_create(uint32_t object_uuid, uint32_t size)
+enum psa_sst_err_t sst_core_object_create(uint32_t object_uuid, uint32_t size)
{
uint16_t object_index;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_assetmeta object_meta;
struct sst_block_metadata block_meta;
err = sst_meta_reserve_object(&object_meta, &block_meta, size);
object_index = sst_get_free_object_index();
- if ((err != TFM_SST_ERR_SUCCESS) ||
+ if ((err != PSA_SST_ERR_SUCCESS) ||
(object_index == SST_METADATA_INVALID_INDEX)) {
- return TFM_SST_ERR_STORAGE_SYSTEM_FULL;
+ return PSA_SST_ERR_STORAGE_SYSTEM_FULL;
}
object_meta.unique_id = object_uuid;
@@ -1235,8 +1235,8 @@
object_meta.max_size = size;
err = sst_mblock_update_scratch_object_meta(object_index, &object_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* If the object is in logical block 0, then update the physical ID to the
@@ -1249,18 +1249,18 @@
err = sst_mblock_update_scratch_block_meta(object_meta.lblock,
&block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
err = sst_mblock_copy_remaining_object_meta(object_index);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
err = sst_mblock_copy_remaining_block_meta(object_meta.lblock);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* The objects' data in the logical block 0 is stored in same physical block
@@ -1269,30 +1269,30 @@
* metadata block needs to be copied in the scratch block.
*/
err = sst_mblock_migrate_data_to_scratch();
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Write metadata header, swap metadata blocks and erase scratch blocks */
err = sst_meta_update_finalize();
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_core_object_get_info(uint32_t object_uuid,
+enum psa_sst_err_t sst_core_object_get_info(uint32_t object_uuid,
struct sst_core_obj_info_t *info)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
struct sst_assetmeta tmp_metadata;
uint32_t object_index;
/* Get the meta data index */
err = sst_core_get_object_idx(object_uuid, &object_index);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Read object metadata */
@@ -1300,7 +1300,7 @@
if (err == 0) {
/* Check if index is still referring to same object */
if (object_uuid != tmp_metadata.unique_id) {
- err = TFM_SST_ERR_ASSET_NOT_FOUND;
+ err = PSA_SST_ERR_ASSET_NOT_FOUND;
} else {
info->size_max = tmp_metadata.max_size;
info->size_current = tmp_metadata.cur_size;
@@ -1310,12 +1310,12 @@
return err;
}
-enum tfm_sst_err_t sst_core_object_write(uint32_t object_uuid,
+enum psa_sst_err_t sst_core_object_write(uint32_t object_uuid,
const uint8_t *data, uint32_t offset,
uint32_t size)
{
uint32_t object_index;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t cur_phys_block;
const uint8_t *prepared_buf;
struct sst_assetmeta object_meta;
@@ -1327,20 +1327,20 @@
/* Get the object index */
err = sst_core_get_object_idx(object_uuid, &object_index);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Read object metadata */
err = sst_meta_read_object_meta(object_index, &object_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Update block metadata */
err = sst_meta_read_block_metadata(object_meta.lblock, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
#ifdef SST_ENABLE_PARTIAL_ASSET_RW
@@ -1348,7 +1348,7 @@
* without content inside the asset.
*/
if (offset > object_meta.cur_size) {
- return TFM_SST_ERR_PARAM_ERROR;
+ return PSA_SST_ERR_PARAM_ERROR;
}
#endif
@@ -1365,7 +1365,7 @@
SST_OBJECT_START_POSITION,
object_meta.cur_size,
sst_buf_plain_text);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
}
@@ -1404,8 +1404,8 @@
err = sst_dblock_update_scratch(object_meta.lblock, &block_meta,
prepared_buf, object_meta.data_index,
align_flash_nbr_bytes);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
cur_phys_block = block_meta.phys_id;
@@ -1416,26 +1416,26 @@
/* Update block metadata in scratch metadata block */
err = sst_mblock_update_scratch_block_meta(object_meta.lblock, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Update object's metadata to reflect new attributes */
err = sst_mblock_update_scratch_object_meta(object_index, &object_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Copy rest of the block metadata entries */
err = sst_mblock_copy_remaining_block_meta(object_meta.lblock);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Copy rest of the object metadata entries */
err = sst_mblock_copy_remaining_object_meta(object_index);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* The objects' data in the logical block 0 is stored in same physical block
@@ -1448,8 +1448,8 @@
*/
if (object_meta.lblock != SST_LOGICAL_DBLOCK0) {
err = sst_mblock_migrate_data_to_scratch();
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
}
@@ -1472,19 +1472,19 @@
* data position to store the data to be realocated
* \param[in] size Number of bytes to be realocated
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_compact_dblock(uint32_t lblock, uint32_t obj_size,
+static enum psa_sst_err_t sst_compact_dblock(uint32_t lblock, uint32_t obj_size,
uint32_t src_offset, uint32_t dst_offset,
uint32_t size)
{
struct sst_block_metadata block_meta;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t scratch_dblock_id = 0;
/* Read current block meta */
err = sst_meta_read_block_metadata(lblock, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1502,8 +1502,8 @@
err = sst_flash_block_to_block_move(scratch_dblock_id, dst_offset,
block_meta.phys_id, src_offset,
size);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
}
@@ -1516,8 +1516,8 @@
block_meta.phys_id,
block_meta.data_start,
(dst_offset-block_meta.data_start));
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
}
@@ -1532,7 +1532,7 @@
/* Update block metadata in scratch metadata block */
err = sst_mblock_update_scratch_block_meta(lblock, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
/* Swap back the data block as there was an issue in the process */
sst_meta_set_data_scratch(scratch_dblock_id, lblock);
return err;
@@ -1540,7 +1540,7 @@
/* Copy rest of the block metadata entries */
err = sst_mblock_copy_remaining_block_meta(lblock);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
/* Swap back the data block as there was an issue in the process */
sst_meta_set_data_scratch(scratch_dblock_id, lblock);
}
@@ -1548,13 +1548,13 @@
return err;
}
-enum tfm_sst_err_t sst_core_object_delete(uint32_t object_uuid)
+enum psa_sst_err_t sst_core_object_delete(uint32_t object_uuid)
{
uint32_t del_obj_data_index;
uint32_t del_obj_lblock;
uint32_t del_obj_index;
uint32_t del_obj_max_size;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t src_offset = SST_BLOCK_SIZE;
uint32_t nbr_bytes_to_move = 0;
uint32_t obj_idx;
@@ -1562,17 +1562,17 @@
/* Get the object index */
err = sst_core_get_object_idx(object_uuid, &del_obj_index);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
err = sst_meta_read_object_meta(del_obj_index, &object_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
- if (sst_utils_validate_uuid(object_meta.unique_id) != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (sst_utils_validate_uuid(object_meta.unique_id) != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Save logical block, data_index and max_size to be used later on */
@@ -1598,7 +1598,7 @@
/* Read object meta for the given object index */
err = sst_meta_read_object_meta(obj_idx, &object_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1632,7 +1632,7 @@
/* Compact data block */
err = sst_compact_dblock(del_obj_lblock, del_obj_max_size, src_offset,
del_obj_data_index, nbr_bytes_to_move);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1644,58 +1644,58 @@
return err;
}
-enum tfm_sst_err_t sst_core_object_read(uint32_t object_uuid, uint8_t *data,
+enum psa_sst_err_t sst_core_object_read(uint32_t object_uuid, uint8_t *data,
uint32_t offset, uint32_t size)
{
uint32_t object_index;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_assetmeta tmp_metadata;
/* Get the object index */
err = sst_core_get_object_idx(object_uuid, &object_index);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Read object metadata */
err = sst_meta_read_object_meta(object_index, &tmp_metadata);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Check if index is still referring to same asset */
if (object_uuid != tmp_metadata.unique_id) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
/* Boundary check the incoming request */
err = sst_utils_check_contained_in(0, tmp_metadata.cur_size,
offset, size);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_PARAM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_PARAM_ERROR;
}
/* Read the object from flash */
err = sst_block_object_read_raw(&tmp_metadata, offset, size, data);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
/**
* \brief Validates and find the valid-active metablock
*
- * \return Returns value as specified in \ref tfm_sst_err_t
+ * \return Returns value as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_init_get_active_metablock(void)
+static enum psa_sst_err_t sst_init_get_active_metablock(void)
{
struct sst_metadata_block_header meta0;
struct sst_metadata_block_header meta1;
uint32_t cur_meta_block;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
#if SST_ENCRYPTION
uint32_t i;
#endif
@@ -1707,14 +1707,14 @@
/* Read the header of both the metdata blocks */
err = sst_flash_read(SST_METADATA_BLOCK0, (uint8_t *)&meta0,
0, sizeof(struct sst_metadata_block_header));
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
err = sst_flash_read(SST_METADATA_BLOCK1, (uint8_t *) &meta1,
0, sizeof(struct sst_metadata_block_header));
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* If there are two potential active metadata blocks,
@@ -1722,12 +1722,12 @@
* update operation to complete. Need to find out the valid
* metadata block now.
*/
- if (sst_meta_validate_header_meta(&meta0) == TFM_SST_ERR_SUCCESS) {
+ if (sst_meta_validate_header_meta(&meta0) == PSA_SST_ERR_SUCCESS) {
num_valid_meta_blocks++;
cur_meta_block = SST_METADATA_BLOCK0;
}
- if (sst_meta_validate_header_meta(&meta1) == TFM_SST_ERR_SUCCESS) {
+ if (sst_meta_validate_header_meta(&meta1) == PSA_SST_ERR_SUCCESS) {
num_valid_meta_blocks++;
cur_meta_block = SST_METADATA_BLOCK1;
}
@@ -1739,7 +1739,7 @@
if (num_valid_meta_blocks > 1) {
cur_meta_block = sst_meta_latest_meta_block(&meta0, &meta1);
} else if (num_valid_meta_blocks == 0) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
#if SST_ENCRYPTION
@@ -1749,45 +1749,45 @@
*/
for (i = 0; i < num_valid_meta_blocks; i++) {
err = sst_mblock_authenticate(cur_meta_block);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
/* Valid metablock found, stop here */
- err = TFM_SST_ERR_SUCCESS;
+ err = PSA_SST_ERR_SUCCESS;
break;
} else {
/* Primary candidate for valid metadata content failed
* authentication. Try other one.
*/
- err = TFM_SST_ERR_SYSTEM_ERROR;
+ err = PSA_SST_ERR_SYSTEM_ERROR;
cur_meta_block = SST_OTHER_META_BLOCK(cur_meta_block);
}
}
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
#endif
sst_system_ctx.active_metablock = cur_meta_block;
sst_system_ctx.scratch_metablock = SST_OTHER_META_BLOCK(cur_meta_block);
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_core_prepare(void)
+enum psa_sst_err_t sst_core_prepare(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
#if SST_ENCRYPTION
sst_crypto_init();
#endif
err = sst_init_get_active_metablock();
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
err = sst_meta_read_meta_header();
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
#if SST_ENCRYPTION
@@ -1801,10 +1801,10 @@
return err;
}
-enum tfm_sst_err_t sst_core_wipe_all(void)
+enum psa_sst_err_t sst_core_wipe_all(void)
{
uint32_t i;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t metablock_to_erase_first = SST_METADATA_BLOCK0;
struct sst_block_metadata block_meta;
struct sst_assetmeta object_metadata;
@@ -1817,17 +1817,17 @@
* ensure that the active metadata block is erased last to prevent rollback
* in the case of a power failure between the two erases.
*/
- if (sst_init_get_active_metablock() == TFM_SST_ERR_SUCCESS) {
+ if (sst_init_get_active_metablock() == PSA_SST_ERR_SUCCESS) {
metablock_to_erase_first = sst_system_ctx.scratch_metablock;
}
err = sst_flash_erase_block(metablock_to_erase_first);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
err = sst_flash_erase_block(SST_OTHER_META_BLOCK(metablock_to_erase_first));
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -1863,15 +1863,15 @@
/* If an error is detected while erasing the flash, then return a
* system error to abort core wipe process.
*/
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
for (i = 0; i < SST_NUM_DEDICATED_DBLOCKS; i++) {
block_meta.phys_id = i + SST_INIT_DBLOCK_START;
err = sst_mblock_update_scratch_block_meta(i + 1, &block_meta);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
}
@@ -1882,19 +1882,19 @@
/* In the beginning phys id is same as logical id */
/* Update object's metadata to reflect new attributes */
err = sst_mblock_update_scratch_object_meta(i, &object_metadata);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
}
/* FIXME: erase all the blocks first */
err = sst_meta_write_scratch_meta_header();
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_SYSTEM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_SYSTEM_ERROR;
}
/* Swap active and scratch metablocks */
sst_meta_swap_metablocks();
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
diff --git a/secure_fw/services/secure_storage/sst_core.h b/secure_fw/services/secure_storage/sst_core.h
index 28f0cb9..f16c962 100644
--- a/secure_fw/services/secure_storage/sst_core.h
+++ b/secure_fw/services/secure_storage/sst_core.h
@@ -102,20 +102,20 @@
/**
* \brief Prepares the core. Authenticates/validates the metadata.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_core_prepare(void);
+enum psa_sst_err_t sst_core_prepare(void);
/**
* \brief Checks if an object exists.
*
* \param[in] obj_uuid Unique identifier for the object
*
- * \return Returns TFM_SST_ERR_SUCCESS if object exist. If object does not
- * exist, it returns TFM_SST_ERR_ASSET_NOT_FOUND. If SST area is not
- * prepared, it returns TFM_SST_ERR_ASSET_NOT_PREPARED.
+ * \return Returns PSA_SST_ERR_SUCCESS if object exist. If object does not
+ * exist, it returns PSA_SST_ERR_ASSET_NOT_FOUND. If SST area is not
+ * prepared, it returns PSA_SST_ERR_ASSET_NOT_PREPARED.
*/
-enum tfm_sst_err_t sst_core_object_exist(uint32_t obj_uuid);
+enum psa_sst_err_t sst_core_object_exist(uint32_t obj_uuid);
/**
* \brief Creates an object in the storage area.
@@ -123,9 +123,9 @@
* \param[in] obj_uuid Unique identifier for the object
* \param[in] size Size of the object to be created
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_core_object_create(uint32_t obj_uuid, uint32_t size);
+enum psa_sst_err_t sst_core_object_create(uint32_t obj_uuid, uint32_t size);
/**
* \brief Gets the object information referenced by object UUID.
@@ -134,9 +134,9 @@
* \param[out] info Pointer to the information structure to store the
* object information values \ref sst_core_obj_info_t
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_core_object_get_info(uint32_t obj_uuid,
+enum psa_sst_err_t sst_core_object_get_info(uint32_t obj_uuid,
struct sst_core_obj_info_t *info);
/**
@@ -147,9 +147,9 @@
* \param[in] offset Offset in the object
* \param[in] size Size of the incoming buffer
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_core_object_write(uint32_t obj_uuid,
+enum psa_sst_err_t sst_core_object_write(uint32_t obj_uuid,
const uint8_t *data,
uint32_t offset, uint32_t size);
@@ -161,9 +161,9 @@
* \param[in] offset Offset in the object
* \param[in] size Size to be read
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_core_object_read(uint32_t obj_uuid, uint8_t *data,
+enum psa_sst_err_t sst_core_object_read(uint32_t obj_uuid, uint8_t *data,
uint32_t offset, uint32_t size);
/**
@@ -171,9 +171,9 @@
*
* \param[in] obj_uuid Unique identifier of the object
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_core_object_delete(uint32_t obj_uuid);
+enum psa_sst_err_t sst_core_object_delete(uint32_t obj_uuid);
/**
* \brief Reads metadata associated with an object.
@@ -181,9 +181,9 @@
* \param[in] object_index Index of the ojbect to be read
* \param[out] meta Pointer to meta buffer to read values
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_meta_read_object_meta(uint32_t object_index,
+enum psa_sst_err_t sst_meta_read_object_meta(uint32_t object_index,
struct sst_assetmeta *meta);
/**
@@ -191,7 +191,7 @@
*
* \return Returns error code as specified in \ref sst_errno_t
*/
-enum tfm_sst_err_t sst_core_wipe_all(void);
+enum psa_sst_err_t sst_core_wipe_all(void);
#ifdef __cplusplus
}
diff --git a/secure_fw/services/secure_storage/sst_encrypted_object.c b/secure_fw/services/secure_storage/sst_encrypted_object.c
index 99cd7f3..df03339 100644
--- a/secure_fw/services/secure_storage/sst_encrypted_object.c
+++ b/secure_fw/services/secure_storage/sst_encrypted_object.c
@@ -38,18 +38,18 @@
* \brief Gets the encryption key and sets it as the key to be used for
* cryptographic operations.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_object_set_encryption_key(void)
+static enum psa_sst_err_t sst_object_set_encryption_key(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Key used for authenticated encryption and decryption */
static uint8_t sst_encryption_key[SST_KEY_LEN_BYTES];
/* Get the encryption key */
err = sst_crypto_getkey(sst_encryption_key, SST_KEY_LEN_BYTES);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -66,15 +66,15 @@
* \param[in] cur_size Size of the object data
* \param[out] obj Pointer to the object structure to fill in
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_object_auth_decrypt(uint32_t cur_size,
+static enum psa_sst_err_t sst_object_auth_decrypt(uint32_t cur_size,
struct sst_object_t *obj)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_object_set_encryption_key();
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -87,14 +87,14 @@
obj->data,
sst_plaintext_buf,
cur_size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
sst_utils_memcpy(obj->data, sst_plaintext_buf,
obj->header.info.size_current);
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
/**
@@ -104,15 +104,15 @@
* \param[in] cur_size Size of the object data
* \param[out] obj Pointer to the object structure to fill in
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_object_auth_encrypt(uint32_t cur_size,
+static enum psa_sst_err_t sst_object_auth_encrypt(uint32_t cur_size,
struct sst_object_t *obj)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_object_set_encryption_key();
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -126,20 +126,20 @@
obj->data,
sst_plaintext_buf,
cur_size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
sst_utils_memcpy(obj->data, sst_plaintext_buf, cur_size);
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_encrypted_object_create(uint32_t uuid,
+enum psa_sst_err_t sst_encrypted_object_create(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* FIXME: The token structure needs to be used when the key derivation
* mechanism is in place to generate the specific object key.
@@ -149,13 +149,13 @@
/* Create an object in the object system */
err = sst_core_object_create(uuid,
SST_ENCRYPTED_SIZE(obj->header.info.size_max));
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
/* Authenticate the header, with no data to encrypt */
err = sst_object_auth_encrypt(SST_EMPTY_OBJECT_SIZE, obj);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -175,13 +175,13 @@
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] obj Pointer to the object structure to fill in
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-static enum tfm_sst_err_t sst_read_encrypted_object(uint32_t uuid,
+static enum psa_sst_err_t sst_read_encrypted_object(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_core_obj_info_t obj_info;
uint32_t plaintext_size;
@@ -192,7 +192,7 @@
/* Get the current size of the encrypted object in the object system */
err = sst_core_object_get_info(uuid, &obj_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -206,38 +206,38 @@
err = sst_core_object_read(uuid, (uint8_t *)obj,
SST_OBJECT_START_POSITION,
obj_info.size_current);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
/* Decrypt the object data */
err = sst_object_auth_decrypt(plaintext_size, obj);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_encrypted_object_read(uint32_t uuid,
+enum psa_sst_err_t sst_encrypted_object_read(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_read_encrypted_object(uuid, s_token, obj);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_encrypted_object_write(uint32_t uuid,
+enum psa_sst_err_t sst_encrypted_object_write(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* FIXME: The token structure needs to be used when the key derivation
* mechanism is in place to generate the specific object key.
@@ -246,7 +246,7 @@
/* Encrypt the object data */
err = sst_object_auth_encrypt(obj->header.info.size_current, obj);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
diff --git a/secure_fw/services/secure_storage/sst_encrypted_object.h b/secure_fw/services/secure_storage/sst_encrypted_object.h
index b0d63f4..7fc715d 100644
--- a/secure_fw/services/secure_storage/sst_encrypted_object.h
+++ b/secure_fw/services/secure_storage/sst_encrypted_object.h
@@ -28,9 +28,9 @@
* internal copies. So, this object will contain the encrypted object
* stored in the flash.
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_encrypted_object_create(uint32_t uuid,
+enum psa_sst_err_t sst_encrypted_object_create(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj);
@@ -41,9 +41,9 @@
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] obj Pointer to the object structure to fill in
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_encrypted_object_read(uint32_t uuid,
+enum psa_sst_err_t sst_encrypted_object_read(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj);
@@ -59,9 +59,9 @@
* internal copies. So, this object will contain the encrypted object
* stored in the flash.
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_encrypted_object_write(uint32_t uuid,
+enum psa_sst_err_t sst_encrypted_object_write(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
struct sst_object_t *obj);
diff --git a/secure_fw/services/secure_storage/sst_object_defs.h b/secure_fw/services/secure_storage/sst_object_defs.h
index af72ef3..2dae3c5 100644
--- a/secure_fw/services/secure_storage/sst_object_defs.h
+++ b/secure_fw/services/secure_storage/sst_object_defs.h
@@ -10,8 +10,7 @@
#include <stdint.h>
#include "assets/sst_asset_defs.h"
-#include "tfm_sst_defs.h"
-#include "tfm_sst_asset_defs.h"
+#include "psa_sst_asset_defs.h"
#ifdef SST_ENCRYPTION
#include "crypto/sst_crypto_interface.h"
@@ -28,8 +27,8 @@
#endif
uint32_t uuid; /*!< Asset ID */
uint32_t version; /*!< Asset version */
- struct tfm_sst_asset_info_t info; /*!< Asset information */
- struct tfm_sst_asset_attrs_t attr; /*!< Asset attributes */
+ struct psa_sst_asset_info_t info; /*!< Asset information */
+ struct psa_sst_asset_attrs_t attr; /*!< Asset attributes */
};
/* The object to be written to the file system below. Made up of the
diff --git a/secure_fw/services/secure_storage/sst_object_system.c b/secure_fw/services/secure_storage/sst_object_system.c
index ff54401..cfb09cd 100644
--- a/secure_fw/services/secure_storage/sst_object_system.c
+++ b/secure_fw/services/secure_storage/sst_object_system.c
@@ -37,7 +37,7 @@
* \param[in] size Object size
* \param[out] obj Object to
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
static void sst_object_init_object(uint32_t uuid, uint32_t type, uint32_t size,
struct sst_object_t *obj)
@@ -52,13 +52,13 @@
obj->header.info.type = type;
}
-enum tfm_sst_err_t sst_system_prepare(void)
+enum psa_sst_err_t sst_system_prepare(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
sst_global_lock();
err = sst_core_prepare();
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
sst_system_ready = SST_SYSTEM_READY;
}
sst_global_unlock();
@@ -66,12 +66,12 @@
return err;
}
-enum tfm_sst_err_t sst_object_read(uint32_t uuid,
+enum psa_sst_err_t sst_object_read(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
uint8_t *data, uint32_t offset,
uint32_t size)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
#ifndef SST_ENCRYPTION
(void)s_token;
@@ -91,7 +91,7 @@
err = sst_core_object_read(uuid, (uint8_t *)&g_sst_object.header,
SST_OBJECT_START_POSITION,
SST_OBJECT_HEADER_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -102,7 +102,7 @@
g_sst_object.header.info.size_current);
}
#endif
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -110,7 +110,7 @@
err = sst_utils_check_contained_in(SST_OBJECT_START_POSITION,
g_sst_object.header.info.size_current,
offset, size);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -127,11 +127,11 @@
return err;
}
-enum tfm_sst_err_t sst_object_create(uint32_t uuid,
+enum psa_sst_err_t sst_object_create(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
uint32_t type, uint32_t size)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
#ifndef SST_ENCRYPTION
(void)s_token;
@@ -141,7 +141,7 @@
sst_global_lock();
/* Check if it already exists */
err = sst_core_object_exist(uuid);
- if (err == TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err == PSA_SST_ERR_ASSET_NOT_FOUND) {
/* Initialize object based on the input arguments */
sst_object_init_object(uuid, type, size, &g_sst_object);
@@ -153,7 +153,7 @@
* in the object.
*/
err = sst_core_object_create(uuid, SST_OBJECT_SIZE(size));
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -168,12 +168,12 @@
return err;
}
-enum tfm_sst_err_t sst_object_write(uint32_t uuid,
+enum psa_sst_err_t sst_object_write(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
const uint8_t *data, uint32_t offset,
uint32_t size)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
#ifndef SST_ENCRYPTION
(void)s_token;
@@ -194,7 +194,7 @@
err = sst_core_object_read(uuid, (uint8_t *)&g_sst_object.header,
SST_OBJECT_START_POSITION,
SST_OBJECT_HEADER_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -205,7 +205,7 @@
g_sst_object.header.info.size_current);
}
#endif
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -213,7 +213,7 @@
* prevent gaps being created in the object data.
*/
if (offset > g_sst_object.header.info.size_current) {
- return TFM_SST_ERR_PARAM_ERROR;
+ return PSA_SST_ERR_PARAM_ERROR;
}
@@ -249,11 +249,11 @@
return err;
}
-enum tfm_sst_err_t sst_object_get_info(uint32_t uuid,
+enum psa_sst_err_t sst_object_get_info(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info)
+ struct psa_sst_asset_info_t *info)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
#ifndef SST_ENCRYPTION
(void)s_token;
@@ -270,12 +270,12 @@
SST_OBJECT_START_POSITION,
SST_OBJECT_HEADER_SIZE);
#endif
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
sst_utils_memcpy(info, &g_sst_object.header.info,
- TFM_SST_ASSET_INFO_SIZE);
+ PSA_SST_ASSET_INFO_SIZE);
sst_global_unlock();
}
@@ -283,11 +283,11 @@
return err;
}
-enum tfm_sst_err_t sst_object_get_attributes(uint32_t uuid,
+enum psa_sst_err_t sst_object_get_attributes(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs)
+ struct psa_sst_asset_attrs_t *attrs)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
#ifndef SST_ENCRYPTION
(void)s_token;
@@ -304,12 +304,12 @@
SST_OBJECT_START_POSITION,
SST_OBJECT_HEADER_SIZE);
#endif
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
sst_utils_memcpy(attrs, &g_sst_object.header.attr,
- TFM_SST_ASSET_ATTR_SIZE);
+ PSA_SST_ASSET_ATTR_SIZE);
sst_global_unlock();
}
@@ -317,11 +317,11 @@
return err;
}
-enum tfm_sst_err_t sst_object_set_attributes(uint32_t uuid,
+enum psa_sst_err_t sst_object_set_attributes(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs)
+ const struct psa_sst_asset_attrs_t *attrs)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
#ifndef SST_ENCRYPTION
(void)s_token;
@@ -338,13 +338,13 @@
SST_OBJECT_START_POSITION,
SST_OBJECT_HEADER_SIZE);
#endif
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
/* Set new attributes */
sst_utils_memcpy(&g_sst_object.header.attr,
- attrs, TFM_SST_ASSET_ATTR_SIZE);
+ attrs, PSA_SST_ASSET_ATTR_SIZE);
#ifdef SST_ENCRYPTION
err = sst_encrypted_object_write(uuid, s_token, &g_sst_object);
@@ -360,10 +360,10 @@
return err;
}
-enum tfm_sst_err_t sst_object_delete(uint32_t uuid,
+enum psa_sst_err_t sst_object_delete(uint32_t uuid,
const struct tfm_sst_token_t *s_token)
{
- enum tfm_sst_err_t err = TFM_SST_ERR_SYSTEM_ERROR;
+ enum psa_sst_err_t err = PSA_SST_ERR_SYSTEM_ERROR;
/* FIXME: Authenticate object data to validate token before delete it. */
(void)s_token;
@@ -377,9 +377,9 @@
return err;
}
-enum tfm_sst_err_t sst_system_wipe_all(void)
+enum psa_sst_err_t sst_system_wipe_all(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* This function may get called as a corrective action
* if a system level security violation is detected.
* This could be asynchronous to normal system operation
diff --git a/secure_fw/services/secure_storage/sst_object_system.h b/secure_fw/services/secure_storage/sst_object_system.h
index e840901..7eaed6f 100644
--- a/secure_fw/services/secure_storage/sst_object_system.h
+++ b/secure_fw/services/secure_storage/sst_object_system.h
@@ -20,9 +20,9 @@
* structures.
* It identifies and validates the system metadata.
*
- * \return Returns TFM_SST_ERR_SUCCESS or TFM_SST_ERR_INIT_FAILED
+ * \return Returns PSA_SST_ERR_SUCCESS or PSA_SST_ERR_INIT_FAILED
*/
-enum tfm_sst_err_t sst_system_prepare(void);
+enum psa_sst_err_t sst_system_prepare(void);
/**
* \brief Creates a new object with given object UUID.
@@ -32,9 +32,9 @@
* \param[in] type Object type
* \param[in] size Object size
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_create(uint32_t uuid,
+enum psa_sst_err_t sst_object_create(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
uint32_t type, uint32_t size);
@@ -48,9 +48,9 @@
* \param[in] offset Offset from where the read is going to start
* \param[in] size Data buffer size
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_read(uint32_t uuid,
+enum psa_sst_err_t sst_object_read(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
uint8_t *data, uint32_t offset,
uint32_t size);
@@ -63,10 +63,10 @@
* \param[in] offset Offset from where the write is going to start
* \param[in] size Data buffer size
*
- * \return Returns number of bytes read or a relevant error \ref tfm_sst_err_t
+ * \return Returns number of bytes read or a relevant error \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_write(uint32_t uuid,
- const struct tfm_sst_token_t *s_token,
+enum psa_sst_err_t sst_object_write(uint32_t uuid,
+ const struct tfm_sst_token_t *s_token,
const uint8_t *data, uint32_t offset,
uint32_t size);
/**
@@ -75,9 +75,9 @@
* \param[in] uuid Object UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_delete(uint32_t uuid,
+enum psa_sst_err_t sst_object_delete(uint32_t uuid,
const struct tfm_sst_token_t *s_token);
/**
@@ -86,13 +86,13 @@
* \param[in] uuid Object UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] info Pointer to store the object's information
- * \ref struct tfm_sst_asset_info_t
+ * \ref struct psa_sst_asset_info_t
*
- * \return Returns error code specified in \ref tfm_sst_err_t
+ * \return Returns error code specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_get_info(uint32_t uuid,
+enum psa_sst_err_t sst_object_get_info(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_info_t *info);
+ struct psa_sst_asset_info_t *info);
/**
* \brief Gets the object attributes referenced by object UUID.
@@ -100,33 +100,33 @@
* \param[in] uuid Object UUID
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[out] attrs Pointer to store the object's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_get_attributes(uint32_t uuid,
+enum psa_sst_err_t sst_object_get_attributes(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
- struct tfm_sst_asset_attrs_t *attrs);
+ struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Sets the specific object attributes referenced by object UUID.
*
* \param[in] uuid Object UUID \ref tfm_sst_token_t
* \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
* \param[in] attrs Pointer to new the object's attributes
- * \ref tfm_sst_asset_attrs_t
+ * \ref psa_sst_asset_attrs_t
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_object_set_attributes(uint32_t uuid,
+enum psa_sst_err_t sst_object_set_attributes(uint32_t uuid,
const struct tfm_sst_token_t *s_token,
- const struct tfm_sst_asset_attrs_t *attrs);
+ const struct psa_sst_asset_attrs_t *attrs);
/**
* \brief Wipes secure storage system and all object data.
*
* \return Returns error code specified in \ref sst_errno_t
*/
-enum tfm_sst_err_t sst_system_wipe_all(void);
+enum psa_sst_err_t sst_system_wipe_all(void);
#ifdef __cplusplus
}
diff --git a/secure_fw/services/secure_storage/sst_utils.c b/secure_fw/services/secure_storage/sst_utils.c
index cd84301..5b676ee 100644
--- a/secure_fw/services/secure_storage/sst_utils.c
+++ b/secure_fw/services/secure_storage/sst_utils.c
@@ -23,12 +23,12 @@
return;
}
-enum tfm_sst_err_t sst_utils_memory_bound_check(void *addr,
+enum psa_sst_err_t sst_utils_memory_bound_check(void *addr,
uint32_t size,
uint32_t app_id,
uint32_t access)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* FIXME:
* The only check that may be required is whether the caller app
@@ -41,24 +41,24 @@
return err;
}
-enum tfm_sst_err_t sst_utils_bound_check_and_copy(uint8_t *src,
+enum psa_sst_err_t sst_utils_bound_check_and_copy(uint8_t *src,
uint8_t *dest,
uint32_t size,
uint32_t app_id)
{
- enum tfm_sst_err_t bound_check;
+ enum psa_sst_err_t bound_check;
/* src is passed on from untrusted domain, verify boundry */
bound_check = sst_utils_memory_bound_check(src, size, app_id,
TFM_MEMORY_ACCESS_RO);
- if (bound_check == TFM_SST_ERR_SUCCESS) {
+ if (bound_check == PSA_SST_ERR_SUCCESS) {
sst_utils_memcpy(dest, src, size);
}
return bound_check;
}
-enum tfm_sst_err_t sst_utils_check_contained_in(uint32_t superset_start,
+enum psa_sst_err_t sst_utils_check_contained_in(uint32_t superset_start,
uint32_t superset_size,
uint32_t subset_start,
uint32_t subset_size)
@@ -74,12 +74,12 @@
uint64_t tmp_superset_size = superset_size;
uint64_t tmp_subset_start = subset_start;
uint64_t tmp_subset_size = subset_size;
- enum tfm_sst_err_t err = TFM_SST_ERR_SUCCESS;
+ enum psa_sst_err_t err = PSA_SST_ERR_SUCCESS;
if ((tmp_subset_start < tmp_superset_start) ||
((tmp_subset_start + tmp_subset_size) >
(tmp_superset_start + tmp_superset_size))) {
- err = TFM_SST_ERR_PARAM_ERROR;
+ err = PSA_SST_ERR_PARAM_ERROR;
}
return err;
}
@@ -96,13 +96,13 @@
*
* \return Returns 1 if the asset ID is valid, otherwise 0.
*/
-enum tfm_sst_err_t sst_utils_validate_uuid(uint32_t unique_id)
+enum psa_sst_err_t sst_utils_validate_uuid(uint32_t unique_id)
{
if (unique_id == SST_INVALID_UUID) {
- return TFM_SST_ERR_ASSET_NOT_FOUND;
+ return PSA_SST_ERR_ASSET_NOT_FOUND;
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
/* FIXME: following functions are not optimized and will eventually to be
diff --git a/secure_fw/services/secure_storage/sst_utils.h b/secure_fw/services/secure_storage/sst_utils.h
index 9ef41e5..f125d24 100644
--- a/secure_fw/services/secure_storage/sst_utils.h
+++ b/secure_fw/services/secure_storage/sst_utils.h
@@ -50,9 +50,9 @@
* \param[in] app_id Application ID
* \param[in] access Access type to be permormed on the given address
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_utils_memory_bound_check(void *addr,
+enum psa_sst_err_t sst_utils_memory_bound_check(void *addr,
uint32_t size,
uint32_t app_id,
uint32_t access);
@@ -65,9 +65,9 @@
* \param[in] size Size of the incoming buffer
* \param[in] app_id App_id for the incoming buffer
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_utils_bound_check_and_copy(uint8_t *src,
+enum psa_sst_err_t sst_utils_bound_check_and_copy(uint8_t *src,
uint8_t *dest,
uint32_t size,
uint32_t app_id);
@@ -80,9 +80,9 @@
* \param[in] subset_start Start of subset region
* \param[in] subset_size Size of the subset region
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_utils_check_contained_in(uint32_t superset_start,
+enum psa_sst_err_t sst_utils_check_contained_in(uint32_t superset_start,
uint32_t superset_size,
uint32_t subset_start,
uint32_t subset_size);
@@ -124,9 +124,9 @@
*
* \param[in] unique_id Asset's ID
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_utils_validate_uuid(uint32_t unique_id);
+enum psa_sst_err_t sst_utils_validate_uuid(uint32_t unique_id);
#ifdef __cplusplus
}
diff --git a/test/framework/helpers.c b/test/framework/helpers.c
index 5ae14fa..be2d188 100755
--- a/test/framework/helpers.c
+++ b/test/framework/helpers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,23 +9,23 @@
#include <stdio.h>
-const char *sst_err_to_str(enum tfm_sst_err_t err)
+const char *sst_err_to_str(enum psa_sst_err_t err)
{
switch (err) {
- case TFM_SST_ERR_SUCCESS:
- return "TFM_SST_ERR_SUCCESS";
- case TFM_SST_ERR_ASSET_NOT_PREPARED:
- return "TFM_SST_ERR_ASSET_NOT_PREPARED";
- case TFM_SST_ERR_ASSET_NOT_FOUND:
- return "TFM_SST_ERR_ASSET_NOT_FOUND";
- case TFM_SST_ERR_PARAM_ERROR:
- return "TFM_SST_ERR_PARAM_ERROR";
- case TFM_SST_ERR_STORAGE_SYSTEM_FULL:
- return "TFM_SST_ERR_STORAGE_SYSTEM_FULL";
- case TFM_SST_ERR_SYSTEM_ERROR:
- return "TFM_SST_ERR_SYSTEM_ERROR";
- case TFM_SST_ERR_FORCE_INT_SIZE:
- return "TFM_SST_ERR_FORCE_INT_SIZE";
+ case PSA_SST_ERR_SUCCESS:
+ return "PSA_SST_ERR_SUCCESS";
+ case PSA_SST_ERR_ASSET_NOT_PREPARED:
+ return "PSA_SST_ERR_ASSET_NOT_PREPARED";
+ case PSA_SST_ERR_ASSET_NOT_FOUND:
+ return "PSA_SST_ERR_ASSET_NOT_FOUND";
+ case PSA_SST_ERR_PARAM_ERROR:
+ return "PSA_SST_ERR_PARAM_ERROR";
+ case PSA_SST_ERR_STORAGE_SYSTEM_FULL:
+ return "PSA_SST_ERR_STORAGE_SYSTEM_FULL";
+ case PSA_SST_ERR_SYSTEM_ERROR:
+ return "PSA_SST_ERR_SYSTEM_ERROR";
+ case PSA_SST_ERR_FORCE_INT_SIZE:
+ return "PSA_SST_ERR_FORCE_INT_SIZE";
/* default: The default is not defined intentionally to force the
* compiler to check that all the enumeration values are
* covered in the switch.
diff --git a/test/framework/helpers.h b/test/framework/helpers.h
index 517c4b0..c0e7a7a 100755
--- a/test/framework/helpers.h
+++ b/test/framework/helpers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -29,13 +29,13 @@
};
/**
- * \brief Translates tfm_sst_err_t into a string.
+ * \brief Translates psa_sst_err_t into a string.
*
- * \param[in] err tfm_sst_err_t error value.
+ * \param[in] err psa_sst_err_t error value.
*
- * \return tfm_sst_err_t as string.
+ * \return psa_sst_err_t as string.
*/
-const char *sst_err_to_str(enum tfm_sst_err_t err);
+const char *sst_err_to_str(enum psa_sst_err_t err);
/**
* \brief Translates asset permissions into a string.
diff --git a/test/interface/include/sst_test_service_svc.h b/test/interface/include/sst_test_service_svc.h
index 4860644..633c7e4 100644
--- a/test/interface/include/sst_test_service_svc.h
+++ b/test/interface/include/sst_test_service_svc.h
@@ -19,9 +19,9 @@
* \brief Sets-up the SST test service so that it is ready for test functions to
* be called.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_svc_setup(void);
+enum psa_sst_err_t sst_test_service_svc_setup(void);
/**
* \brief Performs a dummy encryption on the supplied buffer, using the key
@@ -31,9 +31,9 @@
* \param[in,out] buf Plaintext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_svc_dummy_encrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_svc_dummy_encrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
@@ -45,18 +45,18 @@
* \param[in,out] buf Ciphertext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_svc_dummy_decrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_svc_dummy_decrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
/**
* \brief Cleans the secure storage used by the SST test service.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_svc_clean(void);
+enum psa_sst_err_t sst_test_service_svc_clean(void);
#ifdef __cplusplus
}
diff --git a/test/suites/sst/non_secure/sst_ns_interface_testsuite.c b/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
index e45da5c..4da97a9 100644
--- a/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
+++ b/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
@@ -13,7 +13,7 @@
#include "ns_test_helpers.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
#include "test/framework/helpers.h"
-#include "tfm_sst_api.h"
+#include "psa_sst_api.h"
/* Test suite defines */
#define INVALID_ASSET_ID 0xFFFF
@@ -191,32 +191,32 @@
TFM_SST_NS_TEST(1001, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Checks write permissions in create function */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
/* Attempts to create the asset a second time */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Should not fail to create an already-created asset");
return;
}
/* Calls create with invalid asset ID */
- err = tfm_sst_create(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_create(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should fail for invalid ASSET ID");
return;
}
/* Calls delete asset to clean up SST area for next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -230,11 +230,11 @@
TFM_SST_NS_TEST(1002, INVALID_THREAD_NAME)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Calls create function with an invalid thread name */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should not succeed with an invalid thread name");
return;
}
@@ -286,12 +286,12 @@
TFM_SST_NS_TEST(1006, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
- enum tfm_sst_err_t err;
+ struct psa_sst_asset_info_t asset_info;
+ enum psa_sst_err_t err;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -299,9 +299,9 @@
/* Calls get information with valid application ID and
* attributes struct pointer
*/
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Thread_C should read the information of this asset");
return;
}
@@ -318,17 +318,17 @@
}
/* Calls get_attributes with invalid asset ID */
- err = tfm_sst_get_info(INVALID_ASSET_ID, ASSET_TOKEN,
+ err = psa_sst_get_info(INVALID_ASSET_ID, ASSET_TOKEN,
ASSET_TOKEN_SIZE, &asset_info);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Get information function should fail for an invalid "
"asset ID");
return;
}
/* Deletes asset to clean up the SST area for the next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -342,10 +342,10 @@
static void tfm_sst_test_1007_task_1(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail");
return;
}
@@ -359,12 +359,12 @@
static void tfm_sst_test_1007_task_2(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- struct tfm_sst_asset_info_t asset_info;
- enum tfm_sst_err_t err;
+ struct psa_sst_asset_info_t asset_info;
+ enum psa_sst_err_t err;
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Get info should not succeed with invalid thread name");
return;
}
@@ -378,10 +378,10 @@
static void tfm_sst_test_1007_task_3(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -416,26 +416,26 @@
TFM_SST_NS_TEST(1008, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
/* Calls get information with a null struct info pointer */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE, NULL);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE, NULL);
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Get info function should fail for a null "
"struct attributes pointer");
return;
}
/* Calls delete asset to clean up SST area for next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -451,14 +451,14 @@
TFM_SST_NS_TEST(1009, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
- enum tfm_sst_err_t err;
+ struct psa_sst_asset_info_t asset_info;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -469,9 +469,9 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should work correctly");
return;
}
@@ -479,9 +479,9 @@
/* Calls get information with valid application ID and
* attributes struct pointer
*/
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Thread_C should read the information of this asset");
return;
}
@@ -493,16 +493,16 @@
}
/* Calls write function with invalid application ID */
- err = tfm_sst_write(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Invalid asset ID should not write in the asset");
return;
}
/* Deletes asset to clean up the SST area for the next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -516,10 +516,10 @@
static void tfm_sst_test_1010_task_1(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail");
return;
}
@@ -533,12 +533,12 @@
static void tfm_sst_test_1010_task_2(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data = {0};
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should not succeed with an invalid thread name");
return;
}
@@ -552,10 +552,10 @@
static void tfm_sst_test_1010_task_3(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -591,12 +591,12 @@
TFM_SST_NS_TEST(1011, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -607,16 +607,16 @@
io_data.offset = 0;
/* Calls write function with data pointer set to NULL */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail with data pointer set to NULL");
return;
}
/* Calls delete asset to clean up SST area for next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -631,13 +631,13 @@
TFM_SST_NS_TEST(1012, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data[SST_ASSET_MAX_SIZE_AES_KEY_192] = {0};
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -647,9 +647,9 @@
io_data.size = BUFFER_PLUS_PADDING_SIZE;
io_data.offset = 0;
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Writing beyond end of asset should not succeed");
return;
}
@@ -658,16 +658,16 @@
io_data.size = 1;
io_data.offset = SST_ASSET_MAX_SIZE_AES_KEY_192;
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Write to an offset beyond end of asset should not succeed");
return;
}
/* Calls delete asset to clean up SST area for next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -683,14 +683,14 @@
TFM_SST_NS_TEST(1013, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -701,9 +701,9 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should work correctly");
return;
}
@@ -714,9 +714,9 @@
io_data.offset = 0;
/* Read data from the asset */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should work correctly");
return;
}
@@ -738,17 +738,17 @@
}
/* Calls read with invalid asset ID */
- err = tfm_sst_read(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail when read is called with an invalid "
"asset ID");
return;
}
/* Deletes asset to clean up the SST area for the next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -762,10 +762,10 @@
static void tfm_sst_test_1014_task_1(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail");
return;
}
@@ -779,7 +779,7 @@
static void tfm_sst_test_1014_task_2(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
@@ -788,9 +788,9 @@
io_data.size = 1;
io_data.offset = 0;
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should not succeed with an invalid thread name");
return;
}
@@ -804,10 +804,10 @@
static void tfm_sst_test_1014_task_3(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -843,12 +843,12 @@
TFM_SST_NS_TEST(1015, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -858,16 +858,16 @@
io_data.offset = 0;
/* Calls read with null read data pointer */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read with read data pointer set to NULL should fail");
return;
}
/* Calls delete asset to clean up SST area for next test */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -882,15 +882,15 @@
TFM_SST_NS_TEST(1016, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -901,17 +901,17 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should work correctly");
return;
}
/* Gets current asset information */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Thread_C should read the information of this asset");
return;
}
@@ -927,9 +927,9 @@
io_data.size = WRITE_BUF_SIZE + 1;
io_data.offset = 0;
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Read beyond current size should not succeed");
return;
}
@@ -938,9 +938,9 @@
io_data.size = 1;
io_data.offset = asset_info.size_current;
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Read from an offset beyond current size should not succeed");
return;
}
@@ -956,33 +956,33 @@
TFM_SST_NS_TEST(1017, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Creates assset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should not fail as thread has"
" write permissions");
return;
}
/* Calls delete with a deleted asset ID */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("The delete action should fail as asset was deleted");
return;
}
/* Calls delete asset with invalid asset ID */
- err = tfm_sst_delete(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(INVALID_ASSET_ID, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("The delete action should fail as asset ID is not valid");
return;
}
@@ -996,10 +996,10 @@
static void tfm_sst_test_1018_task_1(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail");
return;
}
@@ -1013,10 +1013,10 @@
static void tfm_sst_test_1018_task_2(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Delete should not succeed with an invalid thread name");
return;
}
@@ -1030,10 +1030,10 @@
static void tfm_sst_test_1018_task_3(struct test_result_t *ret)
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -1072,11 +1072,11 @@
static void tfm_sst_test_1019_task_1(struct test_result_t *ret)
{
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA384_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Creates asset 2 first to locate it at the beginning of the data block */
- err = tfm_sst_create(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -1088,12 +1088,12 @@
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_SHA224_HASH;
struct sst_test_buf_t io_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t wrt_data[BUF_SIZE_SHA224] = WRITE_DATA_SHA224_1;
/* Creates asset 1 */
- err = tfm_sst_create(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1104,9 +1104,9 @@
io_data.offset = 0;
/* Writes data into asset 1 */
- err = tfm_sst_write(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for Thread_B");
return;
}
@@ -1117,13 +1117,13 @@
static void tfm_sst_test_1019_task_3(struct test_result_t *ret)
{
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA384_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Deletes asset 2. After the delete call, asset 1 should be at the
* beginning of the block.
*/
- err = tfm_sst_delete(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1134,7 +1134,7 @@
static void tfm_sst_test_1019_task_4(struct test_result_t *ret)
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[BUF_SIZE_SHA224] = READ_DATA_SHA224;
uint8_t wrt_data[BUF_SIZE_SHA224] = WRITE_DATA_SHA224_1;
@@ -1147,9 +1147,9 @@
/* If the compact worked as expected, the test should be able to read back
* the data from asset 1 correctly.
*/
- err = tfm_sst_read(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail for Thread_B");
return;
}
@@ -1160,8 +1160,8 @@
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1195,15 +1195,15 @@
TFM_SST_NS_TEST(1020, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint32_t i;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -1214,10 +1214,10 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Write should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Write should works correctly");
return;
}
@@ -1229,12 +1229,12 @@
for (i = 0; i < WRITE_BUF_SIZE; i++) {
/* Read data from the asset */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
#ifdef SST_ENABLE_PARTIAL_ASSET_RW
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
#else
- if (io_data.offset != 0 && err != TFM_SST_ERR_PARAM_ERROR) {
+ if (io_data.offset != 0 && err != PSA_SST_ERR_PARAM_ERROR) {
#endif
TEST_FAIL("Read did not behave correctly");
return;
@@ -1270,8 +1270,8 @@
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1286,13 +1286,13 @@
TFM_SST_NS_TEST(1021, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data[BUF_SIZE_SHA224] = {0};
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1303,16 +1303,16 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Should have failed asset write of too large");
return;
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1327,15 +1327,15 @@
TFM_SST_NS_TEST(1022, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t wrt_data[WRITE_BUF_SIZE+1] = "Hello";
uint8_t wrt_data2[WRITE_BUF_SIZE+1] = "World";
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1346,9 +1346,9 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 1 failed");
return;
}
@@ -1359,9 +1359,9 @@
io_data.offset = WRITE_BUF_SIZE;
/* Writes data 2 in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 2 failed");
return;
}
@@ -1372,9 +1372,9 @@
io_data.offset = 0;
/* Reads back the data */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1385,8 +1385,8 @@
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1400,15 +1400,15 @@
TFM_SST_NS_TEST(1023, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[BUF_SIZE_SHA224] = READ_DATA_SHA224;
uint8_t wrt_data[BUF_SIZE_SHA224] = WRITE_DATA_SHA224_1;
uint8_t wrt_data2[BUF_SIZE_SHA224] = WRITE_DATA_SHA224_2;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1419,9 +1419,9 @@
io_data.offset = 0;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 1 failed");
return;
}
@@ -1432,9 +1432,9 @@
io_data.offset = WRITE_BUF_SIZE;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Write data 2 should have failed as this write tries to "
"write more bytes that the max size");
return;
@@ -1446,9 +1446,9 @@
io_data.offset = WRITE_BUF_SIZE;
/* Writes data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 3 failed");
return;
}
@@ -1459,9 +1459,9 @@
io_data.offset = 0;
/* Read back the data */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1472,8 +1472,8 @@
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1487,11 +1487,11 @@
static void tfm_sst_test_1024_task_1(struct test_result_t *ret)
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Creates asset 1 */
- err = tfm_sst_create(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -1502,11 +1502,11 @@
static void tfm_sst_test_1024_task_2(struct test_result_t *ret)
{
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Creates asset 2 */
- err = tfm_sst_create(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1517,7 +1517,7 @@
static void tfm_sst_test_1024_task_3(struct test_result_t *ret)
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data[WRITE_BUF_SIZE+1] = "Hello";
@@ -1527,9 +1527,9 @@
io_data.offset = 0;
/* Writes data in asset 1 */
- err = tfm_sst_write(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for Thread_C");
return;
}
@@ -1540,7 +1540,7 @@
static void tfm_sst_test_1024_task_4(struct test_result_t *ret)
{
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data2[3] = "Hi";
@@ -1550,9 +1550,9 @@
io_data.size = 2;
io_data.offset = 0;
- err = tfm_sst_write(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for Thread_B");
return;
}
@@ -1563,7 +1563,7 @@
static void tfm_sst_test_1024_task_5(struct test_result_t *ret)
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data3[WRITE_BUF_SIZE+1] = "World";
@@ -1573,9 +1573,9 @@
io_data.offset = WRITE_BUF_SIZE;
/* Writes data 3 in asset 1 */
- err = tfm_sst_write(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for Thread_C");
return;
}
@@ -1586,7 +1586,7 @@
static void tfm_sst_test_1024_task_6(struct test_result_t *ret)
{
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t wrt_data4[WRITE_BUF_SIZE+1] = "12345";
@@ -1596,9 +1596,9 @@
io_data.offset = 2;
/* Writes data 4 in asset 2 */
- err = tfm_sst_write(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for Thread_B");
return;
}
@@ -1609,7 +1609,7 @@
static void tfm_sst_test_1024_task_7(struct test_result_t *ret)
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
@@ -1620,9 +1620,9 @@
io_data.offset = 0;
/* Read back the asset 1 */
- err = tfm_sst_read(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail for Thread_C");
return;
}
@@ -1638,7 +1638,7 @@
static void tfm_sst_test_1024_task_8(struct test_result_t *ret)
{
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
@@ -1648,9 +1648,9 @@
io_data.offset = 0;
/* Read back the asset 1 */
- err = tfm_sst_read(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1661,8 +1661,8 @@
}
/* Calls delete asset */
- err = tfm_sst_delete(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid_2, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1673,11 +1673,11 @@
static void tfm_sst_test_1024_task_9(struct test_result_t *ret)
{
const uint32_t asset_uuid_1 = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Calls delete asset 1 */
- err = tfm_sst_delete(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid_1, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -1737,12 +1737,12 @@
TFM_SST_NS_TEST(1025, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1753,24 +1753,24 @@
io_data.offset = 0;
/* Calls write with a ROM address location */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a ROM address location */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
/* Deletes asset to clean up the SST area */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -1784,12 +1784,12 @@
TFM_SST_NS_TEST(1026, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1800,24 +1800,24 @@
io_data.offset = 0;
/* Calls write with a device address location */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a device address location */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
/* Deletes asset to clean up the SST area */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -1831,12 +1831,12 @@
TFM_SST_NS_TEST(1027, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1847,24 +1847,24 @@
io_data.offset = 0;
/* Calls write with a non-existing address location */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a non-existing address location */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
/* Deletes asset to clean up the SST area */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -1878,12 +1878,12 @@
TFM_SST_NS_TEST(1028, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -1894,24 +1894,24 @@
io_data.offset = 0;
/* Calls write with a secure address location */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a secure address location */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
/* Deletes asset to clean up the SST area */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail");
return;
}
@@ -1925,17 +1925,17 @@
*/
TFM_SST_NS_TEST(1029, "Thread_C")
{
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct sst_test_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t wrt_data_1[WRITE_BUF_SIZE] = "AAAA";
uint8_t wrt_data_2[2] = "B";
/* Creates asset */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -1946,16 +1946,16 @@
io_data.offset = 0;
/* Write data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("First write should not fail");
return;
}
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Thread_C should read the information of this asset");
return;
}
@@ -1972,16 +1972,16 @@
io_data.offset = 1;
/* Write data in the asset */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Second write should not fail");
return;
}
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Thread_C should read the information of this asset");
return;
}
@@ -1997,9 +1997,9 @@
io_data.offset = 0;
/* Calls read with a non-existing address location */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail");
return;
}
@@ -2017,9 +2017,9 @@
io_data.size = 1;
io_data.offset = (asset_info.size_current + 1);
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
io_data.size, io_data.offset, io_data.data);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Write must fail if the offset is bigger than the current"
" asset's size");
return;
@@ -2035,40 +2035,40 @@
TFM_SST_NS_TEST(1030, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- struct tfm_sst_asset_attrs_t wrt_attrs;
- struct tfm_sst_asset_attrs_t read_attrs = {
+ struct psa_sst_asset_attrs_t wrt_attrs;
+ struct psa_sst_asset_attrs_t read_attrs = {
.attrs = 0,
.validity.start = 0,
.validity.end = 0 };
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail");
return;
}
- wrt_attrs.attrs = (TFM_SST_ASSET_ATTR_ENCRYPT | TFM_SST_ASSET_ATTR_DECRYPT |
- TFM_SST_ASSET_ATTR_SIGN | TFM_SST_ASSET_ATTR_VERIFY);
+ wrt_attrs.attrs = (PSA_SST_ASSET_ATTR_ENCRYPT | PSA_SST_ASSET_ATTR_DECRYPT |
+ PSA_SST_ASSET_ATTR_SIGN | PSA_SST_ASSET_ATTR_VERIFY);
wrt_attrs.validity.start = 0;
wrt_attrs.validity.end = 0;
- err = tfm_sst_set_attributes(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_set_attributes(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&wrt_attrs);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Set attributes should not fail");
return;
}
- err = tfm_sst_get_attributes(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_attributes(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&read_attrs);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get attributes should not fail");
return;
}
/* Compare asset attributes */
- if (memcmp(&wrt_attrs, &read_attrs, TFM_SST_ASSET_ATTR_SIZE) != 0) {
+ if (memcmp(&wrt_attrs, &read_attrs, PSA_SST_ASSET_ATTR_SIZE) != 0) {
TEST_FAIL("Attributes are differents");
return;
}
diff --git a/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c b/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c
index a09569f..9aa1f78 100644
--- a/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c
+++ b/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c
@@ -61,10 +61,10 @@
*/
TFM_SST_NS_TEST(5001, "Thread_D")
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_test_service_setup();
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Failed to setup the SST test service");
return;
}
@@ -77,12 +77,12 @@
*/
TFM_SST_NS_TEST(5002, "Thread_D")
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint16_t key_uuid = SST_ASSET_ID_AES_KEY_128;
uint8_t buf[BUF_SIZE] = DATA;
err = sst_test_service_dummy_encrypt(key_uuid, buf, BUF_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Encryption should be successful for Thread_D");
return;
}
@@ -93,7 +93,7 @@
}
err = sst_test_service_dummy_decrypt(key_uuid, buf, BUF_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Decryption should be successful for Thread_D");
return;
}
@@ -112,18 +112,18 @@
*/
TFM_SST_NS_TEST(5003, "Thread_C")
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint16_t key_uuid = SST_ASSET_ID_AES_KEY_128;
uint8_t buf[BUF_SIZE] = DATA;
err = sst_test_service_dummy_encrypt(key_uuid, buf, BUF_SIZE);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Encryption should not be successful for Thread_C");
return;
}
err = sst_test_service_dummy_decrypt(key_uuid, buf, BUF_SIZE);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Decryption should not be successful for Thread_C");
return;
}
@@ -136,10 +136,10 @@
*/
TFM_SST_NS_TEST(5004, "Thread_D")
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
err = sst_test_service_clean();
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Cleaning of the SST referenced access service failed");
return;
}
diff --git a/test/suites/sst/non_secure/sst_policy_testsuite.c b/test/suites/sst/non_secure/sst_policy_testsuite.c
index f13a720..d879274 100644
--- a/test/suites/sst/non_secure/sst_policy_testsuite.c
+++ b/test/suites/sst/non_secure/sst_policy_testsuite.c
@@ -12,7 +12,7 @@
#include "ns_test_helpers.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
#include "test/framework/helpers.h"
-#include "tfm_sst_api.h"
+#include "psa_sst_api.h"
/* Define default asset's token */
#define ASSET_TOKEN NULL
@@ -130,15 +130,15 @@
TFM_SST_NS_TEST(4001, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_C;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* The create function requires WRITE permission */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -149,9 +149,9 @@
buf.offset = 0;
/* The write function requires WRITE permission */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for Thread_C");
return;
}
@@ -162,9 +162,9 @@
buf.offset = 0;
/* The read function requires READ permission */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail for Thread_C");
return;
}
@@ -176,9 +176,9 @@
}
/* The get information function requires any permission other than NONE */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail for Thread_C");
return;
}
@@ -207,15 +207,15 @@
TFM_SST_NS_TEST(4002, "Thread_A")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_A;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Create should fail as Thread_A does not have WRITE permission */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should not succeed for Thread_A");
return;
}
@@ -227,9 +227,9 @@
buf.offset = 1;
/* Write should fail as Thread_A does not have WRITE permission */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should not succeed for Thread_A");
return;
}
@@ -240,9 +240,9 @@
buf.offset = 0;
/* Read should fail as Thread_A does not have READ permission */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should not succeed for Thread_A");
return;
}
@@ -254,9 +254,9 @@
}
/* Get information should succeed as Thread_A has at least one permission */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail for Thread_A");
return;
}
@@ -273,8 +273,8 @@
}
/* Delete should fail as Thread_A does not have WRITE permission */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Delete should not succeed for Thread_A");
return;
}
@@ -292,15 +292,15 @@
TFM_SST_NS_TEST(4003, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_B;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Create should fail as Thread_B does not have WRITE permission */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should not succeed for Thread_B");
return;
}
@@ -312,9 +312,9 @@
buf.offset = 2;
/* Write should fail as Thread_B does not have WRITE permission */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should not succeed for Thread_B");
return;
}
@@ -325,9 +325,9 @@
buf.offset = 0;
/* Read should succeed as Thread_B has READ permission */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail for Thread_B");
return;
}
@@ -341,9 +341,9 @@
}
/* Get attributes should succeed as Thread_B has at least one permission */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail for Thread_B");
return;
}
@@ -360,8 +360,8 @@
}
/* Delete should fail as Thread_B does not have WRITE permission */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Delete should not succeed for Thread_B");
return;
}
@@ -382,10 +382,10 @@
TFM_SST_NS_TEST(4004, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for Thread_C");
return;
}
@@ -403,15 +403,15 @@
TFM_SST_NS_TEST(4005, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_B;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Create should succeed as Thread_B has WRITE permission */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_B");
return;
}
@@ -422,9 +422,9 @@
buf.offset = 0;
/* Write should succeed as Thread_B has WRITE permission */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for Thread_B");
return;
}
@@ -435,9 +435,9 @@
buf.offset = 0;
/* Read should succeed as Thread_B has READ permission */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail for Thread_B");
return;
}
@@ -449,9 +449,9 @@
}
/* Get information should succeed as Thread_B has at least one permission */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail for Thread_B");
return;
}
@@ -480,15 +480,15 @@
TFM_SST_NS_TEST(4006, "Thread_A")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- struct tfm_sst_asset_info_t asset_info = { 0 };
+ struct psa_sst_asset_info_t asset_info = { 0 };
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_A;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Create should fail as Thread_A has no permissions */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should not succeed for Thread_A");
return;
}
@@ -503,9 +503,9 @@
* permissions even if it has a valid asset ID. So the write should fail as
* Thread_A has no permissions.
*/
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should not succeed for Thread_A");
return;
}
@@ -516,9 +516,9 @@
buf.offset = 0;
/* Read should fail as Thread_A has no permissions */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should not succeed for Thread_A");
return;
}
@@ -530,9 +530,9 @@
}
/* Get information should fail as Thread_A has no permissions */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Get information should not succeed for Thread_A");
return;
}
@@ -549,8 +549,8 @@
}
/* Delete should fail as Thread_A has no permissions */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Delete should not succeed for Thread_A");
return;
}
@@ -571,11 +571,11 @@
TFM_SST_NS_TEST(4007, "Thread_B")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Delete should succeed as Thread_B has WRITE permission */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for Thread_B");
return;
}
@@ -593,15 +593,15 @@
TFM_SST_NS_TEST(4008, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA384_HASH;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_C;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Create should succeed as Thread_C has WRITE permission */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for Thread_C");
return;
}
@@ -612,9 +612,9 @@
buf.offset = 0;
/* Write should succeed as Thread_C has WRITE permission */
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for Thread_C");
return;
}
@@ -625,9 +625,9 @@
buf.offset = 0;
/* Read should fail as Thread_C does not have READ permission */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should not succeed for Thread_C");
return;
}
@@ -639,9 +639,9 @@
}
/* Get information should succeed as Thread_C has at least one permission */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail for Thread_C");
return;
}
@@ -671,15 +671,15 @@
TFM_SST_NS_TEST(4009, "Thread_A")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA384_HASH;
- struct tfm_sst_asset_info_t asset_info = { 0 };
+ struct psa_sst_asset_info_t asset_info = { 0 };
struct sst_test_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t write_data[WRITE_BUF_SIZE] = WRITE_DATA_A;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Create should fail as Thread_A has no permissions */
- err = tfm_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_create(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should not succeed for Thread_A");
return;
}
@@ -694,9 +694,9 @@
* permissions even if it has a valid asset ID. So the write should fail as
* Thread_A has no permissions.
*/
- err = tfm_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_write(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should not succeed for Thread_A");
return;
}
@@ -707,9 +707,9 @@
buf.offset = 0;
/* Read should fail as Thread_A has no permissions */
- err = tfm_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_read(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
buf.size, buf.offset, buf.data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should not succeed for Thread_A");
return;
}
@@ -721,9 +721,9 @@
}
/* Get information should fail as Thread_A has no permissions */
- err = tfm_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
+ err = psa_sst_get_info(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE,
&asset_info);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Get information should not succeed for Thread_A");
return;
}
@@ -740,8 +740,8 @@
}
/* Delete should fail as Thread_A has no permissions */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Delete should not succeed for Thread_A");
return;
}
@@ -762,11 +762,11 @@
TFM_SST_NS_TEST(4010, "Thread_C")
{
const uint32_t asset_uuid = SST_ASSET_ID_SHA384_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Delete should succeed as Thread_C has WRITE permission */
- err = tfm_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
- if (err != TFM_SST_ERR_SUCCESS) {
+ err = psa_sst_delete(asset_uuid, ASSET_TOKEN, ASSET_TOKEN_SIZE);
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for Thread_C");
return;
}
diff --git a/test/suites/sst/secure/s_test_helpers.c b/test/suites/sst/secure/s_test_helpers.c
index 6eadca1..4a02d03 100755
--- a/test/suites/sst/secure/s_test_helpers.c
+++ b/test/suites/sst/secure/s_test_helpers.c
@@ -19,7 +19,7 @@
sst_system_wipe_all();
/* Prepares secure storage area before write */
- if (sst_system_prepare() != TFM_SST_ERR_SUCCESS) {
+ if (sst_system_prepare() != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Wiped system should be preparable");
return 1;
}
diff --git a/test/suites/sst/secure/sst_reliability_testsuite.c b/test/suites/sst/secure/sst_reliability_testsuite.c
index 610d377..78f8bf9 100644
--- a/test/suites/sst/secure/sst_reliability_testsuite.c
+++ b/test/suites/sst/secure/sst_reliability_testsuite.c
@@ -68,7 +68,7 @@
uint32_t asset_offset = 0;
const uint32_t asset_uuid = SST_ASSET_ID_X509_CERT_LARGE;
struct tfm_sst_buf_t io_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t itr;
uint8_t wrt_data[WRITE_BUF_SIZE] = WRITE_DATA;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
@@ -80,7 +80,7 @@
/* Checks write permissions in create function */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -99,7 +99,7 @@
/* Checks write permissions in the write function */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token,
&io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for application S_APP_ID");
return;
}
@@ -110,7 +110,7 @@
/* Checks write permissions in the read function */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token,
&io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID must get file handle");
return;
}
@@ -137,7 +137,7 @@
/* Checks write permissions in delete function */
err = tfm_sst_veneer_delete(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for application S_APP_ID");
return;
}
@@ -149,7 +149,7 @@
{
uint32_t app_id = S_APP_ID;
struct tfm_sst_buf_t io_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t itr;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
uint8_t data[BUFFER_PLUS_PADDING_SIZE] = {0};
@@ -162,7 +162,7 @@
/* Checks write permissions in create function */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -180,7 +180,7 @@
/* Checks write permissions in the write function */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for application S_APP_ID");
return;
}
@@ -190,7 +190,7 @@
/* Checks write permissions in the read function */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID must get file handle");
return;
}
@@ -219,7 +219,7 @@
/* Checks write permissions in delete function */
err = tfm_sst_veneer_delete(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for application S_APP_ID");
return;
}
@@ -242,7 +242,7 @@
uint32_t asset_offset = 0;
const uint32_t asset_uuid = SST_ASSET_ID_X509_CERT_LARGE;
struct tfm_sst_buf_t io_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t itr;
uint8_t wrt_data[WRITE_BUF_SIZE] = WRITE_DATA;
uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
@@ -260,7 +260,7 @@
/* Checks write permissions in create function */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -273,7 +273,7 @@
/* Checks write permissions in the write function */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token,
&io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for application S_APP_ID");
return;
}
@@ -284,7 +284,7 @@
/* Checks write permissions in the read function */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token,
&io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID must get file handle");
return;
}
@@ -309,7 +309,7 @@
/* Checks write permissions in delete function */
err = tfm_sst_veneer_delete(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for application S_APP_ID");
return;
}
@@ -325,7 +325,7 @@
{
uint32_t app_id = S_APP_ID;
struct tfm_sst_buf_t io_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t itr;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
uint8_t data[BUFFER_PLUS_PADDING_SIZE] = {0};
@@ -344,7 +344,7 @@
/* Checks write permissions in create function */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -356,7 +356,7 @@
/* Checks write permissions in the write function */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write should not fail for application S_APP_ID");
return;
}
@@ -366,7 +366,7 @@
/* Checks write permissions in the read function */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID must get file handle");
return;
}
@@ -392,7 +392,7 @@
/* Checks write permissions in delete function */
err = tfm_sst_veneer_delete(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Delete should not fail for application S_APP_ID");
return;
}
diff --git a/test/suites/sst/secure/sst_sec_interface_testsuite.c b/test/suites/sst/secure/sst_sec_interface_testsuite.c
index 21b7d88..08c3211 100644
--- a/test/suites/sst/secure/sst_sec_interface_testsuite.c
+++ b/test/suites/sst/secure/sst_sec_interface_testsuite.c
@@ -137,7 +137,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Prepares test context */
if (prepare_test_ctx(ret) != 0) {
@@ -147,28 +147,28 @@
/* Checks write permissions in create function */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
/* Attempts to create the asset a second time */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Should not fail to create an already-created asset");
return;
}
/* Calls create with invalid asset ID */
err = tfm_sst_veneer_create(app_id, INVALID_ASSET_ID, &test_token);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should fail for invalid ASSET ID");
return;
}
/* Calls create with invalid application ID */
err = tfm_sst_veneer_create(INVALID_APP_ID, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Create should fail for invalid application ID");
return;
}
@@ -212,8 +212,8 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
- enum tfm_sst_err_t err;
+ struct psa_sst_asset_info_t asset_info;
+ enum psa_sst_err_t err;
/* Prepares test context */
if (prepare_test_ctx(ret) != 0) {
@@ -223,7 +223,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -232,7 +232,7 @@
* attributes struct pointer
*/
err = tfm_sst_veneer_get_info(app_id, asset_uuid, &test_token, &asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID should be able to read the "
"information of this asset");
return;
@@ -252,7 +252,7 @@
/* Calls get_attributes with invalid application ID */
err = tfm_sst_veneer_get_info(INVALID_APP_ID, asset_uuid, &test_token,
&asset_info);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information function should fail for an invalid "
"application ID");
return;
@@ -261,7 +261,7 @@
/* Calls get information with invalid asset ID */
err = tfm_sst_veneer_get_info(app_id, INVALID_ASSET_ID, &test_token,
&asset_info);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get attributes function should fail for an invalid "
"asset ID");
return;
@@ -278,7 +278,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
/* Prepares test context */
if (prepare_test_ctx(ret) != 0) {
@@ -288,14 +288,14 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
/* Calls get information with invalid struct attributes pointer */
err = tfm_sst_veneer_get_info(app_id, asset_uuid, &test_token, NULL);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Get information function should fail for an invalid "
"struct info pointer");
return;
@@ -314,8 +314,8 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
- enum tfm_sst_err_t err;
+ struct psa_sst_asset_info_t asset_info;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
@@ -327,7 +327,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -339,8 +339,8 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Write should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Write should works correctly");
return;
}
@@ -348,7 +348,7 @@
* attributes struct pointer
*/
err = tfm_sst_veneer_get_info(app_id, asset_uuid, &test_token, &asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID should be able to read the "
"information of this asset");
return;
@@ -363,14 +363,14 @@
/* Calls write function with invalid application ID */
err = tfm_sst_veneer_write(INVALID_APP_ID, asset_uuid, &test_token,
&io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Invalid application ID should not write in the file");
return;
}
/* Calls write function with invalid asset ID */
err = tfm_sst_veneer_write(app_id, INVALID_ASSET_ID, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Invalid asset ID should not write in the file");
return;
}
@@ -387,7 +387,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
/* Prepares test context */
@@ -398,14 +398,14 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
/* Calls write function with tfm_sst_buf_t pointer set to NULL */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, NULL);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail with tfm_sst_buf_t pointer set to NULL");
return;
}
@@ -417,7 +417,7 @@
/* Calls write function with data pointer set to NULL */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail with data pointer set to NULL");
return;
}
@@ -433,7 +433,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t wrt_data[BUFFER_PLUS_PADDING_SIZE] = {0};
@@ -445,7 +445,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -456,7 +456,7 @@
io_data.offset = 0;
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Writing beyond end of asset should not succeed");
return;
}
@@ -466,7 +466,7 @@
io_data.offset = SST_ASSET_MAX_SIZE_AES_KEY_192;
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write to an offset beyond end of asset should not succeed");
return;
}
@@ -484,7 +484,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
@@ -497,7 +497,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -509,8 +509,8 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Write should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Write should works correctly");
return;
}
@@ -521,8 +521,8 @@
/* Read data from the asset */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Read should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Read should works correctly");
return;
}
@@ -545,7 +545,7 @@
/* Calls read with invalid application ID */
err = tfm_sst_veneer_read(INVALID_APP_ID, asset_uuid, &test_token,
&io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail when read is called with an invalid "
"application ID");
return;
@@ -553,7 +553,7 @@
/* Calls read with invalid asset ID */
err = tfm_sst_veneer_read(app_id, INVALID_ASSET_ID, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail when read is called with an invalid "
"asset ID");
return;
@@ -571,7 +571,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
/* Prepares test context */
@@ -582,14 +582,14 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
/* Calls read with invalid tfm_sst_buf_t pointer */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, NULL);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read with tfm_sst_buf_t pointer set to NULL should fail");
return;
}
@@ -600,7 +600,7 @@
/* Calls read with invalid data pointer */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read with read data pointer set to NULL should fail");
return;
}
@@ -616,9 +616,9 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
uint8_t data[BUFFER_SIZE_PLUS_ONE] = {0};
/* Prepares test context */
@@ -629,7 +629,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -641,14 +641,14 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Write should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Write should works correctly");
return;
}
/* Gets current asset information */
err = tfm_sst_veneer_get_info(app_id, asset_uuid, &test_token, &asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Application S_APP_ID should be able to read the "
"information of this asset");
return;
@@ -666,7 +666,7 @@
io_data.offset = 0;
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read beyond current size should not succeed");
return;
}
@@ -676,7 +676,7 @@
io_data.offset = asset_info.size_current;
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read from an offset beyond current size should not succeed");
return;
}
@@ -699,7 +699,7 @@
const uint32_t asset_uuid_1 = SST_ASSET_ID_SHA224_HASH;
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA384_HASH;
struct tfm_sst_buf_t io_data;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t read_data[BUF_SIZE_SHA224] = READ_DATA_SHA224;
uint8_t wrt_data[BUF_SIZE_SHA224] = WRITE_DATA_SHA224_1;
@@ -711,14 +711,14 @@
/* Creates assset */
err = tfm_sst_veneer_create(app_id_1, asset_uuid_1, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
/* Calls delete asset with invalid application ID */
err = tfm_sst_veneer_delete(INVALID_APP_ID, asset_uuid_1, &test_token);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("The delete action should fail if an invalid application "
"ID is provided");
return;
@@ -726,21 +726,21 @@
/* Calls delete asset */
err = tfm_sst_veneer_delete(app_id_1, asset_uuid_1, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
/* Calls delete with a deleted asset ID */
err = tfm_sst_veneer_delete(app_id_1, asset_uuid_1, &test_token);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("The delete action should fail as ID is not valid");
return;
}
/* Calls delete asset with invalid asset ID */
err = tfm_sst_veneer_delete(app_id_1, INVALID_ASSET_ID, &test_token);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("The delete action should fail if an invalid asset ID "
"is provided");
return;
@@ -757,7 +757,7 @@
* data block
*/
err = tfm_sst_veneer_create(app_id_2, asset_uuid_2, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -765,7 +765,7 @@
/* Creates asset 1 to locate it after the asset 2 in the data block */
err = tfm_sst_veneer_create(app_id_1, SST_ASSET_ID_SHA224_HASH,
&test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -777,7 +777,7 @@
/* Writes data in asset 1 */
err = tfm_sst_veneer_write(app_id_1, asset_uuid_1, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for application S_APP_ID");
return;
}
@@ -786,7 +786,7 @@
* at the beginning of the block.
*/
err = tfm_sst_veneer_delete(app_id_2, asset_uuid_2, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("The delete action should work correctly");
return;
}
@@ -802,7 +802,7 @@
/* Read back the asset 1 */
err = tfm_sst_veneer_read(app_id_1, asset_uuid_1, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -822,7 +822,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint32_t i;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
@@ -836,7 +836,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -848,8 +848,8 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Write should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Write should works correctly");
return;
}
@@ -862,9 +862,9 @@
/* Read data from the asset */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
#ifdef SST_ENABLE_PARTIAL_ASSET_RW
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
#else
- if (io_data.offset != 0 && err != TFM_SST_ERR_PARAM_ERROR) {
+ if (io_data.offset != 0 && err != PSA_SST_ERR_PARAM_ERROR) {
#endif
TEST_FAIL("Read did not behave correctly");
return;
@@ -909,7 +909,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t wrt_data[WRITE_BUF_SIZE] = "DATA";
@@ -922,7 +922,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -934,14 +934,14 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
- TEST_FAIL("Write should work correctly");
+ if (err != PSA_SST_ERR_SUCCESS) {
+ TEST_FAIL("Write should works correctly");
return;
}
/* Calls prepare again to simulate reinitialization */
err = sst_am_prepare();
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Saved system should have been preparable");
return;
}
@@ -953,7 +953,7 @@
/* Reads back the data after the prepare */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -985,7 +985,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t wrt_data[BUF_SIZE_SHA224] = {0};
@@ -997,7 +997,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1009,7 +1009,7 @@
/* Writes data in the asset when data size is bigger than asset size */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Should have failed asset write of too large");
return;
}
@@ -1025,7 +1025,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t wrt_data[WRITE_BUF_SIZE+1] = "Hello";
@@ -1039,7 +1039,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1051,7 +1051,7 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 1 failed");
return;
}
@@ -1063,7 +1063,7 @@
/* Writes data 2 in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 2 failed");
return;
}
@@ -1075,7 +1075,7 @@
/* Read back the data */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1098,7 +1098,7 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t read_data[BUF_SIZE_SHA224] = READ_DATA_SHA224;
uint8_t wrt_data[BUF_SIZE_SHA224] = WRITE_DATA_SHA224_1;
@@ -1112,7 +1112,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1124,7 +1124,7 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 1 failed");
return;
}
@@ -1136,7 +1136,7 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err == TFM_SST_ERR_SUCCESS) {
+ if (err == PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 2 should have failed as this write tries to "
"write more bytes than the max size");
return;
@@ -1149,7 +1149,7 @@
/* Writes data in the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data 3 failed");
return;
}
@@ -1161,7 +1161,7 @@
/* Read back the data */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1184,7 +1184,7 @@
const uint32_t app_id_2 = S_APP_ID;
const uint32_t asset_uuid_1 = SST_ASSET_ID_AES_KEY_192;
const uint32_t asset_uuid_2 = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t wrt_data[WRITE_BUF_SIZE+1] = "Hello";
@@ -1200,14 +1200,14 @@
/* Creates asset 1 */
err = tfm_sst_veneer_create(app_id_1, asset_uuid_1, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
/* Creates asset 2 */
err = tfm_sst_veneer_create(app_id_2, asset_uuid_2, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1219,7 +1219,7 @@
/* Writes data in asset 1 */
err = tfm_sst_veneer_write(app_id_1, asset_uuid_1, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for application S_APP_ID");
return;
}
@@ -1231,7 +1231,7 @@
/* Writes data 2 in asset 2 */
err = tfm_sst_veneer_write(app_id_2, asset_uuid_2, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for application S_APP_ID");
return;
}
@@ -1243,7 +1243,7 @@
/* Writes data 3 in asset 1 */
err = tfm_sst_veneer_write(app_id_1, asset_uuid_1, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for application S_APP_ID");
return;
}
@@ -1255,7 +1255,7 @@
/* Writes data 4 in asset 2 */
err = tfm_sst_veneer_write(app_id_2, asset_uuid_2, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Write data should work for application S_APP_ID");
return;
}
@@ -1267,7 +1267,7 @@
/* Read back the asset 1 */
err = tfm_sst_veneer_read(app_id_1, asset_uuid_1, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1287,7 +1287,7 @@
/* Read back the asset 2 */
err = tfm_sst_veneer_read(app_id_2, asset_uuid_2, &test_token, &io_data);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Incorrect number of bytes read back");
return;
}
@@ -1308,7 +1308,7 @@
{
uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
/* Prepares test context */
@@ -1319,7 +1319,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1331,14 +1331,14 @@
/* Calls write with a ROM address location */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a ROM address location */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
@@ -1353,7 +1353,7 @@
{
uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
/* Prepares test context */
@@ -1364,7 +1364,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1376,14 +1376,14 @@
/* Calls write with a device address location */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a device address location */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
@@ -1398,7 +1398,7 @@
{
uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_SHA224_HASH;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
struct tfm_sst_buf_t io_data;
/* Prepares test context */
@@ -1409,7 +1409,7 @@
/* Creates asset */
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail for application S_APP_ID");
return;
}
@@ -1421,14 +1421,14 @@
/* Calls write with a non-existing address location */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Write should fail for an illegal location");
return;
}
/* Calls read with a non-existing address location */
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &io_data);
- if (err != TFM_SST_ERR_ASSET_NOT_FOUND) {
+ if (err != PSA_SST_ERR_ASSET_NOT_FOUND) {
TEST_FAIL("Read should fail for an illegal location");
return;
}
@@ -1444,9 +1444,9 @@
{
const uint32_t app_id = S_APP_ID;
const uint32_t asset_uuid = SST_ASSET_ID_AES_KEY_192;
- struct tfm_sst_asset_info_t asset_info;
+ struct psa_sst_asset_info_t asset_info;
struct tfm_sst_buf_t buf;
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXXXXX";
uint8_t write_data_1[WRITE_BUF_SIZE] = "AAAA";
uint8_t write_data_2[2] = "B";
@@ -1457,7 +1457,7 @@
}
err = tfm_sst_veneer_create(app_id, asset_uuid, &test_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Create should not fail");
return;
}
@@ -1468,13 +1468,13 @@
/* Writes write_data_1 to the asset */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &buf);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("First write should not fail");
return;
}
err = tfm_sst_veneer_get_info(app_id, asset_uuid, &test_token, &asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail");
return;
}
@@ -1493,13 +1493,13 @@
/* Overwrites the second character in the asset with write_data_2 */
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &buf);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Second write should not fail");
return;
}
err = tfm_sst_veneer_get_info(app_id, asset_uuid, &test_token, &asset_info);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Get information should not fail");
return;
}
@@ -1515,7 +1515,7 @@
buf.offset = 0;
err = tfm_sst_veneer_read(app_id, asset_uuid, &test_token, &buf);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
TEST_FAIL("Read should not fail");
return;
}
@@ -1534,7 +1534,7 @@
buf.offset = (asset_info.size_current + 1);
err = tfm_sst_veneer_write(app_id, asset_uuid, &test_token, &buf);
- if (err != TFM_SST_ERR_PARAM_ERROR) {
+ if (err != PSA_SST_ERR_PARAM_ERROR) {
TEST_FAIL("Write must fail if the offset is bigger than the current"
" asset's size");
return;
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
index 9ce4849..2ad3044 100644
--- a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
@@ -12,11 +12,11 @@
* \brief Service initialisation function. No special initialisation is
* required.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t tfm_secure_client_service_init(void)
+enum psa_sst_err_t tfm_secure_client_service_init(void)
{
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
int32_t tfm_secure_client_service_sfn_run_tests(void)
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service.c b/test/test_services/tfm_sst_test_service/sst_test_service.c
index a33e033..2784642 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service.c
+++ b/test/test_services/tfm_sst_test_service/sst_test_service.c
@@ -9,6 +9,7 @@
#include "secure_fw/core/tfm_secure_api.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
+#include "secure_fw/services/secure_storage/sst_asset_management.h"
#include "secure_fw/services/secure_storage/sst_utils.h"
#include "tfm_sst_veneers.h"
@@ -24,16 +25,16 @@
* \brief Service initialisation function. No special initialisation is
* required.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_init(void)
+enum psa_sst_err_t sst_test_service_init(void)
{
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_test_service_sfn_setup(void)
+enum psa_sst_err_t sst_test_service_sfn_setup(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t app_id = S_APP_ID;
const uint32_t key_uuid = SST_ASSET_ID_AES_KEY_128;
struct tfm_sst_token_t s_token = {.token = NULL, .token_size = 0};
@@ -44,7 +45,7 @@
/* Create the key asset using our secure app ID */
err = tfm_sst_veneer_create(app_id, key_uuid, &s_token);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
@@ -54,12 +55,12 @@
return err;
}
-enum tfm_sst_err_t sst_test_service_sfn_dummy_encrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_sfn_dummy_encrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t i;
uint8_t key_data[SST_TEST_SERVICE_KEY_SIZE];
struct tfm_sst_token_t s_token = {.token = NULL, .token_size = 0};
@@ -67,15 +68,15 @@
/* Read the key from the asset using the non-secure caller's app ID */
err = tfm_sst_veneer_read(app_id, key_uuid, &s_token, &key_buf);
- if (err != TFM_SST_ERR_SUCCESS) {
+ if (err != PSA_SST_ERR_SUCCESS) {
return err;
}
/* Check the buffer is valid memory for the application that supplied it */
err = sst_utils_memory_bound_check(buf, buf_size, app_id,
TFM_MEMORY_ACCESS_RW);
- if (err != TFM_SST_ERR_SUCCESS) {
- return TFM_SST_ERR_PARAM_ERROR;
+ if (err != PSA_SST_ERR_SUCCESS) {
+ return PSA_SST_ERR_PARAM_ERROR;
}
/* Encrypt the data (very badly) using the key from secure storage */
@@ -83,10 +84,10 @@
buf[i] ^= key_data[i % SST_TEST_SERVICE_KEY_SIZE];
}
- return TFM_SST_ERR_SUCCESS;
+ return PSA_SST_ERR_SUCCESS;
}
-enum tfm_sst_err_t sst_test_service_sfn_dummy_decrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_sfn_dummy_decrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
@@ -96,9 +97,9 @@
return sst_test_service_sfn_dummy_encrypt(app_id, key_uuid, buf, buf_size);
}
-enum tfm_sst_err_t sst_test_service_sfn_clean(void)
+enum psa_sst_err_t sst_test_service_sfn_clean(void)
{
- enum tfm_sst_err_t err;
+ enum psa_sst_err_t err;
uint32_t app_id = S_APP_ID;
const uint32_t key_uuid = SST_ASSET_ID_AES_KEY_128;
struct tfm_sst_token_t s_token = {.token = NULL, .token_size = 0};
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service.h b/test/test_services/tfm_sst_test_service/sst_test_service.h
index da55a79..3df38e8 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service.h
+++ b/test/test_services/tfm_sst_test_service/sst_test_service.h
@@ -19,9 +19,9 @@
* \brief Sets-up the SST test service so that it is ready for test functions to
* be called.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_sfn_setup(void);
+enum psa_sst_err_t sst_test_service_sfn_setup(void);
/**
* \brief Performs a dummy encryption on the supplied buffer, using the key
@@ -32,9 +32,9 @@
* \param[in,out] buf Plaintext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_sfn_dummy_encrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_sfn_dummy_encrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
@@ -48,9 +48,9 @@
* \param[in,out] buf Ciphertext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_sfn_dummy_decrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_sfn_dummy_decrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
@@ -58,9 +58,9 @@
/**
* \brief Cleans the secure storage used by the SST test service.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_sfn_clean(void);
+enum psa_sst_err_t sst_test_service_sfn_clean(void);
#ifdef __cplusplus
}
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service_api.c b/test/test_services/tfm_sst_test_service/sst_test_service_api.c
index 1821cd6..a894c08 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service_api.c
+++ b/test/test_services/tfm_sst_test_service/sst_test_service_api.c
@@ -10,14 +10,14 @@
#include "tfm_ns_svc.h"
__attribute__ ((naked))
-enum tfm_sst_err_t sst_test_service_setup(void)
+enum psa_sst_err_t sst_test_service_setup(void)
{
SVC(SVC_SST_TEST_SERVICE_SETUP);
__ASM("BX LR");
}
__attribute__ ((naked))
-enum tfm_sst_err_t sst_test_service_dummy_encrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_dummy_encrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
{
@@ -26,7 +26,7 @@
}
__attribute__ ((naked))
-enum tfm_sst_err_t sst_test_service_dummy_decrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_dummy_decrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
{
@@ -35,7 +35,7 @@
}
__attribute__ ((naked))
-enum tfm_sst_err_t sst_test_service_clean(void)
+enum psa_sst_err_t sst_test_service_clean(void)
{
SVC(SVC_SST_TEST_SERVICE_CLEAN);
__ASM("BX LR");
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service_api.h b/test/test_services/tfm_sst_test_service/sst_test_service_api.h
index 87f1a4f..09f6909 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service_api.h
+++ b/test/test_services/tfm_sst_test_service/sst_test_service_api.h
@@ -19,9 +19,9 @@
* \brief Sets-up the SST test service so that it is ready for test functions to
* be called.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_setup(void);
+enum psa_sst_err_t sst_test_service_setup(void);
/**
* \brief Performs a dummy encryption on the supplied buffer, using the key
@@ -31,9 +31,9 @@
* \param[in,out] buf Plaintext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_dummy_encrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_dummy_encrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
@@ -45,18 +45,18 @@
* \param[in,out] buf Ciphertext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_dummy_decrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_dummy_decrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
/**
* \brief Cleans the secure storage used by the SST test service.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_clean(void);
+enum psa_sst_err_t sst_test_service_clean(void);
#ifdef __cplusplus
}
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service_svc.c b/test/test_services/tfm_sst_test_service/sst_test_service_svc.c
index 84ade98..1db5376 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service_svc.c
+++ b/test/test_services/tfm_sst_test_service/sst_test_service_svc.c
@@ -10,12 +10,12 @@
#include "sst_test_service_veneers.h"
#include "tfm_id_mngr.h"
-enum tfm_sst_err_t sst_test_service_svc_setup(void)
+enum psa_sst_err_t sst_test_service_svc_setup(void)
{
return sst_test_service_veneer_setup();
}
-enum tfm_sst_err_t sst_test_service_svc_dummy_encrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_svc_dummy_encrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
{
@@ -27,7 +27,7 @@
buf_size);
}
-enum tfm_sst_err_t sst_test_service_svc_dummy_decrypt(uint32_t key_uuid,
+enum psa_sst_err_t sst_test_service_svc_dummy_decrypt(uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
{
@@ -39,7 +39,7 @@
buf_size);
}
-enum tfm_sst_err_t sst_test_service_svc_clean(void)
+enum psa_sst_err_t sst_test_service_svc_clean(void)
{
return sst_test_service_veneer_clean();
}
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c b/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c
index b7fa5c5..0a53513 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c
+++ b/test/test_services/tfm_sst_test_service/sst_test_service_veneers.c
@@ -12,7 +12,7 @@
#include "secure_fw/spm/spm_partition_defs.h"
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t sst_test_service_veneer_setup(void)
+enum psa_sst_err_t sst_test_service_veneer_setup(void)
{
TFM_CORE_SFN_REQUEST(TFM_SP_SST_TEST_PARTITION_ID,
sst_test_service_sfn_setup,
@@ -20,7 +20,7 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t sst_test_service_veneer_dummy_encrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_veneer_dummy_encrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
@@ -31,7 +31,7 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t sst_test_service_veneer_dummy_decrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_veneer_dummy_decrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size)
@@ -42,7 +42,7 @@
}
__tfm_secure_gateway_attributes__
-enum tfm_sst_err_t sst_test_service_veneer_clean(void)
+enum psa_sst_err_t sst_test_service_veneer_clean(void)
{
TFM_CORE_SFN_REQUEST(TFM_SP_SST_TEST_PARTITION_ID,
sst_test_service_sfn_clean,
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service_veneers.h b/test/test_services/tfm_sst_test_service/sst_test_service_veneers.h
index a70819c..296f600 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service_veneers.h
+++ b/test/test_services/tfm_sst_test_service/sst_test_service_veneers.h
@@ -19,9 +19,9 @@
* \brief Sets-up the SST test service so that it is ready for test functions to
* be called.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_veneer_setup(void);
+enum psa_sst_err_t sst_test_service_veneer_setup(void);
/**
* \brief Performs a dummy encryption on the supplied buffer, using the key
@@ -32,9 +32,9 @@
* \param[in,out] buf Plaintext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_veneer_dummy_encrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_veneer_dummy_encrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
@@ -47,18 +47,18 @@
* \param[in,out] buf Ciphertext buffer
* \param[in] buf_size Size of buf
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_veneer_dummy_decrypt(uint32_t app_id,
+enum psa_sst_err_t sst_test_service_veneer_dummy_decrypt(uint32_t app_id,
uint32_t key_uuid,
uint8_t *buf,
uint32_t buf_size);
/**
* \brief Cleans the secure storage used by the SST test service.
*
- * \return Returns error code as specified in \ref tfm_sst_err_t
+ * \return Returns error code as specified in \ref psa_sst_err_t
*/
-enum tfm_sst_err_t sst_test_service_veneer_clean(void);
+enum psa_sst_err_t sst_test_service_veneer_clean(void);
#ifdef __cplusplus
}