From 740c55ac1989ba5093af9350a63820a818ff0202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 9 Aug 2023 22:48:11 +0200 Subject: Switch to ChaCha20-Poly1305 AEAD scheme --- src/Network/Protocol.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Network/Protocol.hs') diff --git a/src/Network/Protocol.hs b/src/Network/Protocol.hs index 554d93c..054c0fb 100644 --- a/src/Network/Protocol.hs +++ b/src/Network/Protocol.hs @@ -223,7 +223,7 @@ processIncomming gs@GlobalState {..} = do Just (b, enc) | b .&. 0xE0 == 0x80 -> do ch <- maybe (throwError "unexpected encrypted packet") return mbch - dec <- channelDecrypt ch enc + (dec, _) <- channelDecrypt ch enc case B.uncons dec of Just (0x00, content) -> do @@ -297,7 +297,7 @@ processOutgoing gs@GlobalState {..} = do mbs <- case mbch of Just ch -> do runExceptT (channelEncrypt ch $ BL.toStrict $ 0x00 `BL.cons` plain) >>= \case - Right ctext -> return $ Just $ 0x80 `B.cons` ctext + Right (ctext, _) -> return $ Just $ 0x80 `B.cons` ctext Left err -> do atomically $ gLog $ "Failed to encrypt data: " ++ err return Nothing Nothing | secure -> return Nothing -- cgit v1.2.3