Re: [PATCH v15 03/13] x86/sev: Add Secure TSC support for SNP guests

Nikunj A. Dadhania
2025-01-06T04:34:55Z

On 1/5/2025 1:56 AM, Francesco Lavra wrote:
> On 2024-12-03 at 9:00, Nikunj A Dadhania wrote:

>> +
>> +e_request:
>> + /* The response buffer contains sensitive data, explicitly
>> clear it. */
>> + memzero_explicit(buf, sizeof(buf));
>> + memzero_explicit(tsc_resp, sizeof(*tsc_resp));
>
> buf is an unsigned char *, so by using sizeof(buf) you are not zeroing
> the entire buffer.
> Also, I see no point in having a separate tsc_resp buffer just to copy
> the response from buf to tsc_resp, if you just use a single buffer with
> size (SNP_TSC_INFO_RESP_SZ + AUTHTAG_LEN) and parse the response from
> that buffer you will avoid the double buffer allocation, the memory
> copying, and the double zeroing.

Makes sense, will update.

Regards
Nikunj