 import Data.ByteString (ByteString)
 import Data.Word (Word8)
 import Foreign.C.String (CStringLen, CString)
-import Foreign.C.Types (CChar(..), CULong(..), CDouble(..))
+import Foreign.C.Types (CChar(..), CULong(..), CUInt(..), CDouble(..))
 import Foreign.ForeignPtr
 import Foreign.Marshal.Alloc (mallocBytes, free)
 import Foreign.Marshal.Utils (with, fromBool, toBool)

import qualified Data.ByteString.Unsafe as BSU

#include "shonky-crypt.h"

data ShonkyCryptKey = ShonkyCryptKey
    { sckKeyStart :: !Word8

    ^ { withTrickC2HS *`ShonkyCryptKey' }
    -> `ShonkyCryptContext' newShonkyCryptContextPointer * #}

withByteStringLen :: ByteString -> ((CString, CSizeT) -> IO a) -> IO a
withByteStringLen str f = BSU.unsafeUseAsCStringLen str (\(cstr, len) ->
    f (cstr, fromIntegral len))

