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
pull/9668/head
Moran Peker 2019-02-28 15:54:45 +02:00
parent 6346442f03
commit 2b8621aa6c
3 changed files with 3 additions and 2 deletions

View File

@ -208,6 +208,7 @@ t_cose_crypto_hash_start(struct t_cose_crypto_hash *hash_ctx,
} }
psa_hash_ctx = (struct t_cose_psa_crypto_hash *)hash_ctx; psa_hash_ctx = (struct t_cose_psa_crypto_hash *)hash_ctx;
memset(&psa_hash_ctx->operation, 0, sizeof(psa_hash_operation_t));
psa_ret = psa_hash_setup(&psa_hash_ctx->operation, psa_ret = psa_hash_setup(&psa_hash_ctx->operation,
cose_hash_alg_id_to_psa(cose_hash_alg_id)); cose_hash_alg_id_to_psa(cose_hash_alg_id));

View File

@ -70,7 +70,7 @@ static enum tfm_plat_err_t attest_public_key_sha256(uint32_t *size, uint8_t *buf
psa_status_t crypto_ret; psa_status_t crypto_ret;
enum tfm_plat_err_t status = TFM_PLAT_ERR_SUCCESS; enum tfm_plat_err_t status = TFM_PLAT_ERR_SUCCESS;
psa_hash_operation_t hash_handle; psa_hash_operation_t hash_handle = {0};
crypto_ret = psa_open_key(PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle); crypto_ret = psa_open_key(PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle);
if (crypto_ret != PSA_SUCCESS) { if (crypto_ret != PSA_SUCCESS) {

View File

@ -295,7 +295,7 @@ struct t_cose_crypto_hash {
* actual hash implementation, so this is a fairly large and * actual hash implementation, so this is a fairly large and
* accommodating size. * accommodating size.
*/ */
uint8_t bytes[128]; uint8_t bytes[280];
}; };