Skip to content

Commit 2b8621a

Browse files
author
Moran Peker
committed
initialized psa_hash_operation_t to zeros before calling hash_setup
-initialized psa_hash_operation_t to zeros -fix TF-M attestation code - increase t_cose_crypto_hash bytes to handle max psa_hash_operation_t size
1 parent 6346442 commit 2b8621a

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/attest_crypto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ t_cose_crypto_hash_start(struct t_cose_crypto_hash *hash_ctx,
208208
}
209209

210210
psa_hash_ctx = (struct t_cose_psa_crypto_hash *)hash_ctx;
211+
memset(&psa_hash_ctx->operation, 0, sizeof(psa_hash_operation_t));
211212

212213
psa_ret = psa_hash_setup(&psa_hash_ctx->operation,
213214
cose_hash_alg_id_to_psa(cose_hash_alg_id));

components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/attest_iat_claims_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static enum tfm_plat_err_t attest_public_key_sha256(uint32_t *size, uint8_t *buf
7070

7171
psa_status_t crypto_ret;
7272
enum tfm_plat_err_t status = TFM_PLAT_ERR_SUCCESS;
73-
psa_hash_operation_t hash_handle;
73+
psa_hash_operation_t hash_handle = {0};
7474

7575
crypto_ret = psa_open_key(PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle);
7676
if (crypto_ret != PSA_SUCCESS) {

components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/tfm_impl/t_cose/src/t_cose_crypto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ struct t_cose_crypto_hash {
295295
* actual hash implementation, so this is a fairly large and
296296
* accommodating size.
297297
*/
298-
uint8_t bytes[128];
298+
uint8_t bytes[280];
299299
};
300300

301301

0 commit comments

Comments
 (0)