From 3546fd9286203c4188b0e3f2f01ae7b047552fb5 Mon Sep 17 00:00:00 2001 From: VeNoMouS Date: Wed, 11 Oct 2023 11:20:00 +1300 Subject: [PATCH] improvement: cleanup (#253) u_common.go: * Move if statement into existing switch case * Remove comment about keepPSK u_fingerprinter.go: * Remove comment about KeepPSK --- u_common.go | 7 ++----- u_fingerprinter.go | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/u_common.go b/u_common.go index 0acda05..bad0161 100644 --- a/u_common.go +++ b/u_common.go @@ -208,8 +208,6 @@ func (chs *ClientHelloSpec) ReadCompressionMethods(compressionMethods []byte) er // ReadTLSExtensions is a helper function to construct a list of TLS extensions from // a byte slice into []TLSExtension. -// -// If keepPSK is not set, the PSK extension will cause an error. func (chs *ClientHelloSpec) ReadTLSExtensions(b []byte, allowBluntMimicry bool, realPSK bool) error { extensions := cryptobyte.String(b) for !extensions.Empty() { @@ -233,12 +231,11 @@ func (chs *ClientHelloSpec) ReadTLSExtensions(b []byte, allowBluntMimicry bool, } else { extWriter = &FakePreSharedKeyExtension{} } - } - - if extension == extensionSupportedVersions { + case extensionSupportedVersions: chs.TLSVersMin = 0 chs.TLSVersMax = 0 } + if _, err := extWriter.Write(extData); err != nil { return err } diff --git a/u_fingerprinter.go b/u_fingerprinter.go index 7e9dddc..61afc73 100644 --- a/u_fingerprinter.go +++ b/u_fingerprinter.go @@ -8,7 +8,6 @@ package tls type Fingerprinter struct { // AllowBluntMimicry will ensure that unknown extensions are // passed along into the resulting ClientHelloSpec as-is - // It will not ensure that the PSK is passed along, if you require that, use KeepPSK // WARNING: there could be numerous subtle issues with ClientHelloSpecs // that are generated with this flag which could compromise security and/or mimicry AllowBluntMimicry bool