From dc2e83f75f2d78a2cf314c2a2a8c99d741215714 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Sun, 14 Apr 2024 16:27:00 +0100 Subject: [PATCH] Move to common.RandInt --- internal/server/TLS.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/server/TLS.go b/internal/server/TLS.go index 88e8f19..ea42138 100644 --- a/internal/server/TLS.go +++ b/internal/server/TLS.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io" - "math/rand" "net" "github.com/cbeuw/Cloak/internal/common" @@ -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