diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2023-08-09 22:48:11 +0200 | 
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-08-27 12:01:16 +0200 | 
| commit | 740c55ac1989ba5093af9350a63820a818ff0202 (patch) | |
| tree | 26d6257b4871059858bcb421fdd5be5718603428 /src/Network | |
| parent | ee1dce0d8d3a2f08dac579a0453b69a37110d2ae (diff) | |
Switch to ChaCha20-Poly1305 AEAD scheme
Diffstat (limited to 'src/Network')
| -rw-r--r-- | src/Network/Protocol.hs | 4 | 
1 files changed, 2 insertions, 2 deletions
| 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 |