forked from haskell-tls/hs-tls
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,014 additions
and
992 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,69 @@ | ||
{-# LANGUAGE PatternSynonyms #-} | ||
|
||
-- | | ||
-- Module : Network.TLS.Crypto.Types | ||
-- License : BSD-style | ||
-- Maintainer : Kazu Yamamoto <[email protected]> | ||
-- Stability : experimental | ||
-- Portability : unknown | ||
module Network.TLS.Crypto.Types where | ||
|
||
data Group | ||
= P256 | ||
| P384 | ||
| P521 | ||
| X25519 | ||
| X448 | ||
| FFDHE2048 | ||
| FFDHE3072 | ||
| FFDHE4096 | ||
| FFDHE6144 | ||
| FFDHE8192 | ||
deriving (Eq, Show) | ||
module Network.TLS.Crypto.Types ( | ||
Group ( | ||
Group, | ||
P256, | ||
P384, | ||
P521, | ||
X25519, | ||
X448, | ||
FFDHE2048, | ||
FFDHE3072, | ||
FFDHE4096, | ||
FFDHE6144, | ||
FFDHE8192 | ||
), | ||
availableFFGroups, | ||
availableECGroups, | ||
KeyExchangeSignatureAlg (..), | ||
) where | ||
|
||
import Data.Word | ||
|
||
newtype Group = Group Word16 deriving (Eq) | ||
|
||
{- FOURMOLU_DISABLE -} | ||
pattern P256 :: Group | ||
pattern P256 = Group 23 | ||
pattern P384 :: Group | ||
pattern P384 = Group 24 | ||
pattern P521 :: Group | ||
pattern P521 = Group 25 | ||
pattern X25519 :: Group | ||
pattern X25519 = Group 29 | ||
pattern X448 :: Group | ||
pattern X448 = Group 30 | ||
pattern FFDHE2048 :: Group | ||
pattern FFDHE2048 = Group 256 | ||
pattern FFDHE3072 :: Group | ||
pattern FFDHE3072 = Group 257 | ||
pattern FFDHE4096 :: Group | ||
pattern FFDHE4096 = Group 258 | ||
pattern FFDHE6144 :: Group | ||
pattern FFDHE6144 = Group 259 | ||
pattern FFDHE8192 :: Group | ||
pattern FFDHE8192 = Group 260 | ||
|
||
instance Show Group where | ||
show P256 = "P256" | ||
show P384 = "P384" | ||
show P521 = "P521" | ||
show X25519 = "X25519" | ||
show X448 = "X448" | ||
show FFDHE2048 = "FFDHE2048" | ||
show FFDHE3072 = "FFDHE3072" | ||
show FFDHE4096 = "FFDHE4096" | ||
show FFDHE6144 = "FFDHE6144" | ||
show FFDHE8192 = "FFDHE8192" | ||
show (Group x) = "Group " ++ show x | ||
{- FOURMOLU_ENABLE -} | ||
|
||
availableFFGroups :: [Group] | ||
availableFFGroups = [FFDHE2048, FFDHE3072, FFDHE4096, FFDHE6144, FFDHE8192] | ||
|
Oops, something went wrong.