Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-tls for openSUSE:Factory checked in at 2022-08-01 21:30:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-tls (Old) and /work/SRC/openSUSE:Factory/.ghc-tls.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-tls" Mon Aug 1 21:30:41 2022 rev:28 rq:987101 version:1.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-tls/ghc-tls.changes 2022-02-11 23:11:48.587362508 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-tls.new.1533/ghc-tls.changes 2022-08-01 21:31:10.409789791 +0200 @@ -1,0 +2,14 @@ +Mon Jun 6 02:45:15 UTC 2022 - Peter Simons <[email protected]> + +- Update tls to version 1.6.0. + ## Version 1.6.0 + + - Major version up because of disabling SSL3 + - Some fixes against tlsfuzzer + + ## Version 1.5.8 + + - Require mtl-2.2.1 or newer + [#448](https://github.com/haskell-tls/hs-tls/pull/448) + +------------------------------------------------------------------- Old: ---- tls-1.5.7.tar.gz New: ---- tls-1.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-tls.spec ++++++ --- /var/tmp/diff_new_pack.onjRwR/_old 2022-08-01 21:31:11.013791524 +0200 +++ /var/tmp/diff_new_pack.onjRwR/_new 2022-08-01 21:31:11.017791536 +0200 @@ -19,7 +19,7 @@ %global pkg_name tls %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.5.7 +Version: 1.6.0 Release: 0 Summary: TLS/SSL protocol native implementation (Server and Client) License: BSD-3-Clause @@ -56,8 +56,8 @@ eliminating a common set of security issues through the use of the advanced type system, high level constructions and common Haskell features. -Currently implement the SSL3.0, TLS1.0, TLS1.1, TLS1.2 and TLS 1.3 protocol, -and support RSA and Ephemeral (Elliptic curve and regular) Diffie Hellman key +Currently implement the TLS1.0, TLS1.1, TLS1.2 and TLS 1.3 protocol, and +support RSA and Ephemeral (Elliptic curve and regular) Diffie Hellman key exchanges, and many extensions. Some debug tools linked with tls, are available through the ++++++ tls-1.5.7.tar.gz -> tls-1.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/CHANGELOG.md new/tls-1.6.0/CHANGELOG.md --- old/tls-1.5.7/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,13 @@ +## Version 1.6.0 + +- Major version up because of disabling SSL3 +- Some fixes against tlsfuzzer + +## Version 1.5.8 + +- Require mtl-2.2.1 or newer + [#448](https://github.com/haskell-tls/hs-tls/pull/448) + ## Version 1.5.7 - New APIs: getFinished and getPeerFinished diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Core.hs new/tls-1.6.0/Network/TLS/Core.hs --- old/tls-1.5.7/Network/TLS/Core.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Core.hs 2001-09-09 03:46:40.000000000 +0200 @@ -56,6 +56,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as C8 import qualified Data.ByteString.Lazy as L +import Control.Monad (unless, when) import qualified Control.Exception as E import Control.Monad.State.Strict @@ -175,7 +176,13 @@ terminate (Error_Misc reason) AlertLevel_Fatal UnexpectedMessage reason Established -> return x NotEstablished -> throwCore $ Error_Protocol ("data at not-established", True, UnexpectedMessage) - process ChangeCipherSpec13 = recvData13 ctx + process ChangeCipherSpec13 = do + established <- ctxEstablished ctx + if established /= Established then + recvData13 ctx + else do + let reason = "CSS after Finished" + terminate (Error_Misc reason) AlertLevel_Fatal UnexpectedMessage reason process p = let reason = "unexpected message " ++ show p in terminate (Error_Misc reason) AlertLevel_Fatal UnexpectedMessage reason @@ -271,10 +278,8 @@ -> TLSError -> m B.ByteString onError _ Error_EOF = -- Not really an error. return B.empty -onError terminate err@(Error_Protocol (reason,fatal,desc)) = - terminate err (if fatal then AlertLevel_Fatal else AlertLevel_Warning) desc reason -onError terminate err = - terminate err AlertLevel_Fatal InternalError (show err) +onError terminate err = let (lvl,ad) = errorToAlert err + in terminate err lvl ad (errorToAlertMessage err) terminateWithWriteLock :: Context -> ([(AlertLevel, AlertDescription)] -> IO ()) -> TLSError -> AlertLevel -> AlertDescription -> String -> IO a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Credentials.hs new/tls-1.6.0/Network/TLS/Credentials.hs --- old/tls-1.5.7/Network/TLS/Credentials.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Credentials.hs 2001-09-09 03:46:40.000000000 +0200 @@ -32,7 +32,7 @@ type Credential = (CertificateChain, PrivKey) -newtype Credentials = Credentials [Credential] +newtype Credentials = Credentials [Credential] deriving (Show) instance Semigroup Credentials where Credentials l1 <> Credentials l2 = Credentials (l1 ++ l2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/ErrT.hs new/tls-1.6.0/Network/TLS/ErrT.hs --- old/tls-1.5.7/Network/TLS/ErrT.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/ErrT.hs 2001-09-09 03:46:40.000000000 +0200 @@ -10,20 +10,12 @@ module Network.TLS.ErrT ( runErrT , ErrT - , Error(..) , MonadError(..) ) where -#if MIN_VERSION_mtl(2,2,1) -import Control.Monad.Except -import Control.Monad.Error.Class (Error(..)) +import Control.Monad.Except (MonadError(..)) +import Control.Monad.Trans.Except (ExceptT, runExceptT) + runErrT :: ExceptT e m a -> m (Either e a) runErrT = runExceptT type ErrT = ExceptT -#else -import Control.Monad.Error -runErrT :: ErrorT e m a -> m (Either e a) -runErrT = runErrorT -type ErrT = ErrorT -#endif - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Extension.hs new/tls-1.6.0/Network/TLS/Extension.hs --- old/tls-1.5.7/Network/TLS/Extension.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Extension.hs 2001-09-09 03:46:40.000000000 +0200 @@ -483,7 +483,10 @@ decodeSignatureAlgorithms :: ByteString -> Maybe SignatureAlgorithms decodeSignatureAlgorithms = runGetMaybe $ do len <- getWord16 - SignatureAlgorithms <$> getList (fromIntegral len) (getSignatureHashAlgorithm >>= \sh -> return (2, sh)) + sas <- getList (fromIntegral len) (getSignatureHashAlgorithm >>= \sh -> return (2, sh)) + leftoverLen <- remaining + when (leftoverLen /= 0) $ fail "decodeSignatureAlgorithms: broken length" + return $ SignatureAlgorithms sas ------------------------------------------------------------ @@ -544,7 +547,7 @@ data KeyShareEntry = KeyShareEntry { keyShareEntryGroup :: Group - , keySHareEntryKeyExchange:: ByteString + , keyShareEntryKeyExchange :: ByteString } deriving (Show,Eq) getKeyShareEntry :: Get (Int, Maybe KeyShareEntry) @@ -584,6 +587,7 @@ Just ent -> return $ KeyShareServerHello ent extensionDecode MsgTClientHello = runGetMaybe $ do len <- fromIntegral <$> getWord16 +-- len == 0 allows for HRR grps <- getList len getKeyShareEntry return $ KeyShareClientHello $ catMaybes grps extensionDecode MsgTHelloRetryRequest = runGetMaybe $ do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Handshake/Certificate.hs new/tls-1.6.0/Network/TLS/Handshake/Certificate.hs --- old/tls-1.5.7/Network/TLS/Handshake/Certificate.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Handshake/Certificate.hs 2001-09-09 03:46:40.000000000 +0200 @@ -16,6 +16,7 @@ import Network.TLS.Context.Internal import Network.TLS.Struct import Network.TLS.X509 +import Control.Monad (unless) import Control.Monad.State.Strict import Control.Exception (SomeException) import Data.X509 (ExtKeyUsage(..), ExtKeyUsageFlag, extensionGet) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Handshake/Client.hs new/tls-1.6.0/Network/TLS/Handshake/Client.hs --- old/tls-1.5.7/Network/TLS/Handshake/Client.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Handshake/Client.hs 2001-09-09 03:46:40.000000000 +0200 @@ -648,7 +648,8 @@ -- onServerHello :: Context -> ClientParams -> Session -> [ExtensionID] -> Handshake -> IO (RecvState IO) onServerHello ctx cparams clientSession sentExts (ServerHello rver serverRan serverSession cipher compression exts) = do - when (rver == SSL2) $ throwCore $ Error_Protocol ("ssl2 is not supported", True, ProtocolVersion) + when (rver == SSL2) $ throwCore $ Error_Protocol ("SSL2 is not supported", True, ProtocolVersion) + when (rver == SSL3) $ throwCore $ Error_Protocol ("SSL3 is not supported", True, ProtocolVersion) -- find the compression and cipher methods that the server want to use. cipherAlg <- case find ((==) cipher . cipherID) (supportedCiphers $ ctxSupported ctx) of Nothing -> throwCore $ Error_Protocol ("server choose unknown cipher", True, IllegalParameter) @@ -913,9 +914,11 @@ mks <- usingState_ ctx getTLS13KeyShare case mks of Just (KeyShareServerHello ks) -> return ks - Just _ -> error "calcSharedKey: invalid KeyShare value" + Just _ -> throwCore $ Error_Protocol ("invalid key_share value", True, IllegalParameter) Nothing -> throwCore $ Error_Protocol ("key exchange not implemented, expected key_share extension", True, HandshakeFailure) let grp = keyShareEntryGroup serverKeyShare + unless (checkKeyShareKeyLength serverKeyShare) $ + throwCore $ Error_Protocol ("broken key_share", True, IllegalParameter) unless (groupSent == Just grp) $ throwCore $ Error_Protocol ("received incompatible group for (EC)DHE", True, IllegalParameter) usingHState ctx $ setNegotiatedGroup grp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Handshake/Common.hs new/tls-1.6.0/Network/TLS/Handshake/Common.hs --- old/tls-1.5.7/Network/TLS/Handshake/Common.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Handshake/Common.hs 2001-09-09 03:46:40.000000000 +0200 @@ -63,19 +63,23 @@ handle ignoreIOErr $ do tls13 <- tls13orLater ctx if tls13 then - sendPacket13 ctx $ Alert13 $ errorToAlert tlserror + sendPacket13 ctx $ Alert13 [errorToAlert tlserror] else - sendPacket ctx $ Alert $ errorToAlert tlserror + sendPacket ctx $ Alert [errorToAlert tlserror] handshakeFailed tlserror where ignoreIOErr :: IOException -> IO () ignoreIOErr _ = return () -errorToAlert :: TLSError -> [(AlertLevel, AlertDescription)] -errorToAlert (Error_Protocol (_, _, ad)) = [(AlertLevel_Fatal, ad)] -errorToAlert (Error_Packet_unexpected _ _) = [(AlertLevel_Fatal, UnexpectedMessage)] -errorToAlert (Error_Packet_Parsing _) = [(AlertLevel_Fatal, DecodeError)] -errorToAlert _ = [(AlertLevel_Fatal, InternalError)] +errorToAlert :: TLSError -> (AlertLevel, AlertDescription) +errorToAlert (Error_Protocol (_, b, ad)) = let lvl = if b then AlertLevel_Fatal else AlertLevel_Warning + in (lvl, ad) +errorToAlert (Error_Packet_unexpected _ _) = (AlertLevel_Fatal, UnexpectedMessage) +errorToAlert (Error_Packet_Parsing msg) + | "invalid version" `isInfixOf` msg = (AlertLevel_Fatal, ProtocolVersion) + | "request_update" `isInfixOf` msg = (AlertLevel_Fatal, IllegalParameter) + | otherwise = (AlertLevel_Fatal, DecodeError) +errorToAlert _ = (AlertLevel_Fatal, InternalError) -- | Return the message that a TLS endpoint can add to its local log for the -- specified library error. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Handshake/Common13.hs new/tls-1.6.0/Network/TLS/Handshake/Common13.hs --- old/tls-1.5.7/Network/TLS/Handshake/Common13.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Handshake/Common13.hs 2001-09-09 03:46:40.000000000 +0200 @@ -42,6 +42,7 @@ , calculateApplicationSecret , calculateResumptionSecret , derivePSK + , checkKeyShareKeyLength ) where import qualified Data.ByteArray as BA @@ -87,6 +88,7 @@ checkFinished :: MonadIO m => Context -> Hash -> ByteString -> ByteString -> ByteString -> m () checkFinished ctx usedHash baseKey hashValue verifyData = do let verifyData' = makeVerifyData usedHash baseKey hashValue + when (B.length verifyData /= B.length verifyData') $ throwCore $ Error_Protocol ("broken Finished", True, DecodeError) unless (verifyData' == verifyData) $ decryptError "cannot verify finished" liftIO $ writeIORef (ctxPeerFinished ctx) (Just verifyData) @@ -505,3 +507,23 @@ where usedHash = cHash choice hashSize = hashDigestSize usedHash + +---------------------------------------------------------------- + +checkKeyShareKeyLength :: KeyShareEntry -> Bool +checkKeyShareKeyLength ks = keyShareKeyLength grp == B.length key + where + grp = keyShareEntryGroup ks + key = keyShareEntryKeyExchange ks + +keyShareKeyLength :: Group -> Int +keyShareKeyLength P256 = 65 -- 32 * 2 + 1 +keyShareKeyLength P384 = 97 -- 48 * 2 + 1 +keyShareKeyLength P521 = 133 -- 66 * 2 + 1 +keyShareKeyLength X25519 = 32 +keyShareKeyLength X448 = 56 +keyShareKeyLength FFDHE2048 = 256 +keyShareKeyLength FFDHE3072 = 384 +keyShareKeyLength FFDHE4096 = 512 +keyShareKeyLength FFDHE6144 = 768 +keyShareKeyLength FFDHE8192 = 1024 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Handshake/Server.hs new/tls-1.6.0/Network/TLS/Handshake/Server.hs --- old/tls-1.5.7/Network/TLS/Handshake/Server.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Handshake/Server.hs 2001-09-09 03:46:40.000000000 +0200 @@ -107,7 +107,7 @@ -- rejecting SSL2. RFC 6176 when (legacyVersion == SSL2) $ throwCore $ Error_Protocol ("SSL 2.0 is not supported", True, ProtocolVersion) -- rejecting SSL3. RFC 7568 - -- when (legacyVersion == SSL3) $ throwCore $ Error_Protocol ("SSL 3.0 is not supported", True, ProtocolVersion) + when (legacyVersion == SSL3) $ throwCore $ Error_Protocol ("SSL 3.0 is not supported", True, ProtocolVersion) -- Fallback SCSV: RFC7507 -- TLS_FALLBACK_SCSV: {0x56, 0x00} @@ -117,7 +117,7 @@ throwCore $ Error_Protocol ("fallback is not allowed", True, InappropriateFallback) -- choosing TLS version let clientVersions = case extensionLookup extensionID_SupportedVersions exts >>= extensionDecode MsgTClientHello of - Just (SupportedVersionsClientHello vers) -> vers + Just (SupportedVersionsClientHello vers) -> vers -- fixme: vers == [] _ -> [] clientVersion = min TLS12 legacyVersion serverVersions @@ -686,21 +686,33 @@ -- status again if 0-RTT successful setEstablished ctx (EarlyDataNotAllowed 3) -- hardcoding -- Deciding key exchange from key shares - keyShares <- case extensionLookup extensionID_KeyShare exts >>= extensionDecode MsgTClientHello of - Just (KeyShareClientHello kses) -> return kses - Just _ -> error "handshakeServerWithTLS13: invalid KeyShare value" - _ -> throwCore $ Error_Protocol ("key exchange not implemented, expected key_share extension", True, HandshakeFailure) - case findKeyShare keyShares serverGroups of + keyShares <- case extensionLookup extensionID_KeyShare exts of + Nothing -> throwCore $ Error_Protocol ("key exchange not implemented, expected key_share extension", True, MissingExtension) + Just kss -> case extensionDecode MsgTClientHello kss of + Just (KeyShareClientHello kses) -> return kses + Just _ -> error "handshakeServerWithTLS13: invalid KeyShare value" + _ -> throwCore $ Error_Protocol ("broken key_share", True, DecodeError) + mshare <- findKeyShare keyShares serverGroups + case mshare of Nothing -> helloRetryRequest sparams ctx chosenVersion usedCipher exts serverGroups clientSession Just keyShare -> doHandshake13 sparams ctx chosenVersion usedCipher exts usedHash keyShare clientSession rtt0 where ciphersFilteredVersion = filter ((`elem` clientCiphers) . cipherID) serverCiphers serverCiphers = filter (cipherAllowedForVersion chosenVersion) (supportedCiphers $ serverSupported sparams) serverGroups = supportedGroups (ctxSupported ctx) - findKeyShare _ [] = Nothing - findKeyShare ks (g:gs) = case find (\ent -> keyShareEntryGroup ent == g) ks of - Just k -> Just k - Nothing -> findKeyShare ks gs + +findKeyShare :: [KeyShareEntry] -> [Group] -> IO (Maybe KeyShareEntry) +findKeyShare ks ggs = go ggs + where + go [] = return Nothing + go (g:gs) = case filter (grpEq g) ks of + [] -> go gs + [k] -> do + unless (checkKeyShareKeyLength k) $ + throwCore $ Error_Protocol ("broken key_share", True, IllegalParameter) + return $ Just k + _ -> throwCore $ Error_Protocol ("duplicated key_share", True, IllegalParameter) + grpEq g ent = g == keyShareEntryGroup ent doHandshake13 :: ServerParams -> Context -> Version -> Cipher -> [ExtensionRaw] @@ -876,9 +888,11 @@ return [ExtensionRaw extensionID_PreSharedKey selectedIdentity] decideCredentialInfo allCreds = do - cHashSigs <- case extensionLookup extensionID_SignatureAlgorithms exts >>= extensionDecode MsgTClientHello of + cHashSigs <- case extensionLookup extensionID_SignatureAlgorithms exts of Nothing -> throwCore $ Error_Protocol ("no signature_algorithms extension", True, MissingExtension) - Just (SignatureAlgorithms sas) -> return sas + Just sa -> case extensionDecode MsgTClientHello sa of + Nothing -> throwCore $ Error_Protocol ("broken signature_algorithms extension", True, DecodeError) + Just (SignatureAlgorithms sas) -> return sas -- When deciding signature algorithm and certificate, we try to keep -- certificates supported by the client, but fallback to all credentials -- if this produces no suitable result (see RFC 5246 section 7.4.2 and @@ -1070,7 +1084,7 @@ v:_ -> Just v where svs = sortOn Down serverVersions - cvs = sortOn Down clientVersions + cvs = sortOn Down $ filter (> SSL3) clientVersions applicationProtocol :: Context -> [ExtensionRaw] -> ServerParams -> IO [ExtensionRaw] applicationProtocol ctx exts sparams = do @@ -1095,7 +1109,7 @@ where loop [] = Nothing loop (hs:hss) = case credentialsFindForSigning13' hs creds of - Nothing -> credentialsFindForSigning13 hss creds + Nothing -> loop hss Just cred -> Just (cred, hs) -- See credentialsFindForSigning. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Handshake/State.hs new/tls-1.6.0/Network/TLS/Handshake/State.hs --- old/tls-1.5.7/Network/TLS/Handshake/State.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Handshake/State.hs 2001-09-09 03:46:40.000000000 +0200 @@ -2,7 +2,6 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE CPP #-} -- | -- Module : Network.TLS.Handshake.State -- License : BSD-style @@ -190,9 +189,7 @@ instance MonadState HandshakeState HandshakeM where put x = HandshakeM (put x) get = HandshakeM get -#if MIN_VERSION_mtl(2,1,0) state f = HandshakeM (state f) -#endif -- create a new empty handshake state newEmptyHandshake :: Version -> ClientRandom -> HandshakeState diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Packet.hs new/tls-1.6.0/Network/TLS/Packet.hs --- old/tls-1.5.7/Network/TLS/Packet.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Packet.hs 2001-09-09 03:46:40.000000000 +0200 @@ -229,7 +229,10 @@ r <- remaining exts <- if hasHelloExtensions ver && r > 0 then fromIntegral <$> getWord16 >>= getExtensions - else return [] + else do + rest <- remaining + _ <- getBytes rest + return [] return $ ClientHello ver random session ciphers compressions exts Nothing decodeServerHello :: Get Handshake diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/QUIC.hs new/tls-1.6.0/Network/TLS/QUIC.hs --- old/tls-1.5.7/Network/TLS/QUIC.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/QUIC.hs 2001-09-09 03:46:40.000000000 +0200 @@ -237,7 +237,7 @@ -- | Return the alert that a TLS endpoint would send to the peer for the -- specified library error. errorToAlertDescription :: TLSError -> AlertDescription -errorToAlertDescription = snd . head . errorToAlert +errorToAlertDescription = snd . errorToAlert -- | Encode an alert to the assigned value. fromAlertDescription :: AlertDescription -> Word8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Record/Disengage.hs new/tls-1.6.0/Network/TLS/Record/Disengage.hs --- old/tls-1.5.7/Network/TLS/Record/Disengage.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Record/Disengage.hs 2001-09-09 03:46:40.000000000 +0200 @@ -57,13 +57,15 @@ decryptData mver record e st where noDecryption = onRecordFragment record $ fragmentUncipher return - decryptData13 mver e st - | ct == ProtocolType_AppData = do - inner <- decryptData mver record e st - case unInnerPlaintext inner of - Left message -> throwError $ Error_Protocol (message, True, UnexpectedMessage) - Right (ct', d) -> return $ Record ct' ver (fragmentCompressed d) - | otherwise = noDecryption + decryptData13 mver e st = case ct of + ProtocolType_AppData -> do + inner <- decryptData mver record e st + case unInnerPlaintext inner of + Left message -> throwError $ Error_Protocol (message, True, UnexpectedMessage) + Right (ct', d) -> return $ Record ct' ver (fragmentCompressed d) + ProtocolType_ChangeCipherSpec -> noDecryption + ProtocolType_Alert -> noDecryption + _ -> throwError $ Error_Protocol ("illegal plain text", True, UnexpectedMessage) unInnerPlaintext :: ByteString -> Either String (ProtocolType, ByteString) unInnerPlaintext inner = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Record/State.hs new/tls-1.6.0/Network/TLS/Record/State.hs --- old/tls-1.5.7/Network/TLS/Record/State.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Record/State.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,4 @@ {-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE CPP #-} -- | -- Module : Network.TLS.Record.State -- License : BSD-style @@ -112,9 +111,7 @@ instance MonadState RecordState RecordM where put x = RecordM $ \_ _ -> Right ((), x) get = RecordM $ \_ st -> Right (st, st) -#if MIN_VERSION_mtl(2,1,0) state f = RecordM $ \_ st -> Right (f st) -#endif instance MonadError TLSError RecordM where throwError e = RecordM $ \_ _ -> Left e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/State.hs new/tls-1.6.0/Network/TLS/State.hs --- old/tls-1.5.7/Network/TLS/State.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/State.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -108,9 +107,7 @@ instance MonadState TLSState TLSSt where put x = TLSSt (lift $ put x) get = TLSSt (lift get) -#if MIN_VERSION_mtl(2,1,0) state f = TLSSt (lift $ state f) -#endif runTLSState :: TLSSt a -> TLSState -> (Either TLSError a, TLSState) runTLSState f st = runState (runErrT (runTLSSt f)) st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Network/TLS/Struct.hs new/tls-1.6.0/Network/TLS/Struct.hs --- old/tls-1.5.7/Network/TLS/Struct.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Network/TLS/Struct.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,7 +9,6 @@ -- -- the Struct module contains all definitions and values of the TLS protocol -- -{-# LANGUAGE CPP #-} module Network.TLS.Struct ( Version(..) , ConnectionEnd(..) @@ -67,10 +66,6 @@ import Network.TLS.Crypto import Network.TLS.Util.Serialization import Network.TLS.Imports -#if MIN_VERSION_mtl(2,2,1) -#else -import Control.Monad.Error -#endif data ConnectionEnd = ConnectionServer | ConnectionClient data CipherType = CipherStream | CipherBlock | CipherAEAD @@ -173,13 +168,6 @@ | Error_Packet_Parsing String deriving (Eq, Show, Typeable) -#if MIN_VERSION_mtl(2,2,1) -#else -instance Error TLSError where - noMsg = Error_Misc "" - strMsg = Error_Misc -#endif - instance Exception TLSError -- | TLS Exceptions related to bad user usage or diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/Tests/Connection.hs new/tls-1.6.0/Tests/Connection.hs --- old/tls-1.5.7/Tests/Connection.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/Tests/Connection.hs 2001-09-09 03:46:40.000000000 +0200 @@ -67,7 +67,7 @@ arbitraryCiphers = listOf1 $ elements knownCiphers knownVersions :: [Version] -knownVersions = [TLS13,TLS12,TLS11,TLS10,SSL3] +knownVersions = [TLS13,TLS12,TLS11,TLS10] arbitraryVersions :: Gen [Version] arbitraryVersions = sublistOf knownVersions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tls-1.5.7/tls.cabal new/tls-1.6.0/tls.cabal --- old/tls-1.5.7/tls.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/tls-1.6.0/tls.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ Name: tls -Version: 1.5.7 +Version: 1.6.0 Description: Native Haskell TLS and SSL protocol implementation for server and client. . @@ -7,7 +7,7 @@ eliminating a common set of security issues through the use of the advanced type system, high level constructions and common Haskell features. . - Currently implement the SSL3.0, TLS1.0, TLS1.1, TLS1.2 and TLS 1.3 protocol, + Currently implement the TLS1.0, TLS1.1, TLS1.2 and TLS 1.3 protocol, and support RSA and Ephemeral (Elliptic curve and regular) Diffie Hellman key exchanges, and many extensions. . @@ -42,7 +42,7 @@ Library Default-Language: Haskell2010 Build-Depends: base >= 4.9 && < 5 - , mtl >= 2 + , mtl >= 2.2.1 , transformers , cereal >= 0.5.3 , bytestring
