Skip to content

Commit

Permalink
crypto: replace encoding/binary in favour of internal/byteorder
Browse files Browse the repository at this point in the history
Updates #54097

Change-Id: I827a5efd1736ce057b76f079466f2d9ead225898
GitHub-Last-Rev: 40af10469d85ce9f4bef4b40025589d9e44f43d6
GitHub-Pull-Request: golang/go#67321
Reviewed-on: https://go-review.googlesource.com/c/go/+/585017
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
Commit-Queue: Ian Lance Taylor <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
mateusz834 authored and gopherbot committed May 13, 2024
1 parent eae001c commit 5197ef4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bogo_shim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package tls

import (
"crypto/x509"
"encoding/binary"
"encoding/json"
"encoding/pem"
"flag"
"fmt"
"internal/byteorder"
"internal/testenv"
"io"
"log"
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions handshake_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"encoding/binary"
"encoding/pem"
"errors"
"fmt"
"internal/byteorder"
"io"
"math/big"
"net"
Expand Down Expand Up @@ -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,
})
}
Expand Down
4 changes: 2 additions & 2 deletions handshake_server_tls13.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"crypto"
"crypto/hmac"
"crypto/rsa"
"encoding/binary"
"errors"
"hash"
"internal/byteorder"
"io"
"time"
)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5197ef4

Please sign in to comment.