Remove extra buffers used

outputting straight into the final destination
pull/9668/head
Moran Peker 2019-02-25 15:25:59 +02:00
parent ec5c3c163d
commit a268b81a57
1 changed files with 3 additions and 9 deletions

View File

@ -112,7 +112,7 @@ static enum tfm_plat_err_t attest_public_key_sha256(uint32_t *size, uint8_t *buf
crypto_ret = psa_hash_finish(&hash_handle, crypto_ret = psa_hash_finish(&hash_handle,
buf, buf,
*size, ATTEST_PUB_KEY_SHA_256_SIZE,
(size_t *) size); (size_t *) size);
if (crypto_ret != PSA_SUCCESS) { if (crypto_ret != PSA_SUCCESS) {
status = TFM_PLAT_ERR_SYSTEM_ERR; 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)
enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf) enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf)
{ {
enum tfm_plat_err_t status; enum tfm_plat_err_t status;
uint8_t *p_dst;
uint8_t p_src[ATTEST_PUB_KEY_SHA_256_SIZE];
uint32_t p_src_size = ATTEST_PUB_KEY_SHA_256_SIZE;
buf[0] = 0x01; /* First byte is type byte: 0x01 indicates GUID */ buf[0] = 0x01; /* First byte is type byte: 0x01 indicates GUID */
p_dst = &buf[1];
status = attest_public_key_sha256(&p_src_size, p_src); status = attest_public_key_sha256(size, &buf[1]);
copy_id(p_dst, p_src, p_src_size);
/* Instance ID size: 1 type byte + size of public key hash */ /* Instance ID size: 1 type byte + size of public key hash */
*size = p_src_size + 1; *size = *size + 1;
return status; return status;
} }