File: Control.hs

package info (click to toggle)
haskell-tls 2.1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,056 kB
  • sloc: haskell: 15,695; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 1,552 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module Network.TLS.Handshake.Control (
    ClientState (..),
    ServerState (..),
    EarlySecretInfo (..),
    HandshakeSecretInfo (..),
    ApplicationSecretInfo (..),
    NegotiatedProtocol,
) where

import Network.TLS.Cipher
import Network.TLS.Imports
import Network.TLS.Struct
import Network.TLS.Types

----------------------------------------------------------------

-- | ID of the application-level protocol negotiated between client and server.
-- See values listed in the <https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids IANA registry>.
type NegotiatedProtocol = ByteString

-- | Handshake information generated for traffic at 0-RTT level.
data EarlySecretInfo = EarlySecretInfo Cipher (ClientTrafficSecret EarlySecret)
    deriving (Show)

-- | Handshake information generated for traffic at handshake level.
data HandshakeSecretInfo
    = HandshakeSecretInfo Cipher (TrafficSecrets HandshakeSecret)
    deriving (Show)

-- | Handshake information generated for traffic at application level.
newtype ApplicationSecretInfo = ApplicationSecretInfo (TrafficSecrets ApplicationSecret)
    deriving (Show)

----------------------------------------------------------------

data ClientState
    = SendClientHello (Maybe EarlySecretInfo)
    | RecvServerHello HandshakeSecretInfo
    | SendClientFinished [ExtensionRaw] ApplicationSecretInfo

data ServerState
    = SendServerHello [ExtensionRaw] (Maybe EarlySecretInfo) HandshakeSecretInfo
    | SendServerFinished ApplicationSecretInfo