Skip to content

Commit a268b81

Browse files
author
Moran Peker
committed
Remove extra buffers used
outputting straight into the final destination
1 parent ec5c3c1 commit a268b81

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static enum tfm_plat_err_t attest_public_key_sha256(uint32_t *size, uint8_t *buf
112112

113113
crypto_ret = psa_hash_finish(&hash_handle,
114114
buf,
115-
*size,
115+
ATTEST_PUB_KEY_SHA_256_SIZE,
116116
(size_t *) size);
117117
if (crypto_ret != PSA_SUCCESS) {
118118
status = TFM_PLAT_ERR_SYSTEM_ERR;
@@ -167,19 +167,13 @@ enum tfm_plat_err_t tfm_plat_get_boot_seed(uint32_t size, uint8_t *buf)
167167
enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf)
168168
{
169169
enum tfm_plat_err_t status;
170-
uint8_t *p_dst;
171-
uint8_t p_src[ATTEST_PUB_KEY_SHA_256_SIZE];
172-
uint32_t p_src_size = ATTEST_PUB_KEY_SHA_256_SIZE;
173170

174171
buf[0] = 0x01; /* First byte is type byte: 0x01 indicates GUID */
175-
p_dst = &buf[1];
176172

177-
status = attest_public_key_sha256(&p_src_size, p_src);
178-
179-
copy_id(p_dst, p_src, p_src_size);
173+
status = attest_public_key_sha256(size, &buf[1]);
180174

181175
/* Instance ID size: 1 type byte + size of public key hash */
182-
*size = p_src_size + 1;
176+
*size = *size + 1;
183177

184178
return status;
185179
}

0 commit comments

Comments
 (0)