Object: clear out sensitive area if on load if not provided

When an object is later marshalled in TPM2_ContextSave, the publicOnly
attribute isn't taken into account and therefore potentially stale
sensitive information can be marshalled, which is a problem if the
buffer sizes it contains have values that are too large - this
triggers assertion failures.

Avoid this by clearing out the sensitive area upon ObjectLoad if not
provided, making the behaviour consistent with when a fresh, unused,
object entry is used.

Signed-off-by: Rob Shearman <rob@graphiant.com>
This commit is contained in:
Rob Shearman 2023-08-05 11:44:23 +01:00 committed by Stefan Berger
parent 0293264228
commit e2b5c4f5a8

View File

@ -460,7 +460,10 @@ ObjectLoad(
object->publicArea = *publicArea;
// If there is a sensitive area, load it
if(sensitive == NULL)
object->attributes.publicOnly = SET;
{ // libtpms changed begin
object->attributes.publicOnly = SET;
MemorySet(&object->sensitive, 0, sizeof(object->sensitive)); // needed for libtpms.
} // libtpms changed end
else
{
object->sensitive = *sensitive;