@@ -93,7 +93,6 @@ runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO ()
93runTLSSocket TLSSettings {..} set sock app = do
93runTLSSocket TLSSettings {..} set sock app = do
94 certs <- readCertificates certFile
94 certs <- readCertificates certFile
95 pk <- readPrivateKey keyFile
95 pk <- readPrivateKey keyFile
96− gen <- getSystemRandomGen
97 let params =
96 let params =
98 TLS.updateServerParams
97 TLS.updateServerParams
99 (\sp -> sp { TLS.serverWantClientCert = False }) $
98 (\sp -> sp { TLS.serverWantClientCert = False }) $
@@ -103,9 +102,9 @@ runTLSSocket TLSSettings {..} set sock app = do
103 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
102 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
104 , TLS.pLogging = tlsLogging
103 , TLS.pLogging = tlsLogging
106− runSettingsConnectionMaker set (getter gen params) app
105+ runSettingsConnectionMaker set (getter params) app
108− getter gen params = do
107+ getter params = do
109 (s, sa) <- acceptSafe sock
108 (s, sa) <- acceptSafe sock
110 let mkConn = do
109 let mkConn = do
111 (fromClient, firstBS) <- sourceSocket s C.$$+ CL.peek
110 (fromClient, firstBS) <- sourceSocket s C.$$+ CL.peek
@@ -118,6 +117,7 @@ runTLSSocket TLSSettings {..} set sock app = do
118 return bs
117 return bs
119 if maybe False ((== 0x16) . fst) (firstBS >>= B.uncons)
118 if maybe False ((== 0x16) . fst) (firstBS >>= B.uncons)
120+ gen <- getSystemRandomGen
121 ctx <- TLS.contextNew
121 ctx <- TLS.contextNew
122 TLS.Backend
122 TLS.Backend
123 { TLS.backendFlush = return ()
123 { TLS.backendFlush = return ()