diff --git a/bogo_shim_test.go b/bogo_shim_test.go index 731fcd6d..e1a393c8 100644 --- a/bogo_shim_test.go +++ b/bogo_shim_test.go @@ -2,11 +2,11 @@ package tls import ( "crypto/x509" - "encoding/binary" "encoding/json" "encoding/pem" "flag" "fmt" + "internal/byteorder" "internal/testenv" "io" "log" @@ -186,7 +186,7 @@ func bogoShim() { // Write the shim ID we were passed as a little endian uint64 shimIDBytes := make([]byte, 8) - binary.LittleEndian.PutUint64(shimIDBytes, *shimID) + byteorder.LePutUint64(shimIDBytes, *shimID) if _, err := conn.Write(shimIDBytes); err != nil { log.Fatalf("failed to write shim id: %s", err) } diff --git a/handshake_client_test.go b/handshake_client_test.go index ee9e79af..157c67ff 100644 --- a/handshake_client_test.go +++ b/handshake_client_test.go @@ -10,10 +10,10 @@ import ( "crypto/rsa" "crypto/x509" "encoding/base64" - "encoding/binary" "encoding/pem" "errors" "fmt" + "internal/byteorder" "io" "math/big" "net" @@ -202,7 +202,7 @@ func (test *clientTest) connFromCommand() (conn *recordingConn, child *exec.Cmd, var serverInfo bytes.Buffer for _, ext := range test.extensions { pem.Encode(&serverInfo, &pem.Block{ - Type: fmt.Sprintf("SERVERINFO FOR EXTENSION %d", binary.BigEndian.Uint16(ext)), + Type: fmt.Sprintf("SERVERINFO FOR EXTENSION %d", byteorder.BeUint16(ext)), Bytes: ext, }) } diff --git a/handshake_server_tls13.go b/handshake_server_tls13.go index 60a38830..7f15d05b 100644 --- a/handshake_server_tls13.go +++ b/handshake_server_tls13.go @@ -10,9 +10,9 @@ import ( "crypto" "crypto/hmac" "crypto/rsa" - "encoding/binary" "errors" "hash" + "internal/byteorder" "io" "time" ) @@ -866,7 +866,7 @@ func (c *Conn) sendSessionTicket(earlyData bool) error { if _, err := c.config.rand().Read(ageAdd); err != nil { return err } - m.ageAdd = binary.LittleEndian.Uint32(ageAdd) + m.ageAdd = byteorder.LeUint32(ageAdd) if earlyData { // RFC 9001, Section 4.6.1