aboutsummaryrefslogtreecommitdiff
path: root/tests/Codec
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2018-09-04 18:29:34 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2018-09-04 18:29:34 -0400
commit2e7bd84469eba730f24dd3e448cca22f5aed16f4 (patch)
treeb6478cf101c30d956912545eaea411100dccc0f6 /tests/Codec
parent4e377babaa6203c445607c4bb1cbfd42bd9c6c06 (diff)
Enable error checking for HKDF computations
Diffstat (limited to 'tests/Codec')
-rw-r--r--tests/Codec/Crypto/HKDFTests.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/Codec/Crypto/HKDFTests.hs b/tests/Codec/Crypto/HKDFTests.hs
index 44a41cd..d4cfe30 100644
--- a/tests/Codec/Crypto/HKDFTests.hs
+++ b/tests/Codec/Crypto/HKDFTests.hs
@@ -21,8 +21,9 @@ import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Base16 as ByteString.Base16
import qualified Data.ByteString.Char8 as ByteString.Char8
import Test.Tasty (TestTree, testGroup)
-import Test.Tasty.HUnit ((@?=), testCase)
+import Test.Tasty.HUnit (testCase)
+import BTLS.Assertions (isRightAndHolds)
import Codec.Crypto.HKDF (AssociatedData(AssociatedData), Salt(Salt), SecretKey(SecretKey), noSalt)
import qualified Codec.Crypto.HKDF as HKDF
import Data.Digest (sha1, sha256)
@@ -91,10 +92,11 @@ testRFC5869 = testGroup "RFC 5869 examples"
]
where
t name hash ikm salt info len prk okm =
- testGroup name [ testCase "hkdf" $ HKDF.hkdf hash salt info len ikm @?= okm
- , testCase "extract" $ HKDF.extract hash salt ikm @?= prk
- , testCase "expand" $ HKDF.expand hash info len prk @?= okm
- ]
+ testGroup name
+ [ testCase "hkdf" $ HKDF.hkdf hash salt info len ikm `isRightAndHolds` okm
+ , testCase "extract" $ HKDF.extract hash salt ikm `isRightAndHolds` prk
+ , testCase "expand" $ HKDF.expand hash info len prk `isRightAndHolds` okm
+ ]
hex :: ByteString -> ByteString
hex s =