Cppcheck: Fix warnings with updated tf-m-ci-scripts
Several cppcheck warnings are fixed in the following modules:
- Interface
- Partitions: Crypto/ITS/PS/Platform
- SPRTL headers
- Various headers
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I08c9fa10895c0b723a2d8b3cdcd386b1752facaa
diff --git a/interface/src/tfm_crypto_ipc_api.c b/interface/src/tfm_crypto_ipc_api.c
index fbb69d3..67842ac 100644
--- a/interface/src/tfm_crypto_ipc_api.c
+++ b/interface/src/tfm_crypto_ipc_api.c
@@ -778,7 +778,7 @@
.sfn_id = TFM_CRYPTO_AEAD_ENCRYPT_SID,
.key_id = key,
.alg = alg,
- .aead_in = {.nonce = {0}, .nonce_length = nonce_length}
+ .aead_in = {.nonce = {0}, .nonce_length = 0}
};
/* Sanitize the optional input */
@@ -787,7 +787,7 @@
}
psa_invec in_vec[] = {
- {.base = &iov, .len = sizeof(struct tfm_crypto_pack_iovec)},
+ {.base = NULL, .len = 0},
{.base = plaintext, .len = plaintext_length},
{.base = additional_data, .len = additional_data_length},
};
@@ -803,8 +803,12 @@
for (size_t idx = 0; idx < nonce_length; idx++) {
iov.aead_in.nonce[idx] = nonce[idx];
}
+ iov.aead_in.nonce_length = nonce_length;
}
+ in_vec[0].base = &iov;
+ in_vec[0].len = sizeof(struct tfm_crypto_pack_iovec);
+
size_t in_len = IOVEC_LEN(in_vec);
if (additional_data == NULL) {
in_len--;
@@ -834,7 +838,7 @@
.sfn_id = TFM_CRYPTO_AEAD_DECRYPT_SID,
.key_id = key,
.alg = alg,
- .aead_in = {.nonce = {0}, .nonce_length = nonce_length}
+ .aead_in = {.nonce = {0}, .nonce_length = 0}
};
/* Sanitize the optional input */
@@ -843,7 +847,7 @@
}
psa_invec in_vec[] = {
- {.base = &iov, .len = sizeof(struct tfm_crypto_pack_iovec)},
+ {.base = NULL, .len = 0},
{.base = ciphertext, .len = ciphertext_length},
{.base = additional_data, .len = additional_data_length},
};
@@ -859,8 +863,12 @@
for (size_t idx = 0; idx < nonce_length; idx++) {
iov.aead_in.nonce[idx] = nonce[idx];
}
+ iov.aead_in.nonce_length = nonce_length;
}
+ in_vec[0].base = &iov;
+ in_vec[0].len = sizeof(struct tfm_crypto_pack_iovec);
+
size_t in_len = IOVEC_LEN(in_vec);
if (additional_data == NULL) {
in_len--;