diff --git a/src/tpm2.c b/src/tpm2.c index 89f6b137..45ad5087 100644 --- a/src/tpm2.c +++ b/src/tpm2.c @@ -4831,6 +4831,9 @@ TPM_RC TPM2_NV_Write(NV_Write_In* in) TPM2_Packet_Init(ctx, &packet); TPM2_Packet_AppendU32(&packet, in->authHandle); + /* When using an HMAC or Policy session make sure the NV "name" is + * populated in the TPM2_AUTH_SESSION name.name. This is a computed + * hash (see TPM2_HashNvPublic) */ TPM2_Packet_AppendU32(&packet, in->nvIndex); TPM2_Packet_AppendAuth(&packet, ctx, &info);