Re: [PATCH v2 10/17] psp: track generations of device key

Willem de Bruijn
2025-06-26T00:20:08Z

Daniel Zahka wrote:
> From: Jakub Kicinski <kuba@kernel.org>
>
> There is a (somewhat theoretical in absence of multi-host support)
> possibility that another entity will rotate the key and we won't
> know. This may lead to accepting packets with matching SPI but
> which used different crypto keys than we expected. Maintain and
> compare "key generation" per PSP spec.

One option is for the device to include a generation id along
with the session key and SPI.

It already does, as the MSB of the SPI determines which of the two
device keys is responsible.

But this could be extended to multi-bit.

Another option to avoid this issue is for a device to notify the host
whenever it rotates the key. This can be due to a multi-host scenario
where another host requested a rotation. Or it may be a device
initiated rotation as it runs out of 31b SPI.

> Since we're tracking "key generations" more explicitly now,
> maintain different lists for associations from different generations.
> This way we can catch stale associations (the user space should
> listen to rotation notifications and change the keys).
>
> Drivers can "opt out" of generation tracking by setting
> the generation value to 0.

Why?

> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>