From: Sean Edmond <[email protected]>

The TPM 2.0 command reference shows "auth" (type TPM2B_AUTH) before
"publicInfo" (type TPM2B_NV_PUBLIC).

The TPM v2 driver was updated to add this field.  The sandbox driver
needs to be updated to match the driver implementation.

Signed-off-by: Sean Edmond <[email protected]>
---
 drivers/tpm/tpm2_tis_sandbox.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
index e4004cfcca..3e38d28637 100644
--- a/drivers/tpm/tpm2_tis_sandbox.c
+++ b/drivers/tpm/tpm2_tis_sandbox.c
@@ -758,8 +758,10 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 
*sendbuf,
                break;
        }
        case TPM2_CC_NV_DEFINE_SPACE: {
-               int policy_size, index, seq;
+               int policy_size, auth_size, index, seq;
 
+               auth_size = get_unaligned_be16(sent);
+               sent += 2 + auth_size;
                policy_size = get_unaligned_be16(sent + 12);
                index = get_unaligned_be32(sent + 2);
                sent += 14 + policy_size;
-- 
2.40.0

Reply via email to