peyotls 0.1.6.4 → 0.1.6.5
raw patch · 2 files changed
+17/−9 lines, 2 files
Files
- peyotls.cabal +2/−2
- src/Network/PeyoTLS/Run/Handle.hs +15/−7
peyotls.cabal view
@@ -2,7 +2,7 @@ cabal-version: >= 1.8 name: peyotls-version: 0.1.6.4+version: 0.1.6.5 stability: Experimental author: Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer: Yoshikuni Jujo <PAF01143@nifty.ne.jp>@@ -281,7 +281,7 @@ source-repository this type: git location: git://github.com/YoshikuniJujo/peyotls.git- tag: peyotls-0.1.6.4+ tag: peyotls-0.1.6.5 library hs-source-dirs: src
src/Network/PeyoTLS/Run/Handle.hs view
@@ -154,14 +154,9 @@ then snd `liftM` getCont h else M.setRBuf (pid h) (M.CTNull, BS.empty) >> return bp -adPut, adPut_ :: (HandleLike h, CPRG g) =>+adPut :: (HandleLike h, CPRG g) => HandleBase h g -> BS.ByteString -> M.TlsM h g ()-adPut_ = flip tWrite M.CTAppData-adPut h = mapM_ (adPut_ h) . divide (2 ^ (13 :: Int))--divide :: Int -> BS.ByteString -> [BS.ByteString]-divide _ "" = []-divide n s = BS.take n s : divide n (BS.drop n s)+adPut = flip tWrite M.CTAppData adDebug :: HandleLike h => HandleBase h g -> DebugLevel h -> BS.ByteString -> M.TlsM h g ()@@ -214,9 +209,22 @@ wFlush :: (HandleLike h, CPRG g) => HandleBase h g -> M.TlsM h g () wFlush h = M.getWBuf (pid h) >>= \(bct, bp) -> do M.setWBuf (pid h) (M.CTNull, "")+ unless (bct == M.CTNull)+ . mapM_ (encryptPut h bct) $ divide (2 ^ (14 :: Int)) bp+ {- unless (bct == M.CTNull) $ M.encrypt (pid h) bct bp >>= \e -> M.tPut (handle h) $ BS.concat [B.encode bct, vrsn, B.addLen (undefined :: Word16) e]+ -}++encryptPut :: (HandleLike h, CPRG g) =>+ HandleBase h g -> M.ContType -> BS.ByteString -> M.TlsM h g ()+encryptPut h bct bp = M.encrypt (pid h) bct bp >>= \e -> M.tPut (handle h) $+ BS.concat [B.encode bct, vrsn, B.addLen (undefined :: Word16) e]++divide :: Int -> BS.ByteString -> [BS.ByteString]+divide _ "" = []+divide n s = BS.take n s : divide n (BS.drop n s) getCipherSuite :: HandleLike h => HandleBase h g -> M.TlsM h g M.CipherSuite getCipherSuite = M.getCipherSuite . pid