Эх сурвалжийг харах

Fix: generate a seed when RandomizedTLSProfileSeed is not set

Rod Hynes 7 жил өмнө
parent
commit
213437566b
1 өөрчлөгдсөн 10 нэмэгдсэн , 4 устгасан
  1. 10 4
      psiphon/tlsDialer.go

+ 10 - 4
psiphon/tlsDialer.go

@@ -345,9 +345,15 @@ func CustomTLSDial(
 		tlsRootCAs.AppendCertsFromPEM(certData)
 	}
 
+	randomizedTLSProfileSeed := config.RandomizedTLSProfileSeed
+
 	if protocol.TLSProfileIsRandomized(selectedTLSProfile) &&
-		config.RandomizedTLSProfileSeed == nil {
-		return nil, common.ContextError(errors.New("missing RandomizedTLSProfileSeed"))
+		randomizedTLSProfileSeed == nil {
+
+		randomizedTLSProfileSeed, err = prng.NewSeed()
+		if err != nil {
+			return nil, common.ContextError(err)
+		}
 	}
 
 	// Depending on the selected TLS profile, the TLS provider will be tris
@@ -373,7 +379,7 @@ func CustomTLSDial(
 			rawConn,
 			tlsConfig,
 			getUTLSClientHelloID(selectedTLSProfile),
-			config.RandomizedTLSProfileSeed)
+			randomizedTLSProfileSeed)
 
 		if config.ObfuscatedSessionTicketKey != "" {
 			sessionState, err := utls.NewObfuscatedClientSessionState(
@@ -407,7 +413,7 @@ func CustomTLSDial(
 			ServerName:              tlsConfigServerName,
 			ClientSessionCache:      clientSessionCache,
 			UseExtendedMasterSecret: true,
-			ClientHelloPRNGSeed:     config.RandomizedTLSProfileSeed,
+			ClientHelloPRNGSeed:     randomizedTLSProfileSeed,
 		}
 
 		conn = &trisConn{