pkwrite: zeroize buf containing info of private key

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-08-28 10:35:39 +08:00
parent edbab91bf8
commit 044eb16379

View file

@ -860,7 +860,7 @@ int mbedtls_pk_write_key_pem(const mbedtls_pk_context *key, unsigned char *buf,
ret = 0; ret = 0;
cleanup: cleanup:
mbedtls_free(output_buf); mbedtls_zeroize_and_free(output_buf, PRV_DER_MAX_BYTES);
return ret; return ret;
} }
#endif /* MBEDTLS_PEM_WRITE_C */ #endif /* MBEDTLS_PEM_WRITE_C */