From a73c1b91718f3b2bd4fd59022d992da7ff621b8e Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Sat, 9 Apr 2016 10:31:13 +0100 Subject: [PATCH] [CMAC] drop the accessor in favor of just using the ByteArrayAccess constraint --- Crypto/MAC/CMAC.hs | 8 ++++---- tests/KAT_CMAC.hs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Crypto/MAC/CMAC.hs b/Crypto/MAC/CMAC.hs index 86bf464..010153b 100644 --- a/Crypto/MAC/CMAC.hs +++ b/Crypto/MAC/CMAC.hs @@ -12,7 +12,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Crypto.MAC.CMAC ( cmac - , CMAC(..) + , CMAC , subKeys ) where @@ -24,9 +24,9 @@ import Crypto.Cipher.Types import Crypto.Internal.ByteArray (ByteArrayAccess, ByteArray, Bytes) import qualified Crypto.Internal.ByteArray as B - -newtype CMAC a = CMAC { cmacGetBytes :: Bytes } - deriving ByteArrayAccess +-- | Authentication code +newtype CMAC a = CMAC Bytes + deriving (ByteArrayAccess) instance Eq (CMAC a) where CMAC b1 == CMAC b2 = B.constEq b1 b2 diff --git a/tests/KAT_CMAC.hs b/tests/KAT_CMAC.hs index 5f2addd..da5b7cd 100644 --- a/tests/KAT_CMAC.hs +++ b/tests/KAT_CMAC.hs @@ -61,7 +61,7 @@ msg0 :: ByteString msg0 = BS.empty bsCMAC :: BlockCipher k => k -> ByteString -> ByteString -bsCMAC k = B.convert . CMAC.cmacGetBytes . CMAC.cmac k +bsCMAC k = B.convert . CMAC.cmac k gAES128 :: TestTree gAES128 =