Crypto: Improve code quality
This patch fixes the following things:
* add const keyword when mutability is not required
* cast unused parameters/return values to void to be more explicit
Change-Id: I62471d95cc3249db2cf00fdd12c9634f12e99747
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
diff --git a/interface/include/crypto_psa_wrappers.h b/interface/include/crypto_psa_wrappers.h
index 81d3894..61c4772 100644
--- a/interface/include/crypto_psa_wrappers.h
+++ b/interface/include/crypto_psa_wrappers.h
@@ -39,8 +39,7 @@
* \brief This function is a TF-M compatible wrapper for the
* \ref tfm_crypto_cipher_update implemented in the Crypto service
*
- * \param[out] operation Pointer to the structure containing output parameters
- * associated with \ref psa_cipher_update_output
+ * \param[out] operation Pointer to a cipher operation context in the backend
* \param[in] input_s Pointer to the structure containing input parameters
* associated with \ref psa_cipher_update_input
* \param[out] output_s Pointer to the structure containing output parameters
@@ -48,9 +47,9 @@
*
*/
enum tfm_crypto_err_t tfm_crypto_cipher_update_wrapper(
- psa_cipher_operation_t *operation,
- struct psa_cipher_update_input *input_s,
- struct psa_cipher_update_output *output_s);
+ psa_cipher_operation_t *operation,
+ const struct psa_cipher_update_input *input_s,
+ const struct psa_cipher_update_output *output_s);
/*!
* \struct psa_aead_encrypt_input
@@ -121,8 +120,8 @@
*
*/
enum tfm_crypto_err_t tfm_crypto_aead_encrypt_wrapper(
- struct psa_aead_encrypt_input *input_s,
- struct psa_aead_encrypt_output *output_s);
+ const struct psa_aead_encrypt_input *input_s,
+ const struct psa_aead_encrypt_output *output_s);
/*!
* \brief This function is a TF-M compatible wrapper for the
* \ref tfm_crypto_aead_decrypt implemented in the Crypto service
@@ -134,8 +133,8 @@
*
*/
enum tfm_crypto_err_t tfm_crypto_aead_decrypt_wrapper(
- struct psa_aead_decrypt_input *input_s,
- struct psa_aead_decrypt_output *output_s);
+ const struct psa_aead_decrypt_input *input_s,
+ const struct psa_aead_decrypt_output *output_s);
#ifdef __cplusplus
}
#endif
diff --git a/interface/src/tfm_crypto_api.c b/interface/src/tfm_crypto_api.c
index 9d28d5b..1ee71d8 100644
--- a/interface/src/tfm_crypto_api.c
+++ b/interface/src/tfm_crypto_api.c
@@ -83,6 +83,11 @@
size_t data_size,
size_t *data_length)
{
+ (void)key;
+ (void)data;
+ (void)data_size;
+ (void)data_length;
+
/* TODO: This API is not supported yet */
return PSA_ERROR_NOT_SUPPORTED;
}