diff --git a/api/stse_data_storage.c b/api/stse_data_storage.c
index 4f43d8f3..b2231ae6 100644
--- a/api/stse_data_storage.c
+++ b/api/stse_data_storage.c
@@ -43,7 +43,7 @@ stse_ReturnCode_t stse_data_storage_get_partitioning_table(
stse_Handler_t *pSTSE,
PLAT_UI8 total_partition_count,
stsafea_data_partition_record_t *pPartitioning_table,
- PLAT_UI16 Partitioning_table_length) {
+ PLAT_UI16 partitioning_table_size) {
stse_ReturnCode_t ret = STSE_API_INCOMPATIBLE_DEVICE_TYPE;
@@ -51,7 +51,7 @@ stse_ReturnCode_t stse_data_storage_get_partitioning_table(
#ifdef STSE_CONF_STSAFE_L_SUPPORT
if (pSTSE->device_type != STSAFE_L010) {
#endif /* STSE_CONF_STSAFE_L_SUPPORT */
- ret = stsafea_get_data_partitions_configuration(pSTSE, total_partition_count, pPartitioning_table, Partitioning_table_length);
+ ret = stsafea_get_data_partitions_configuration(pSTSE, total_partition_count, pPartitioning_table, partitioning_table_size);
#ifdef STSE_CONF_STSAFE_L_SUPPORT
}
#endif /* STSE_CONF_STSAFE_L_SUPPORT */
@@ -111,7 +111,6 @@ stse_ReturnCode_t stse_data_storage_read_data_zone(
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
ret = stsafea_read_data_zone(
pSTSE,
zone,
@@ -181,7 +180,6 @@ stse_ReturnCode_t stse_data_storage_update_data_zone(
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
ret = stsafea_update_data_zone(
pSTSE,
zone,
@@ -242,7 +240,6 @@ stse_ReturnCode_t stse_data_storage_decrement_counter_zone(
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
ret = stsafea_decrement_counter_zone(
pSTSE,
zone,
@@ -315,7 +312,6 @@ stse_ReturnCode_t stse_data_storage_read_counter_zone(
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
ret = stsafea_read_counter_zone(
pSTSE,
zone,
diff --git a/api/stse_data_storage.h b/api/stse_data_storage.h
index b883f831..c8b4ce12 100644
--- a/api/stse_data_storage.h
+++ b/api/stse_data_storage.h
@@ -49,7 +49,7 @@ stse_ReturnCode_t stse_data_storage_get_total_partition_count(
* \param[in] pSTSE Pointer to target STSE handler
* \param[in] total_partition_count Total partition count
* \param[out] pPartitioning_table Pointer to the partition table buffer
- * \param[in] Partitioning_table_length Length of the partition table to be received
+ * \param[in] partitioning_table_size Size (in bytes) of the partition table (@p pPartitioning_table) to be received
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
* \details \include{doc} stse_data_storage_get_partitioning_table.dox
*/
@@ -57,7 +57,7 @@ stse_ReturnCode_t stse_data_storage_get_partitioning_table(
stse_Handler_t *pSTSE,
PLAT_UI8 total_partition_count,
stsafea_data_partition_record_t *pPartitioning_table,
- PLAT_UI16 Partitioning_table_length);
+ PLAT_UI16 partitioning_table_size);
/*!
* \brief Read one memory zone of the STSE device
diff --git a/api/stse_device_management.c b/api/stse_device_management.c
index b9f9b276..a8ba4f77 100644
--- a/api/stse_device_management.c
+++ b/api/stse_device_management.c
@@ -124,7 +124,6 @@ stse_ReturnCode_t stse_device_enter_hibernate(stse_Handler_t *pSTSE,
#ifdef STSE_CONF_STSAFE_A_SUPPORT
case STSAFE_A100:
case STSAFE_A110:
- case STSAFE_A200:
ret = stsafea_hibernate(pSTSE, wake_up_mode);
break;
case STSAFE_A120:
@@ -156,7 +155,6 @@ stse_ReturnCode_t stse_device_power_on(stse_Handler_t *pSTSE) {
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
stse_platform_Delay_ms(stsafea_boot_time[pSTSE->device_type]);
break;
#endif /* STSE_CONF_STSAFE_A_SUPPORT */
@@ -202,7 +200,6 @@ stse_ReturnCode_t stse_device_echo(stse_Handler_t *pSTSE, PLAT_UI8 *pIn, PLAT_UI
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
return stsafea_echo(pSTSE, pIn, pOut, size);
#endif /* STSE_CONF_STSAFE_A_SUPPORT */
default:
@@ -317,7 +314,6 @@ stse_ReturnCode_t stse_device_reset(stse_Handler_t *pSTSE) {
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
ret = stsafea_reset(pSTSE);
break;
#endif /* STSE_CONF_STSAFE_A_SUPPORT */
diff --git a/api/stse_ecc.c b/api/stse_ecc.c
index f192cd1b..1308baa1 100644
--- a/api/stse_ecc.c
+++ b/api/stse_ecc.c
@@ -84,7 +84,6 @@ stse_ReturnCode_t stse_ecc_generate_signature(
case STSAFE_A100:
case STSAFE_A110:
case STSAFE_A120:
- case STSAFE_A200:
ret = stsafea_ecc_generate_signature(pSTSE, slot_number, key_type, pMessage, message_length, pSignature);
break;
#endif /* STSE_CONF_STSAFE_A_SUPPORT */
diff --git a/core/stse_device.h b/core/stse_device.h
index 08b322ac..2ab4df9e 100644
--- a/core/stse_device.h
+++ b/core/stse_device.h
@@ -52,7 +52,6 @@ typedef enum stse_device_t {
STSAFE_A100, /*!< STSAFE-A100 target device */
STSAFE_A110, /*!< STSAFE-A110 target device */
STSAFE_A120, /*!< STSAFE-A120 target device */
- STSAFE_A200, /*!< STSAFE-A200 target device */
#endif /* STSE_CONF_STSAFE_A_SUPPORT */
#ifdef STSE_CONF_STSAFE_L_SUPPORT
STSAFE_L010 /*!< STSAFE-L010 target device */
diff --git a/core/stse_return_codes.h b/core/stse_return_codes.h
index eccb2b53..07490d96 100644
--- a/core/stse_return_codes.h
+++ b/core/stse_return_codes.h
@@ -121,6 +121,8 @@ enum stse_ReturnCode_t {
STSE_CERT_INVALID_CERTIFICATE,
STSE_CERT_CA_NOT_MATCHING,
STSE_CERT_UNSUPPORTED_FEATURE,
+
+ __STSE_SIGNED = -1 // Used to make the type of this enum a signed integer, don't use.
};
typedef enum stse_ReturnCode_t stse_ReturnCode_t;
diff --git a/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_partitioning_table.dox b/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_partitioning_table.dox
index bcbe60b0..5aa0c91a 100644
--- a/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_partitioning_table.dox
+++ b/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_partitioning_table.dox
@@ -46,7 +46,8 @@ Following diagram illustrates the interactions performed between the Host and th
stse_ret = stse_data_storage_get_partitioning_table(
&stse_handler,
total_zone_count,
- data_partition_record_table
+ data_partition_record_table,
+ sizeof(data_partition_record_table)
);
if(stse_ret != STSE_OK )
{
diff --git a/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_total_partition_count.dox b/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_total_partition_count.dox
index 749b555b..314b852e 100644
--- a/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_total_partition_count.dox
+++ b/doc/resources/dox_files/APIs/data_storage/stse_data_storage_get_total_partition_count.dox
@@ -48,7 +48,8 @@ Following diagram illustrates the interactions performed between the Host and th
stse_ret = stse_data_storage_get_partitioning_table(
&stse_handler,
total_zone_count,
- data_partition_record_table
+ data_partition_record_table,
+ sizeof(data_partition_record_table)
);
if(stse_ret != STSE_OK )
{
diff --git a/services/stsafea/stsafea_aes.h b/services/stsafea/stsafea_aes.h
index 6ed57dca..1ca94fe3 100644
--- a/services/stsafea/stsafea_aes.h
+++ b/services/stsafea/stsafea_aes.h
@@ -43,7 +43,10 @@
* \details This service format and send encrypt command in AES ECB mode
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] slot_number Key slot in symmetric key table to be used
- * \param[in] message_length Length of the message
+ * \param[in] message_length Length of the message
+ * message_length maximum value (in bytes):
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 5
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 5
* \param[in] pPlaintext_message Plaintext message to encrypt
* \param[out] pEncrypted_message Encrypted message
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -60,7 +63,10 @@ stse_ReturnCode_t stsafea_aes_ecb_encrypt(
* \details This service format and send decrypt command in AES ECB mode
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] slot_number Key slot in symmetric key table to be used
- * \param[in] message_length Length of the message
+ * \param[in] message_length Length of the message
+ * message_length maximum value (in bytes):
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 5
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 5
* \param[in] pEncrypted_message Encrypted message to decrypt
* \param[out] pPlaintext_message Plaintext message
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -81,7 +87,10 @@ stse_ReturnCode_t stsafea_aes_ecb_decrypt(
* \param[in] pNonce Buffer containing the nonce
* \param[in] associated_data_length Length of the associated data
* \param[in] pAssociated_data Buffer containing associated data
- * \param[in] message_length Length of the message to encrypt
+ * \param[in] message_length Length of the message to encrypt
+ * message_length maximum value (in bytes):
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 22 - associated_data_length
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 22 - associated_data_length
* \param[in] pPlaintext_message Buffer containing the message to encrypt
* \param[out] pEncrypted_message Buffer to store the encrypted message
* \param[out] pEncrypted_authentication_tag Buffer to store the authentication tag
@@ -114,7 +123,9 @@ stse_ReturnCode_t stsafea_aes_ccm_encrypt(
* \param[in] total_message_length Length of the complete message to be encrypted by chunks
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 17 - Nonce_length - associated_data_chunk_length
* \param[in] pPlaintext_message_chunk Buffer containing 1st piece of plaintext message chunk to encrypt
* \param[out] pEncrypted_message_chunk Buffer to store the encrypted message chunk
* \param[out] pCounter_presence Counter presence flag
@@ -142,7 +153,9 @@ stse_ReturnCode_t stsafea_aes_ccm_encrypt_start(
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - associated_data_chunk_length
* \param[in] pPlaintext_message_chunk Buffer containing the message chunk to encrypt
* \param[out] pEncrypted_message_chunk Buffer to store the encrypted message chunk
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -162,7 +175,9 @@ stse_ReturnCode_t stsafea_aes_ccm_encrypt_process(
* \param[in] authentication_tag_length Length of the output authentication tag
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - associated_data_chunk_length
* \param[in] pPlaintext_message_chunk Buffer containing the message chunk to encrypt
* \param[out] pEncrypted_message_chunk Buffer to store the encrypted message chunk
* \param[out] pEncrypted_authentication_tag Encrypted authentication tag
@@ -187,7 +202,10 @@ stse_ReturnCode_t stsafea_aes_ccm_encrypt_finish(
* \param[in] pNonce Buffer containing the nonce
* \param[in] associated_data_length Length of the associated data
* \param[in] pAssociated_data Buffer containing associated data
- * \param[in] message_length Length of the message to encrypt
+ * \param[in] message_length Length of the message to encrypt
+ * message_length maximum value (in bytes):
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 22 - authentication_tag_length - associated_data_length
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 22 - authentication_tag_length - associated_data_length
* \param[in] pEncrypted_message Buffer containing the message to decrypt
* \param[in] pAuthentication_tag Buffer containing the authentication tag
* \param[out] pVerification_result Verification result flag
@@ -218,7 +236,9 @@ stse_ReturnCode_t stsafea_aes_ccm_decrypt(
* \param[in] total_ciphertext_length Length of the complete ciphertext
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 17 - Nonce_length - associated_data_chunk_length
* \param[in] pEncrypted_message_chunk Buffer containing the message chunk to decrypt
* \param[out] pPlaintext_message_chunk Buffer to store the decrypted message chunk
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -242,7 +262,9 @@ stse_ReturnCode_t stsafea_aes_ccm_decrypt_start(
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - associated_data_chunk_length
* \param[in] pEncrypted_message_chunk Buffer containing the message chunk to decrypt
* \param[out] pPlaintext_message_chunk Buffer to store the decrypted message chunk
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -262,7 +284,9 @@ stse_ReturnCode_t stsafea_aes_ccm_decrypt_process(
* \param[in] authentication_tag_length Length of the output authentication tag
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - authentication_tag_length - associated_data_chunk_length
* \param[in] pEncrypted_message_chunk Buffer containing the message chunk to decrypt
* \param[in] pAuthentication_tag Authentication tag
* \param[out] pVerification_result Verification result flag
@@ -290,7 +314,9 @@ stse_ReturnCode_t stsafea_aes_ccm_decrypt_finish(
* \param[in] pIV IV buffer
* \param[in] associated_data_length Length of the associated data
* \param[in] pAssociated_data Buffer containing associated data
- * \param[in] message_length Length of the message to encrypt
+ * \param[in] message_length Length of the message to encrypt
+ * message_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - IV_length - associated_data_length
* \param[in] pPlaintext_message Buffer containing the message to encrypt
* \param[out] pEncrypted_message Buffer to store the encrypted message
* \param[out] pAuthentication_tag Buffer to store the authentication tag
@@ -318,7 +344,9 @@ stse_ReturnCode_t stsafea_aes_gcm_encrypt(
* \param[in] pIV IV buffer
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - IV_length - associated_data_chunk_length
* \param[in] pPlaintext_message_chunk Buffer containing the message chunk to encrypt
* \param[out] pEncrypted_message_chunk Buffer to store the encrypted message
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -340,7 +368,9 @@ stse_ReturnCode_t stsafea_aes_gcm_encrypt_start(
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * \param[in] message_chunk_length Length of the message chunk to encrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - associated_data_chunk_length
* \param[in] pPlaintext_message_chunk Buffer containing the message chunk to encrypt
* \param[out] pEncrypted_message_chunk Buffer to store the encrypted message chunk
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -360,7 +390,9 @@ stse_ReturnCode_t stsafea_aes_gcm_encrypt_process(
* \param[in] authentication_tag_length Length of the output authentication tag
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk
+ * \param[in] message_chunk_length Length of the message chunk
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - associated_data_chunk_length
* \param[in] pPlaintext_message_chunk Buffer containing the message chunk to encrypt
* \param[out] pEncrypted_message_chunk Buffer to store the encrypted message chunk
* \param[out] pAuthentication_tag Authentication tag
@@ -386,7 +418,9 @@ stse_ReturnCode_t stsafea_aes_gcm_encrypt_finish(
* \param[in] pIV IV buffer
* \param[in] associated_data_length Length of the associated data
* \param[in] pAssociated_data Buffer containing associated data
- * \param[in] message_length Length of the message to decrypt
+ * \param[in] message_length Length of the message to decrypt
+ * message_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - authentication_tag_length - IV_length - associated_data_length
* \param[in] pEncrypted_message Buffer containing the message to decrypt
* \param[in] pAuthentication_tag Buffer containing the authentication tag
* \param[out] pVerification_result Verification result flag
@@ -416,7 +450,9 @@ stse_ReturnCode_t stsafea_aes_gcm_decrypt(
* \param[in] pIV IV buffer
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - IV_length - associated_data_chunk_length
* \param[in] pEncrypted_message_chunk Buffer containing the message chunk to decrypt
* \param[out] pPlaintext_message_chunk Buffer to store the decrypted message chunk
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -438,7 +474,9 @@ stse_ReturnCode_t stsafea_aes_gcm_decrypt_start(
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 8 - associated_data_chunk_length
* \param[in] pEncrypted_message_chunk Buffer containing the message chunk to decrypt
* \param[out] pPlaintext_message_chunk Buffer to store the decrypted message chunk
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -458,7 +496,9 @@ stse_ReturnCode_t stsafea_aes_gcm_decrypt_process(
* \param[in] authentication_tag_length Length of the output authentication tag
* \param[in] associated_data_chunk_length Length of the associated data chunk
* \param[in] pAssociated_data_chunk Buffer containing associated data chunk
- * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * \param[in] message_chunk_length Length of the message chunk to decrypt
+ * message_chunk_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - authentication_tag_length - associated_data_chunk_length
* \param[in] pEncrypted_message_chunk Buffer containing the message chunk to decrypt
* \param[in] pAuthentication_tag Authentication tag
* \param[out] pVerification_result Verification result flag
diff --git a/services/stsafea/stsafea_commands.h b/services/stsafea/stsafea_commands.h
index ff45404d..159ece32 100644
--- a/services/stsafea/stsafea_commands.h
+++ b/services/stsafea/stsafea_commands.h
@@ -57,7 +57,6 @@
#define STSAFEA_PROT_CMD_Msk 0x80U /*!< STSAFE Protected command mask */
#define STSAFEA_PROT_RSP_Msk 0x40U /*!< STSAFE Protected rsp mask */
-#define STSAFEA_PRODUCT_COUNT 4U
#define STSAFEA_MAX_CMD_COUNT 29U
#define STSAFEA_MAX_EXT_CMD_COUNT 29U
diff --git a/services/stsafea/stsafea_data_partition.c b/services/stsafea/stsafea_data_partition.c
index 1d0acc8a..c3ef91b7 100644
--- a/services/stsafea/stsafea_data_partition.c
+++ b/services/stsafea/stsafea_data_partition.c
@@ -78,13 +78,13 @@ stse_ReturnCode_t stsafea_get_total_partition_count(stse_Handler_t *pSTSE,
stse_ReturnCode_t stsafea_get_data_partitions_configuration(stse_Handler_t *pSTSE,
PLAT_UI8 total_partitions_count,
stsafea_data_partition_record_t *pRecord_table,
- PLAT_UI16 record_table_length) {
+ PLAT_UI16 record_table_size) {
stse_ReturnCode_t ret;
volatile PLAT_UI8 partition_idx;
PLAT_UI8 cmd_header = STSAFEA_CMD_QUERY;
PLAT_UI8 tag = STSAFEA_SUBJECT_TAG_DATA_PARTITION_CONFIGURATION;
PLAT_UI8 rsp_header;
- PLAT_UI8 raw_data[record_table_length];
+ PLAT_UI8 raw_data[record_table_size];
if (pSTSE == NULL) {
return STSE_SERVICE_HANDLER_NOT_INITIALISED;
@@ -98,7 +98,7 @@ stse_ReturnCode_t stsafea_get_data_partitions_configuration(stse_Handler_t *pSTS
/*- Create Rsp frame and populate elements*/
stse_frame_allocate(RspFrame);
stse_frame_element_allocate_push(&RspFrame, eRsp_header, 1, &rsp_header);
- stse_frame_element_allocate_push(&RspFrame, eRaw, record_table_length, raw_data);
+ stse_frame_element_allocate_push(&RspFrame, eRaw, record_table_size, raw_data);
/*- Perform Transfer*/
ret = stsafea_frame_raw_transfer(pSTSE,
diff --git a/services/stsafea/stsafea_data_partition.h b/services/stsafea/stsafea_data_partition.h
index 27d67660..9def4068 100644
--- a/services/stsafea/stsafea_data_partition.h
+++ b/services/stsafea/stsafea_data_partition.h
@@ -113,13 +113,13 @@ stse_ReturnCode_t stsafea_get_total_partition_count(stse_Handler_t *pSTSE,
* \param[in] pSTSE Pointer to target SE handler
* \param[in] total_partitions_count Total partition count in bytes
* \param[in,out] pRecord_table Pointer to applicative partition record table
- * \param[in] record_table_length Applicative record table length
+ * \param[in] record_table_size Applicative record table (@p pRecord_table) size (in bytes)
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
*/
stse_ReturnCode_t stsafea_get_data_partitions_configuration(stse_Handler_t *pSTSE,
PLAT_UI8 total_partitions_count,
stsafea_data_partition_record_t *pRecord_table,
- PLAT_UI16 record_table_length);
+ PLAT_UI16 record_table_size);
/**
* \brief Decrement counter zone
@@ -130,7 +130,11 @@ stse_ReturnCode_t stsafea_get_data_partitions_configuration(stse_Handler_t *pSTS
* \param[in] amount Amount to decrement
* \param[in] offset Associated data offset
* \param[in] data Pointer to associated data
- * \param[in] data_length Length of associated data
+ * \param[in] data_length Length of associated data
+ * data_length maximum value (in bytes):
+ * - STSAFE-A100 : STSAFEA_MAX_FRAME_LENGTH_A100 - 11
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 11
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11
* \param[out] new_counter_value Pointer to store new counter value
* \param[in] protection Command protection type
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -195,7 +199,11 @@ stse_ReturnCode_t stsafea_read_data_zone(stse_Handler_t *pSTSE,
* \param[in] option Update option
* \param[in] offset Update offset
* \param[in] data Pointer to data to write
- * \param[in] data_length Length of data to write
+ * \param[in] data_length Length of data to write
+ * data_length maximum value (in bytes):
+ * - STSAFE-A100 : STSAFEA_MAX_FRAME_LENGTH_A100 - 7
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 7
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 7
* \param[in] protection Command protection type
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
*/
diff --git a/services/stsafea/stsafea_echo.h b/services/stsafea/stsafea_echo.h
index 185d93fb..a68efc88 100644
--- a/services/stsafea/stsafea_echo.h
+++ b/services/stsafea/stsafea_echo.h
@@ -38,7 +38,11 @@
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] message Message buffer to send the echo command
* \param[in] echoed_message Message buffer to receive the echo response
- * \param[in] message_size Size of the echo message
+ * \param[in] message_size Size of the echo message
+ * message_size maximum value (in bytes):
+ * - STSAFE-A100 : STSAFEA_MAX_FRAME_LENGTH_A100 - 2
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 2
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 2
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
*/
stse_ReturnCode_t stsafea_echo(
diff --git a/services/stsafea/stsafea_frame_transfer.c b/services/stsafea/stsafea_frame_transfer.c
index 709e4d63..1e1ff856 100644
--- a/services/stsafea/stsafea_frame_transfer.c
+++ b/services/stsafea/stsafea_frame_transfer.c
@@ -30,9 +30,7 @@
const PLAT_UI16 stsafea_maximum_frame_length[STSAFEA_PRODUCT_COUNT] = {
STSAFEA_MAX_FRAME_LENGTH_A100,
STSAFEA_MAX_FRAME_LENGTH_A110,
- STSAFEA_MAX_FRAME_LENGTH_A120,
- STSAFEA_MAX_FRAME_LENGTH_A200,
-};
+ STSAFEA_MAX_FRAME_LENGTH_A120};
stse_ReturnCode_t stsafea_frame_transmit(stse_Handler_t *pSTSE, stse_frame_t *pFrame) {
stse_ReturnCode_t ret = STSE_PLATFORM_BUS_ACK_ERROR;
@@ -134,15 +132,15 @@ stse_ReturnCode_t stsafea_frame_receive(stse_Handler_t *pSTSE, stse_frame_t *pFr
return (STSE_SERVICE_INVALID_PARAMETER);
}
- /* ======================================================= */
- /* ============== Get the total frame length ============= */
+ /* ================================================================================= */
+ /* ============== Get the total frame length + 2 bytes (potential CRC) ============= */
while ((retry_count != 0) && (ret == STSE_PLATFORM_BUS_ACK_ERROR)) {
/* - Receive frame length from target STSAFE */
ret = pSTSE->io.BusRecvStart(
pSTSE->io.busID,
pSTSE->io.Devaddr,
pSTSE->io.BusSpeed,
- STSE_FRAME_LENGTH_SIZE + STSE_RSP_FRAME_HEADER_SIZE);
+ STSE_FRAME_LENGTH_SIZE + STSE_RSP_FRAME_HEADER_SIZE + STSE_FRAME_CRC_SIZE);
if (ret != STSE_OK) {
retry_count--;
@@ -164,7 +162,7 @@ stse_ReturnCode_t stsafea_frame_receive(stse_Handler_t *pSTSE, stse_frame_t *pFr
STSE_RSP_FRAME_HEADER_SIZE);
/* - Get STSAFE Response Length */
- ret = pSTSE->io.BusRecvStop(
+ ret = pSTSE->io.BusRecvContinue(
pSTSE->io.busID,
pSTSE->io.Devaddr,
pSTSE->io.BusSpeed,
@@ -174,6 +172,17 @@ stse_ReturnCode_t stsafea_frame_receive(stse_Handler_t *pSTSE, stse_frame_t *pFr
return ret;
}
+ /* - Get STSAFE Response Potential CRC */
+ ret = pSTSE->io.BusRecvStop(
+ pSTSE->io.busID,
+ pSTSE->io.Devaddr,
+ pSTSE->io.BusSpeed,
+ received_crc,
+ STSE_FRAME_CRC_SIZE);
+ if (ret != STSE_OK) {
+ return ret;
+ }
+
/* - Store response Length */
received_length = ((length_value[0] << 8) + length_value[1]) - STSE_FRAME_CRC_SIZE + STSE_RSP_FRAME_HEADER_SIZE;
@@ -188,101 +197,136 @@ stse_ReturnCode_t stsafea_frame_receive(stse_Handler_t *pSTSE, stse_frame_t *pFr
}
}
- /* ======================================================= */
- /* ====== Format the frame to handle CRC and filler ====== */
+ if (received_length == 1) {
+ /* ====================================================== */
+ /* ====== compute CRC for response without payload ====== */
- /* - Compare STSAFE Received frame length with local RSP Frame length */
- if (received_length > pFrame->length) {
- /* Calculate needed filler to match both length */
- filler_size = received_length - pFrame->length;
- }
- if (received_length < pFrame->length) {
- pFrame->length = received_length;
- }
+ computed_crc = stse_platform_Crc16_Calculate(&received_header, STSE_RSP_FRAME_HEADER_SIZE);
- /* Append filler frame element even if its length equal 0 */
- PLAT_UI8 filler[filler_size];
- stse_frame_element_allocate(eFiller,
- filler_size,
- filler);
- if (filler_size > 0) {
- stse_frame_push_element(pFrame,
- &eFiller);
- }
+#ifdef STSE_FRAME_DEBUG_LOG
+ printf("\n\r STSAFE Frame < (%d-byte) : { 0x%02X } { 0x%02X 0x%02X }\n\r",
+ received_length + STSE_FRAME_CRC_SIZE,
+ received_header,
+ received_crc[0],
+ received_crc[1]);
+#endif /* STSE_FRAME_DEBUG_LOG */
- /* ======================================================= */
- /* ========= Receive the frame in frame elements ========= */
+ /* - Verify CRC */
+ if (computed_crc != ((received_crc[0] << 8) + received_crc[1])) {
+ return (STSE_SERVICE_FRAME_CRC_ERROR);
+ }
- ret = STSE_PLATFORM_BUS_ACK_ERROR;
- while ((retry_count != 0) && (ret == STSE_PLATFORM_BUS_ACK_ERROR)) {
- /* - Receive frame length from target STSAFE */
- ret = pSTSE->io.BusRecvStart(
- pSTSE->io.busID,
- pSTSE->io.Devaddr,
- pSTSE->io.BusSpeed,
- STSE_FRAME_LENGTH_SIZE + received_length + STSE_FRAME_CRC_SIZE);
+ ret = (stse_ReturnCode_t)(received_header & STSE_STSAFEA_RSP_STATUS_MASK);
+ } else {
+ /* ======================================================= */
+ /* ====== Format the frame to handle CRC and filler ====== */
- if (ret != STSE_OK) {
- retry_count--;
- stse_platform_Delay_ms(STSE_POLLING_RETRY_INTERVAL);
+ /* - Compare STSAFE Received frame length with local RSP Frame length */
+ if (received_length > pFrame->length) {
+ /* Calculate needed filler to match both length */
+ filler_size = received_length - pFrame->length;
+ }
+ if (received_length < pFrame->length) {
+ pFrame->length = received_length;
}
- }
- /* - Verify correct reception*/
- if (ret != STSE_OK) {
- return ret;
- }
+ /* Append filler frame element even if its length equal 0 */
+ PLAT_UI8 filler[filler_size];
+ stse_frame_element_allocate(eFiller,
+ filler_size,
+ filler);
+ if (filler_size > 0) {
+ stse_frame_push_element(pFrame,
+ &eFiller);
+ }
- /* Receive response header */
- ret = pSTSE->io.BusRecvContinue(
- pSTSE->io.busID,
- pSTSE->io.Devaddr,
- pSTSE->io.BusSpeed,
- pFrame->first_element->pData,
- STSE_RSP_FRAME_HEADER_SIZE);
+ /* ======================================================= */
+ /* ========= Receive the frame in frame elements ========= */
+
+ ret = STSE_PLATFORM_BUS_ACK_ERROR;
+ while ((retry_count != 0) && (ret == STSE_PLATFORM_BUS_ACK_ERROR)) {
+ /* - Receive frame length from target STSAFE */
+ ret = pSTSE->io.BusRecvStart(
+ pSTSE->io.busID,
+ pSTSE->io.Devaddr,
+ pSTSE->io.BusSpeed,
+ STSE_FRAME_LENGTH_SIZE + received_length + STSE_FRAME_CRC_SIZE);
+
+ if (ret != STSE_OK) {
+ retry_count--;
+ stse_platform_Delay_ms(STSE_POLLING_RETRY_INTERVAL);
+ }
+ }
- if (ret != STSE_OK) {
- return ret;
- }
+ /* - Verify correct reception*/
+ if (ret != STSE_OK) {
+ return ret;
+ }
- /* Substract response header already read in STSAFE-A */
- received_length -= STSE_RSP_FRAME_HEADER_SIZE;
+ /* Receive response header */
+ ret = pSTSE->io.BusRecvContinue(
+ pSTSE->io.busID,
+ pSTSE->io.Devaddr,
+ pSTSE->io.BusSpeed,
+ pFrame->first_element->pData,
+ STSE_RSP_FRAME_HEADER_SIZE);
- /* Receive and discard length (already stored) */
- ret = pSTSE->io.BusRecvContinue(
- pSTSE->io.busID,
- pSTSE->io.Devaddr,
- pSTSE->io.BusSpeed,
- NULL,
- STSE_FRAME_LENGTH_SIZE);
- if (ret != STSE_OK) {
- return ret;
- }
+ if (ret != STSE_OK) {
+ return ret;
+ }
- /* - Append CRC element to the RSP Frame (valid only in Receive Scope) */
- stse_frame_element_allocate_push(pFrame, eCRC, STSE_FRAME_CRC_SIZE, received_crc);
+ /* Substract response header already read in STSAFE-A */
+ received_length -= STSE_RSP_FRAME_HEADER_SIZE;
- /* If first element is longer than just the header */
- if (pFrame->first_element->length > STSE_RSP_FRAME_HEADER_SIZE) {
- /* Receive missing bytes after discarding the 2 bytes length */
+ /* Receive and discard length (already stored) */
ret = pSTSE->io.BusRecvContinue(
pSTSE->io.busID,
pSTSE->io.Devaddr,
pSTSE->io.BusSpeed,
- pFrame->first_element->pData + STSE_RSP_FRAME_HEADER_SIZE,
- pFrame->first_element->length - STSE_RSP_FRAME_HEADER_SIZE);
+ NULL,
+ STSE_FRAME_LENGTH_SIZE);
if (ret != STSE_OK) {
return ret;
}
- }
- /* - Perform frame element reception and populate local RSP Frame */
- pCurrent_element = pFrame->first_element->next;
- while (pCurrent_element != pFrame->last_element) {
- if (received_length < pCurrent_element->length) {
- pCurrent_element->length = received_length;
+ /* - Append CRC element to the RSP Frame (valid only in Receive Scope) */
+ stse_frame_element_allocate_push(pFrame, eCRC, STSE_FRAME_CRC_SIZE, received_crc);
+
+ /* If first element is longer than just the header */
+ if (pFrame->first_element->length > STSE_RSP_FRAME_HEADER_SIZE) {
+ /* Receive missing bytes after discarding the 2 bytes length */
+ ret = pSTSE->io.BusRecvContinue(
+ pSTSE->io.busID,
+ pSTSE->io.Devaddr,
+ pSTSE->io.BusSpeed,
+ pFrame->first_element->pData + STSE_RSP_FRAME_HEADER_SIZE,
+ pFrame->first_element->length - STSE_RSP_FRAME_HEADER_SIZE);
+ if (ret != STSE_OK) {
+ return ret;
+ }
}
- ret = pSTSE->io.BusRecvContinue(
+
+ /* - Perform frame element reception and populate local RSP Frame */
+ pCurrent_element = pFrame->first_element->next;
+ while (pCurrent_element != pFrame->last_element) {
+ if (received_length < pCurrent_element->length) {
+ pCurrent_element->length = received_length;
+ }
+ ret = pSTSE->io.BusRecvContinue(
+ pSTSE->io.busID,
+ pSTSE->io.Devaddr,
+ pSTSE->io.BusSpeed,
+ pCurrent_element->pData,
+ pCurrent_element->length);
+ if (ret != STSE_OK) {
+ return ret;
+ }
+
+ received_length -= pCurrent_element->length;
+ pCurrent_element = pCurrent_element->next;
+ }
+
+ ret = pSTSE->io.BusRecvStop(
pSTSE->io.busID,
pSTSE->io.Devaddr,
pSTSE->io.BusSpeed,
@@ -292,48 +336,36 @@ stse_ReturnCode_t stsafea_frame_receive(stse_Handler_t *pSTSE, stse_frame_t *pFr
return ret;
}
- received_length -= pCurrent_element->length;
- pCurrent_element = pCurrent_element->next;
- }
- ret = pSTSE->io.BusRecvStop(
- pSTSE->io.busID,
- pSTSE->io.Devaddr,
- pSTSE->io.BusSpeed,
- pCurrent_element->pData,
- pCurrent_element->length);
- if (ret != STSE_OK) {
- return ret;
- }
-
#ifdef STSE_FRAME_DEBUG_LOG
- printf("\n\r STSAFE Frame < ");
- stse_frame_debug_print(pFrame);
- printf("\n\r");
+ printf("\n\r STSAFE Frame < ");
+ stse_frame_debug_print(pFrame);
+ printf("\n\r");
#endif /* STSE_FRAME_DEBUG_LOG */
- /* - Swap CRC */
- stse_frame_element_swap_byte_order(&eCRC);
+ /* - Swap CRC */
+ stse_frame_element_swap_byte_order(&eCRC);
- /* - Pop CRC element from Frame*/
- stse_frame_pop_element(pFrame);
+ /* - Pop CRC element from Frame*/
+ stse_frame_pop_element(pFrame);
- /* - Compute CRC */
- ret = stse_frame_crc16_compute(pFrame, &computed_crc);
- if (ret != STSE_OK) {
- return ret;
- }
+ /* - Compute CRC */
+ ret = stse_frame_crc16_compute(pFrame, &computed_crc);
+ if (ret != STSE_OK) {
+ return ret;
+ }
- /* - Pop Filler element from Frame*/
- if (filler_size > 0) {
- stse_frame_pop_element(pFrame);
- }
+ /* - Pop Filler element from Frame*/
+ if (filler_size > 0) {
+ stse_frame_pop_element(pFrame);
+ }
- /* - Verify CRC */
- if (computed_crc != *(PLAT_UI16 *)received_crc) {
- return (STSE_SERVICE_FRAME_CRC_ERROR);
- }
+ /* - Verify CRC */
+ if (computed_crc != *(PLAT_UI16 *)received_crc) {
+ return (STSE_SERVICE_FRAME_CRC_ERROR);
+ }
- ret = (stse_ReturnCode_t)(pFrame->first_element->pData[0] & STSE_STSAFEA_RSP_STATUS_MASK);
+ ret = (stse_ReturnCode_t)(pFrame->first_element->pData[0] & STSE_STSAFEA_RSP_STATUS_MASK);
+ }
return ret;
}
diff --git a/services/stsafea/stsafea_frame_transfer.h b/services/stsafea/stsafea_frame_transfer.h
index 2bdfc839..bbf3d886 100644
--- a/services/stsafea/stsafea_frame_transfer.h
+++ b/services/stsafea/stsafea_frame_transfer.h
@@ -29,7 +29,7 @@
#include "core/stse_return_codes.h"
#include "core/stse_util.h"
-#define STSAFEA_PRODUCT_COUNT 4U
+#define STSAFEA_PRODUCT_COUNT 3U
extern const PLAT_UI16 stsafea_maximum_frame_length[STSAFEA_PRODUCT_COUNT];
diff --git a/services/stsafea/stsafea_hash.c b/services/stsafea/stsafea_hash.c
index 06e4fae7..b61c4b6b 100644
--- a/services/stsafea/stsafea_hash.c
+++ b/services/stsafea/stsafea_hash.c
@@ -91,7 +91,6 @@ stse_ReturnCode_t stsafea_start_hash(
PLAT_UI16 message_size) {
PLAT_UI8 cmd_header[STSAFEA_EXT_HEADER_SIZE] = {STSAFEA_EXTENDED_COMMAND_PREFIX, STSAFEA_EXTENDED_CMD_START_HASH};
PLAT_UI8 rsp_header;
- PLAT_UI16 hash_algo_id_length = STSAFEA_HASH_ALGO_ID_SIZE;
if (pSTSE == NULL) {
return (STSE_SERVICE_HANDLER_NOT_INITIALISED);
@@ -104,7 +103,7 @@ stse_ReturnCode_t stsafea_start_hash(
/*- Create CMD frame and populate elements */
stse_frame_allocate(CmdFrame);
stse_frame_element_allocate_push(&CmdFrame, eCmd_header, STSAFEA_EXT_HEADER_SIZE, cmd_header);
- stse_frame_element_allocate_push(&CmdFrame, eHashAlgo, hash_algo_id_length, (PLAT_UI8 *)&stsafea_hash_info_table[sha_algorithm].id);
+ stse_frame_element_allocate_push(&CmdFrame, eHashAlgo, STSAFEA_HASH_ALGO_ID_SIZE, (PLAT_UI8 *)&stsafea_hash_info_table[sha_algorithm].id);
stse_frame_element_allocate_push(&CmdFrame, eMessage, message_size, pMessage);
/*- Create Rsp frame and populate elements*/
diff --git a/services/stsafea/stsafea_hash.h b/services/stsafea/stsafea_hash.h
index c899c20e..bff5f09e 100644
--- a/services/stsafea/stsafea_hash.h
+++ b/services/stsafea/stsafea_hash.h
@@ -111,7 +111,9 @@ extern const stsafea_hash_info_t stsafea_hash_info_table[];
* \param[in] pSTSE Pointer to target SE handler
* \param[in] sha_algorithm \ref stse_hash_algorithm_t SHA algorithm
* \param[in] pMessage Pointer to message buffer
- * \param[in] message_size Input message length in bytes
+ * \param[in] message_size Input message length in bytes
+ * message_size maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 15
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
*/
stse_ReturnCode_t stsafea_start_hash(stse_Handler_t *pSTSE,
@@ -124,7 +126,9 @@ stse_ReturnCode_t stsafea_start_hash(stse_Handler_t *pSTSE,
* \details This service format and send/receive STSAFE-Axxx process hash command/response
* \param[in] pSTSE Pointer to target SE handler
* \param[in] pMessage Pointer to message buffer
- * \param[in] message_size Input message length in bytes
+ * \param[in] message_size Input message length in bytes
+ * message_size maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 4
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
*/
stse_ReturnCode_t stsafea_process_hash(
@@ -138,7 +142,9 @@ stse_ReturnCode_t stsafea_process_hash(
* \param[in] pSTSE Pointer to target SE handler
* \param[in] sha_algorithm \ref stse_hash_algorithm_t SHA algorithm
* \param[in] pMessage Pointer to message buffer
- * \param[in] message_size Input message length in bytes
+ * \param[in] message_size Input message length in bytes
+ * message_size maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 4
* \param[out] pDigest Pointer to digest buffer
* \param[out] pDigest_size Digest buffer length in bytes
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
diff --git a/services/stsafea/stsafea_low_power.c b/services/stsafea/stsafea_low_power.c
index fb60b401..9832cdf5 100644
--- a/services/stsafea/stsafea_low_power.c
+++ b/services/stsafea/stsafea_low_power.c
@@ -28,7 +28,6 @@ stse_ReturnCode_t stsafea_hibernate(stse_Handler_t *pSTSE,
stse_hibernate_wake_up_mode_t wake_up_mode)
{
- (void)wake_up_mode;
PLAT_UI8 cmd_header = STSAFEA_CMD_HIBERNATE;
PLAT_UI8 rsp_header;
@@ -39,6 +38,7 @@ stse_ReturnCode_t stsafea_hibernate(stse_Handler_t *pSTSE,
/*- Create CMD frame and populate elements */
stse_frame_allocate(CmdFrame);
stse_frame_element_allocate_push(&CmdFrame, eCmd_header, 1, &cmd_header);
+ stse_frame_element_allocate_push(&CmdFrame, e_wake_up_mode, 1, &wake_up_mode);
/*- Create Rsp frame and populate elements*/
stse_frame_allocate(RspFrame);
diff --git a/services/stsafea/stsafea_mac.h b/services/stsafea/stsafea_mac.h
index 8c928222..9cd653e2 100644
--- a/services/stsafea/stsafea_mac.h
+++ b/services/stsafea/stsafea_mac.h
@@ -42,7 +42,10 @@
* \param[in] pSTSE Pointer to STSE Handler
* \param[in] slot_number Key slot in symmetric key table to be used
* \param[in] pMessage Plaintext message
- * \param[in] message_length Plaintext message length
+ * \param[in] message_length Plaintext message length
+ * message_length maximum value (in bytes):
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 6
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 6
* \param[out] pMac Buffer to store the MAC
* \param[out] mac_length MAC length (CMAC:2,4,8,16 / HMAC:16-32)
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
@@ -63,7 +66,10 @@ stse_ReturnCode_t stsafea_cmac_hmac_compute(
* \param[in] pMac Buffer containing the MAC
* \param[in] mac_length MAC length (CMAC:2,4,8,16 / HMAC:16-32)
* \param[in] pMessage Plaintext message
- * \param[in] message_length Plaintext message length
+ * \param[in] message_length Plaintext message length
+ * message_length maximum value (in bytes):
+ * - STSAFE-A110 : STSAFEA_MAX_FRAME_LENGTH_A110 - 6 - mac_length
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 6 - mac_length
* \param[out] verification_result Verification result flag
* \return \ref STSE_OK on success ; \ref stse_ReturnCode_t error code otherwise
*/
@@ -83,7 +89,9 @@ stse_ReturnCode_t stsafea_cmac_hmac_verify(
* \param[in] slot_number Key slot in symmetric key table to be used
* \param[in] IV_length IV buffer length in bytes
* \param[in] pIV IV buffer
- * \param[in] associated_data_length Length of the associated data
+ * \param[in] associated_data_length Length of the associated data
+ * message_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - IV_length
* \param[in] pAssociated_data Buffer containing associated data
* \param[in] authentication_tag_length Expected length for the authentication tag
* \param[out] pAuthentication_tag Buffer to store the authentication tag
@@ -106,7 +114,9 @@ stse_ReturnCode_t stsafea_aes_gmac_compute(
* \param[in] slot_number Key slot in symmetric key table to be used
* \param[in] IV_length IV buffer length in bytes
* \param[in] pIV IV buffer
- * \param[in] associated_data_length Length of the associated data
+ * \param[in] associated_data_length Length of the associated data
+ * message_length maximum value (in bytes):
+ * - STSAFE-A120 : STSAFEA_MAX_FRAME_LENGTH_A120 - 11 - IV_length - authentication_tag_length
* \param[in] pAssociated_data Buffer containing associated data
* \param[in] authentication_tag_length Expected length for the authentication tag
* \param[in] pAuthentication_tag Buffer containing the authentication tag
diff --git a/services/stsafea/stsafea_put_query.c b/services/stsafea/stsafea_put_query.c
index f68077b9..4325194e 100644
--- a/services/stsafea/stsafea_put_query.c
+++ b/services/stsafea/stsafea_put_query.c
@@ -98,8 +98,7 @@ stse_ReturnCode_t stsafea_put_i2c_parameters(
#endif
if (pSTSE->device_type == STSAFE_A100 ||
- pSTSE->device_type == STSAFE_A110 ||
- pSTSE->device_type == STSAFE_A200) {
+ pSTSE->device_type == STSAFE_A110) {
pI2c_parameters->idle_bus_time_to_standby = 0;
}
diff --git a/services/stsafea/stsafea_random.c b/services/stsafea/stsafea_random.c
index 5e4fd8e3..89ad0f2d 100644
--- a/services/stsafea/stsafea_random.c
+++ b/services/stsafea/stsafea_random.c
@@ -44,7 +44,7 @@ stse_ReturnCode_t stsafea_generate_random(
/*- Create CMD frame and populate elements */
stse_frame_allocate(CmdFrame);
- stse_frame_element_allocate_push(&CmdFrame, eCmd_header, 1, &cmd_header);
+ stse_frame_element_allocate_push(&CmdFrame, eCmd_header, STSAFEA_HEADER_SIZE, &cmd_header);
stse_frame_element_allocate_push(&CmdFrame, eSubject, 1, &subject);
stse_frame_element_allocate_push(&CmdFrame, eSize, 1, &random_size);
diff --git a/services/stsafea/stsafea_reset.c b/services/stsafea/stsafea_reset.c
index c7ad0833..ded816c6 100644
--- a/services/stsafea/stsafea_reset.c
+++ b/services/stsafea/stsafea_reset.c
@@ -34,7 +34,7 @@ stse_ReturnCode_t stsafea_reset(stse_Handler_t *pSTSE) {
/*- Create CMD frame and populate elements */
stse_frame_allocate(CmdFrame);
- stse_frame_element_allocate_push(&CmdFrame, eCmd_header, 1, &cmd_header);
+ stse_frame_element_allocate_push(&CmdFrame, eCmd_header, STSAFEA_HEADER_SIZE, &cmd_header);
/*- Create Rsp frame and populate elements*/
stse_frame_allocate(RspFrame);
diff --git a/services/stsafea/stsafea_timings.c b/services/stsafea/stsafea_timings.c
index 5f0ab3ab..40155ebc 100644
--- a/services/stsafea/stsafea_timings.c
+++ b/services/stsafea/stsafea_timings.c
@@ -118,38 +118,6 @@ const PLAT_UI16 stsafea_cmd_timings[STSAFEA_PRODUCT_COUNT][STSAFEA_MAX_CMD_COUNT
STSAFEA_EXEC_TIME_DEFAULT, /* Verify Password (Not applicable)*/
5, /* Encrypt */
6 /* Decrypt */
- },
- /* STSAFE_A200 */
- {
- STSAFEA_EXEC_TIME_DEFAULT, /* Echo */
- STSAFEA_EXEC_TIME_DEFAULT, /* Reset */
- STSAFEA_EXEC_TIME_DEFAULT, /* Generate Random */
- STSAFEA_EXEC_TIME_DEFAULT, /* Start Session */
- STSAFEA_EXEC_TIME_DEFAULT, /* Decrement zone counter */
- STSAFEA_EXEC_TIME_DEFAULT, /* Read zone */
- STSAFEA_EXEC_TIME_DEFAULT, /* Update zone */
- STSAFEA_EXEC_TIME_DEFAULT, /* Increment zone counter */
- STSAFEA_EXEC_TIME_DEFAULT, /* Derive LORA key */
- STSAFEA_EXEC_TIME_DEFAULT, /* Generate MAC */
- STSAFEA_EXEC_TIME_DEFAULT, /* Verify MAC */
- STSAFEA_EXEC_TIME_DEFAULT, /* Unwrap issuer envelope */
- STSAFEA_EXEC_TIME_DEFAULT, /* Delete MAC */
- STSAFEA_EXEC_TIME_DEFAULT, /* Hibernate */
- STSAFEA_EXEC_TIME_DEFAULT, /* Wrap Local Envelope */
- STSAFEA_EXEC_TIME_DEFAULT, /* Unwrap Local Envelope */
- STSAFEA_EXEC_TIME_DEFAULT, /* Put attribute */
- STSAFEA_EXEC_TIME_DEFAULT, /* Generate key */
- STSAFEA_EXEC_TIME_DEFAULT, /* Put key */
- STSAFEA_EXEC_TIME_DEFAULT, /* Configure */
- STSAFEA_EXEC_TIME_DEFAULT, /* Query */
- STSAFEA_EXEC_TIME_DEFAULT, /* Get Signature */
- STSAFEA_EXEC_TIME_DEFAULT, /* Generate Signature */
- STSAFEA_EXEC_TIME_DEFAULT, /* Verify Signature */
- STSAFEA_EXEC_TIME_DEFAULT, /* Establish Key */
- STSAFEA_EXEC_TIME_DEFAULT, /* Standby */
- STSAFEA_EXEC_TIME_DEFAULT, /* Verify Password */
- STSAFEA_EXEC_TIME_DEFAULT, /* Encrypt */
- STSAFEA_EXEC_TIME_DEFAULT /* Decrypt */
}};
const PLAT_UI16 stsafea_extended_cmd_timings[STSAFEA_PRODUCT_COUNT][STSAFEA_MAX_EXT_CMD_COUNT] = {
@@ -216,37 +184,6 @@ const PLAT_UI16 stsafea_extended_cmd_timings[STSAFEA_PRODUCT_COUNT][STSAFEA_MAX_
STSAFEA_EXEC_TIME_DEFAULT,
STSAFEA_EXEC_TIME_DEFAULT},
/* STSAFE_A120 */
- {
- STSAFEA_EXEC_TIME_DEFAULT, /* start hash */
- STSAFEA_EXEC_TIME_DEFAULT, /* process hash */
- STSAFEA_EXEC_TIME_DEFAULT, /* finish hash */
- STSAFEA_EXEC_TIME_DEFAULT, /* start volatile KEK session*/
- STSAFEA_EXEC_TIME_DEFAULT, /* establish symmetric keys */
- STSAFEA_EXEC_TIME_DEFAULT, /* confirm symmetric keys */
- STSAFEA_EXEC_TIME_DEFAULT, /* stop volatile KEK session */
- STSAFEA_EXEC_TIME_DEFAULT, /* WRITE_HOST_KEY_V2_PLAINTEXT */
- STSAFEA_EXEC_TIME_DEFAULT, /* WRITE_HOST_KEY_V2_WRAPPED */
- STSAFEA_EXEC_TIME_DEFAULT, /* WRITE_SYMMETRIC_KEY */
- STSAFEA_EXEC_TIME_DEFAULT, /* WRITE_PUBLIC_KEY */
- STSAFEA_EXEC_TIME_DEFAULT, /* GENERATE_ECDHE */
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT,
- STSAFEA_EXEC_TIME_DEFAULT},
- /* STSAFE_A200 */
{
STSAFEA_EXEC_TIME_DEFAULT, /* start hash */
STSAFEA_EXEC_TIME_DEFAULT, /* process hash */
@@ -282,14 +219,12 @@ const PLAT_UI16 stsafea_boot_time[STSAFEA_PRODUCT_COUNT] = {
STSAFEA_BOOT_TIME_DEFAULT, /* STSAFE_A100 */
STSAFEA_BOOT_TIME_DEFAULT, /* STSAFE_A110 */
STSAFEA_BOOT_TIME_DEFAULT, /* STSAFE_A120 */
- STSAFEA_BOOT_TIME_DEFAULT /* STSAFE_A200 */
};
const PLAT_UI16 stsafea_wakeup_time[STSAFEA_PRODUCT_COUNT] = {
STSAFEA_WAKEUP_TIME_DEFAULT, /* STSAFE_A100 */
STSAFEA_WAKEUP_TIME_DEFAULT, /* STSAFE_A110 */
STSAFEA_WAKEUP_TIME_DEFAULT, /* STSAFE_A120 */
- STSAFEA_WAKEUP_TIME_DEFAULT /* STSAFE_A200 */
};
#endif /* STSE_CONF_STSAFE_A_SUPPORT */