tpm2-software/tpm2-tss

[Specification question] Wrong type in TPMS_CONTEXT?

Opened this issue · 2 comments

I am having difficulties understanding what type that should actually be used in the TPMS_CONTEXT structure.

The Errata:
TPM 2.0 Library Specification 1.38 Errata 1.13, Section 2.19

.
To fix this, the handle type for savedHandle in the TPMS_CONTEXT structure should be changed from
TPMI_DH_CONTEXT to TPMI_DH_SAVE.
.
.
The commands affected by this change are TPM2_ContextLoad(), and TPM2_ContextSave()

The structures specification:
TCG TPM2 r1p59 Part2 Structures, Section 14.5
The type is now specified with the field 'savedHandle' having the type
TPMI_DH_SAVED.

The commands specification:
TCG TPM2 r1p59 Part 3 Commands, Section 28.2.2, Table 194 — TPM2_ContextSave Command
The 'saveHandle' field is specified as TPMI_DH_CONTEXT.

TCG TPM2 r1p59 Part 3 Commands, Section 28.3.2, Table 197 — TPM2_ContextLoad Response
The 'loadedHandle' in the response is specified as a TPMI_DH_CONTEXT.

The code:

TPMS_CONTEXT:

TPMI_DH_CONTEXT savedHandle; /* a handle indicating if the context is a session object or sequence objectSee Context Handle Values */

ContextSave:

TPMI_DH_CONTEXT saveHandle);

ContextLoad:

TPMI_DH_CONTEXT *loadedHandle);

The code seem to still specify all the fields as TPMI_DH_CONTEXT is there a reason for this?

And it seems to me as if the TPMI_DH_CONTEXT is no longer needed should it not be removed from the specification?

Sounds good; even though it's a minor thing.
PRs welcome.

The code is simple enough to change. It might be harder to update the specification.