From 9d0cf74713b97c2e2a66092b4e3202431b3a8868 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Wed, 8 Apr 2015 20:42:43 +0100 Subject: [PATCH] remove Byteable and unnecessary SecureMem --- Crypto/Cipher/Types/Base.hs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Crypto/Cipher/Types/Base.hs b/Crypto/Cipher/Types/Base.hs index d35fb06..7b2a63d 100644 --- a/Crypto/Cipher/Types/Base.hs +++ b/Crypto/Cipher/Types/Base.hs @@ -8,6 +8,7 @@ -- symmetric cipher basic types -- {-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Crypto.Cipher.Types.Base ( KeySizeSpecifier(..) , Cipher(..) @@ -16,8 +17,6 @@ module Crypto.Cipher.Types.Base , DataUnitOffset ) where -import Data.Byteable -import Data.SecureMem import Data.Word import Data.ByteString (ByteString) @@ -35,13 +34,11 @@ data KeySizeSpecifier = type DataUnitOffset = Word32 -- | Authentification Tag for AE cipher mode -newtype AuthTag = AuthTag ByteString - deriving (Show) +newtype AuthTag = AuthTag { unAuthTag :: ByteString } + deriving (Show, ByteArrayAccess) instance Eq AuthTag where - (AuthTag a) == (AuthTag b) = constEqBytes a b -instance Byteable AuthTag where - toBytes (AuthTag bs) = bs + (AuthTag a) == (AuthTag b) = byteArrayConstEq a b -- | AEAD Mode data AEADMode =