From e0e33e12d689e2d6607122b270c7ab068acf7789 Mon Sep 17 00:00:00 2001 From: Qian Wang Date: Fri, 2 Aug 2019 20:06:41 +0100 Subject: [PATCH] Fix non random GREASE generation --- internal/client/chrome.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/client/chrome.go b/internal/client/chrome.go index 5d0c04b..8c36b13 100644 --- a/internal/client/chrome.go +++ b/internal/client/chrome.go @@ -3,10 +3,9 @@ package client import ( + "crypto/rand" "encoding/binary" "encoding/hex" - "math/rand" - "time" ) type Chrome struct{} @@ -14,8 +13,9 @@ type Chrome struct{} func makeGREASE() []byte { // see https://tools.ietf.org/html/draft-davidben-tls-grease-01 // This is exclusive to Chrome. - rand.Seed(time.Now().UnixNano()) - sixteenth := rand.Intn(16) + var one [1]byte + rand.Read(one[:]) + sixteenth := one[0] % 16 monoGREASE := byte(sixteenth*16 + 0xA) doubleGREASE := []byte{monoGREASE, monoGREASE} return doubleGREASE