From 1039771cca421088204605f2cd566ad1662d5978 Mon Sep 17 00:00:00 2001 From: joseph Date: Fri, 8 Sep 2023 16:24:00 +0900 Subject: [PATCH] feat: mssim wireshark friendly --- tpmutil/mssim/mssim.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 }