Skip to content

Commit

Permalink
feat: mssim wireshark friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
jclab-joseph committed Sep 8, 2023
1 parent f17b035 commit 1039771
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tpmutil/mssim/mssim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 1039771

Please sign in to comment.