Skip to content

Commit

Permalink
client checks if the group of PSK is contained in Supported_Groups
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Apr 21, 2024
1 parent 4f5723c commit b553c73
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tls/Network/TLS/Handshake/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ handshakeClientWith _ _ _ =
-- client part of handshake. send a bunch of handshake of client
-- values intertwined with response from the server.
handshakeClient :: ClientParams -> Context -> IO ()
handshakeClient cparams ctx = handshake cparams ctx groups Nothing
handshakeClient cparams ctx = do
groups <- case clientWantSessionResume cparams of
Nothing -> return groupsSupported
Just (_, sdata) -> case sessionGroup sdata of
Nothing -> return [] -- TLS 1.2 or earlier
Just grp
| grp `elem` groupsSupported -> return $ grp : filter (/= grp) groupsSupported
| otherwise -> throwCore $ Error_Misc "groupsSupported is incorrect"
handshake cparams ctx groups Nothing
where
groupsSupported = supportedGroups (ctxSupported ctx)
groups = case clientWantSessionResume cparams of
Nothing -> groupsSupported
Just (_, sdata) -> case sessionGroup sdata of
Nothing -> [] -- TLS 1.2 or earlier
Just grp -> grp : filter (/= grp) groupsSupported

-- https://tools.ietf.org/html/rfc8446#section-4.1.2 says:
-- "The client will also send a
Expand Down

0 comments on commit b553c73

Please sign in to comment.