From cd42b2765baa5168bb9b9cbc633ffd08e482aa54 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Sun, 3 May 2015 14:51:13 +0100 Subject: [PATCH] [HMAC] use SecureBytes instead of ByteString for between context --- Crypto/MAC/HMAC.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Crypto/MAC/HMAC.hs b/Crypto/MAC/HMAC.hs index 3abbf4b..17b72a0 100644 --- a/Crypto/MAC/HMAC.hs +++ b/Crypto/MAC/HMAC.hs @@ -21,11 +21,10 @@ module Crypto.MAC.HMAC , finalize ) where -import Data.ByteString (ByteString) import Crypto.Hash hiding (Context) import qualified Crypto.Hash as Hash (Context) import Crypto.Hash.IO -import Crypto.Internal.ByteArray (SecureBytes, Bytes, ByteArray, ByteArrayAccess) +import Crypto.Internal.ByteArray (SecureBytes, ByteArray, ByteArrayAccess) import qualified Crypto.Internal.ByteArray as B import Crypto.Internal.Bytes import Crypto.Internal.Compat @@ -83,8 +82,8 @@ initialize secret = unsafeDoIO (doHashAlg undefined) (inner, outer) <- withKey $ \keyPtr -> (,) <$> B.alloc blockSize (\p -> bufXorWith p 0x36 keyPtr blockSize) <*> B.alloc blockSize (\p -> bufXorWith p 0x5c keyPtr blockSize) - return $ Context (hashUpdates initCtx [outer :: ByteString]) - (hashUpdates initCtx [inner :: ByteString]) + return $ Context (hashUpdates initCtx [outer :: SecureBytes]) + (hashUpdates initCtx [inner :: SecureBytes]) where blockSize = hashBlockSize alg digestSize = hashDigestSize alg