Skip to content

Commit

Permalink
Move to common.RandInt
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeuw committed Apr 14, 2024
1 parent 5988b43 commit dc2e83f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions internal/server/TLS.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"math/rand"
"net"

"github.com/cbeuw/Cloak/internal/common"
Expand Down Expand Up @@ -46,8 +45,7 @@ func (TLS) makeResponder(clientHelloSessionId []byte, sharedSecret [32]byte) Res
// the cert length needs to be the same for all handshakes belonging to the same session
// we can use sessionKey as a seed here to ensure consistency
possibleCertLengths := []int{42, 27, 68, 59, 36, 44, 46}
rand.Seed(int64(sessionKey[0]))
cert := make([]byte, possibleCertLengths[rand.Intn(len(possibleCertLengths))])
cert := make([]byte, possibleCertLengths[common.RandInt(len(possibleCertLengths))])
common.RandRead(randSource, cert)

var nonce [12]byte
Expand Down

0 comments on commit dc2e83f

Please sign in to comment.