mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:04:02 +03:00
Have a noise of variable size
This commit is contained in:
@@ -7,10 +7,8 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
|
||||||
rnd "math/rand/v2"
|
rnd "math/rand/v2"
|
||||||
|
|
||||||
"github.com/9seconds/mtg/v2/mtglib/internal/doppel"
|
|
||||||
"github.com/9seconds/mtg/v2/mtglib/internal/tls"
|
"github.com/9seconds/mtg/v2/mtglib/internal/tls"
|
||||||
"golang.org/x/crypto/curve25519"
|
"golang.org/x/crypto/curve25519"
|
||||||
)
|
)
|
||||||
@@ -127,8 +125,7 @@ func generateChangeCipherValue(buf *bytes.Buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func generateNoise(buf *bytes.Buffer) {
|
func generateNoise(buf *bytes.Buffer) {
|
||||||
minSize := int(math.Round(0.75 * float64(doppel.TLSRecordSizeMax)))
|
data := make([]byte, int64(1024+rnd.IntN(3092)))
|
||||||
data := make([]byte, minSize+rnd.IntN(doppel.TLSRecordSizeMax-minSize))
|
|
||||||
|
|
||||||
if _, err := rand.Read(data[:]); err != nil {
|
if _, err := rand.Read(data[:]); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user