Commit 2c30af8f1861f09f217097460bfbea5ea691f8b8

Authored by Che-Liang Chiou
Committed by Simon Glass
1 parent b88eb329ce

sandbox: tpm: Fix nvwrite command

The original codes misused recvbuf in source buffer instead of sendbuf,
and read from incorrect offset 14 instead of 22.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>

Showing 1 changed file with 1 additions and 3 deletions Side-by-side Diff

drivers/tpm/tpm_tis_sandbox.c
... ... @@ -190,9 +190,7 @@
190 190 if (seq < 0)
191 191 return -1;
192 192 printf("tpm: nvwrite index=%#02x, len=%#02x\n", index, length);
193   - memcpy(&tpm->nvdata[seq],
194   - recvbuf + TPM_RESPONSE_HEADER_LENGTH + sizeof(uint32_t),
195   - length);
  193 + memcpy(&tpm->nvdata[seq], sendbuf + 22, length);
196 194 *recv_len = 12;
197 195 memset(recvbuf, '\0', *recv_len);
198 196 break;