Re: [PATCH v11 06/20] x86/virt/tdx: Handle SEAMCALL running out of entropy error

From: Huang, Kai
Date: Wed Jun 07 2023 - 19:36:46 EST


On Wed, 2023-06-07 at 08:08 -0700, Hansen, Dave wrote:
> On 6/4/23 07:27, Kai Huang wrote:
> > Certain SEAMCALL leaf functions may return error due to running out of
> > entropy, in which case the SEAMCALL should be retried as suggested by
> > the TDX spec.
> >
> > Handle this case in SEAMCALL common function. Mimic the existing
> > rdrand_long() to retry RDRAND_RETRY_LOOPS times.
>
> ... because who are we kidding? When the TDX module says it doesn't
> have enough entropy it means rdrand.

The TDX spec says "e.g., RDRAND or RDSEED".

Do you prefer below?

Certain SEAMCALL leaf functions may return error due to running out of entropy
(e.g., RDRAND or RDSEED), in which case the SEAMCALL should be retried as
suggested by the TDX spec.

Handle this case in SEAMCALL common function. Based on the SDM there's no big
difference between RDRAND and RDSEED except the latter is "compliant to NIST
SP800-90B and NIST SP800-90C in the XOR construction mode". Just Mimic the
existing rdrand_long() to retry RDRAND_RETRY_LOOPS times.

>
> Reviewed-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
>

Thanks!