Skip to content

Commit

Permalink
fourmolu
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Dec 6, 2023
1 parent 90b59ed commit 50e0b4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions core/Network/TLS/Extra/Cipher.hs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ cipher_ECDHE_ECDSA_AES256CCM8_SHA256 =
, cipherKeyExchange = CipherKeyExchange_ECDHE_ECDSA
, cipherMinVer = Just TLS12 -- RFC 7251
}

----------------------------------------------------------------
-- RFC 7905

Expand Down
2 changes: 0 additions & 2 deletions core/test/Arbitrary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ arbitraryCredentialsOfEachType' :: Gen [(CertificateChain, PrivKey)]
arbitraryCredentialsOfEachType' = do
let (pubKey, privKey) = getGlobalRSAPair
curveName = defaultECCurve
-- (dsaPub, dsaPriv) <- arbitraryDSAPair
(ecdsaPub, ecdsaPriv) <- arbitraryECDSAPair curveName
(ed25519Pub, ed25519Priv) <- arbitraryEd25519Pair
(ed448Pub, ed448Priv) <- arbitraryEd448Pair
Expand All @@ -207,7 +206,6 @@ arbitraryCredentialsOfEachType' = do
return (CertificateChain [cert], priv)
)
[ (PubKeyRSA pubKey, PrivKeyRSA privKey)
-- , (PubKeyDSA dsaPub, PrivKeyDSA dsaPriv)
, (toPubKeyEC curveName ecdsaPub, toPrivKeyEC curveName ecdsaPriv)
, (PubKeyEd25519 ed25519Pub, PrivKeyEd25519 ed25519Priv)
, (PubKeyEd448 ed448Pub, PrivKeyEd448 ed448Priv)
Expand Down
13 changes: 8 additions & 5 deletions core/test/HandshakeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ spec = do
prop "can negotiate group" handshake_groups
prop "can negotiate elliptic curve" handshake_ec
prop "can fallback for certificate with cipher" handshake_cert_fallback_cipher
prop "can fallback for certificate with hash and signature" handshake_cert_fallback_hs
prop
"can fallback for certificate with hash and signature"
handshake_cert_fallback_hs
prop "can handle server key usage" handshake_server_key_usage
prop "can handle client key usage" handshake_client_key_usage
prop "can authenticate client" handshake_client_auth
Expand Down Expand Up @@ -291,7 +293,7 @@ instance Arbitrary OC where
]

handshake_cert_fallback_cipher :: OC -> IO ()
handshake_cert_fallback_cipher (OC clientCiphers serverCiphers)= do
handshake_cert_fallback_cipher (OC clientCiphers serverCiphers) = do
let clientVersions = [TLS12]
serverVersions = [TLS12]
commonCiphers = [cipher_ECDHE_RSA_AES128GCM_SHA256]
Expand Down Expand Up @@ -329,15 +331,16 @@ handshake_cert_fallback_cipher (OC clientCiphers serverCiphers)= do
-- the library, which is useful to test this scenario. SHA-1 could be replaced
-- by another algorithm.

data OHS = OHS [HashAndSignatureAlgorithm] [HashAndSignatureAlgorithm] deriving (Show)
data OHS = OHS [HashAndSignatureAlgorithm] [HashAndSignatureAlgorithm]
deriving (Show)

instance Arbitrary OHS where
arbitrary = OHS <$> sublistOf otherHS <*> sublistOf otherHS
where
otherHS = [(HashIntrinsic, SignatureEd25519)]

handshake_cert_fallback_hs :: OHS -> IO ()
handshake_cert_fallback_hs (OHS clientHS serverHS)= do
handshake_cert_fallback_hs (OHS clientHS serverHS) = do
tls13 <- generate arbitrary
let versions = if tls13 then [TLS13] else [TLS12]
ciphers =
Expand Down Expand Up @@ -477,7 +480,7 @@ handshake_ems (cems, sems) = do
then runTLSInitFailure params'
else runTLSPipePredicate params' (maybe False p)

newtype CompatEMS = CompatEMS (EMSMode,EMSMode) deriving (Show)
newtype CompatEMS = CompatEMS (EMSMode, EMSMode) deriving (Show)

instance Arbitrary CompatEMS where
arbitrary = CompatEMS <$> (arbitrary `suchThat` compatible)
Expand Down

0 comments on commit 50e0b4c

Please sign in to comment.