aboutsummaryrefslogtreecommitdiff
path: root/src/Codec/Crypto/HKDF.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Codec/Crypto/HKDF.hs')
-rw-r--r--src/Codec/Crypto/HKDF.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Codec/Crypto/HKDF.hs b/src/Codec/Crypto/HKDF.hs
index 8c1db0a..4547a52 100644
--- a/src/Codec/Crypto/HKDF.hs
+++ b/src/Codec/Crypto/HKDF.hs
@@ -19,13 +19,12 @@ module Codec.Crypto.HKDF
import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Unsafe as ByteString
-import Foreign (Ptr, Storable(peek), alloca, allocaArray)
-import Foreign.C.Types
+import Foreign (Storable(peek), alloca, allocaArray)
import Foreign.Marshal.Unsafe (unsafeLocalState)
-import Unsafe.Coerce (unsafeCoerce)
import BTLS.BoringSSL.Digest (evpMaxMDSize)
import BTLS.BoringSSL.HKDF
+import BTLS.Cast (asCUCharBuf)
import BTLS.Types
(AssociatedData(AssociatedData), Salt(Salt), SecretKey(SecretKey), noSalt)
import Data.Digest.Internal (Algorithm(Algorithm))
@@ -63,6 +62,3 @@ expand (Algorithm md) (AssociatedData info) outLen (SecretKey secret) =
(asCUCharBuf pSecret) (fromIntegral secretLen)
(asCUCharBuf pInfo) (fromIntegral infoLen)
SecretKey <$> ByteString.packCStringLen (pOutKey, outLen)
-
-asCUCharBuf :: Ptr CChar -> Ptr CUChar
-asCUCharBuf = unsafeCoerce