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/secure_fw/services/crypto/crypto_cipher.c b/secure_fw/services/crypto/crypto_cipher.c
index 85fe892..9f6ae9d 100644
--- a/secure_fw/services/crypto/crypto_cipher.c
+++ b/secure_fw/services/crypto/crypto_cipher.c
@@ -128,7 +128,7 @@
/* Start the crypto engine */
status = tfm_crypto_engine_cipher_start(&(ctx->engine_ctx), &engine_info);
if (status != PSA_SUCCESS) {
- /* Release the operation context */
+ /* Release the operation context, ignore if this operation fails. */
(void)tfm_crypto_cipher_release(operation, ctx);
return PSA_STATUS_TO_TFM_CRYPTO_ERR(status);
}
@@ -145,7 +145,7 @@
CRYPTO_CIPHER_MAX_KEY_LENGTH,
&key_size);
if (err != TFM_CRYPTO_ERR_PSA_SUCCESS) {
- /* Release the operation context */
+ /* Release the operation context, ignore if this operation fails. */
(void)tfm_crypto_cipher_release(operation, ctx);
return err;
}
@@ -156,7 +156,7 @@
key_size,
&engine_info);
if (status != PSA_SUCCESS) {
- /* Release the operation context */
+ /* Release the operation context, ignore if this operation fails. */
(void)tfm_crypto_cipher_release(operation, ctx);
return PSA_STATUS_TO_TFM_CRYPTO_ERR(status);
}
@@ -171,7 +171,7 @@
status = tfm_crypto_engine_cipher_set_padding_mode(&(ctx->engine_ctx),
&engine_info);
if (status != PSA_SUCCESS) {
- /* Release the operation context */
+ /* Release the operation context, ignore if this operation fails. */
(void)tfm_crypto_cipher_release(operation, ctx);
return PSA_STATUS_TO_TFM_CRYPTO_ERR(status);
}