diff --git a/tpmutil/mssim/mssim.go b/tpmutil/mssim/mssim.go index 2ec05e54..17fe20a7 100644 --- a/tpmutil/mssim/mssim.go +++ b/tpmutil/mssim/mssim.go @@ -172,12 +172,15 @@ func (c *Conn) Write(b []byte) (int, error) { buff.WriteByte(0) // size of the command binary.Write(buff, binary.BigEndian, uint32(len(b))) - // raw command - buff.Write(b) if _, err := buff.WriteTo(c.conn); err != nil { return 0, fmt.Errorf("write MS simulator command: %v", err) } + // The raw command is transmitted separately. Easy to analyze in wireshark. + // https://github.com/google/go-tpm/pull/339 + if _, err := c.conn.Write(b); err != nil { + return 0, fmt.Errorf("write MS simulator command: %v", err) + } return len(b), nil }