Permalink
Browse files

Placate LLVM in GHC 7.3.x HEAD: give memcpy the right type. Courtesy …

…of David Terei.
  • Loading branch information...
1 parent fd3cbb8 commit 811c74e131ca5ace81a05483c22a2d08f4bef71b @peteg peteg committed with depressed-pho Sep 16, 2011
Showing with 6 additions and 6 deletions.
  1. +4 −4 OpenSSL/BN.hsc
  2. +2 −2 OpenSSL/Cipher.hsc
View
@@ -147,10 +147,10 @@ newBN i = do
-- to
foreign import ccall unsafe "memcpy"
- _copy_in :: ByteArray## -> Ptr () -> CSize -> IO ()
+ _copy_in :: ByteArray## -> Ptr () -> CSize -> IO (Ptr ())
foreign import ccall unsafe "memcpy"
- _copy_out :: Ptr () -> ByteArray## -> CSize -> IO ()
+ _copy_out :: Ptr () -> ByteArray## -> CSize -> IO (Ptr ())
-- These are taken from Data.Binary's disabled fast Integer support
data ByteArray = BA !ByteArray##
@@ -183,7 +183,7 @@ bnToInteger bn = do
(MBA arr) <- newByteArray (nlimbsi *## limbsize)
(BA ba) <- freezeByteArray arr
limbs <- (#peek BIGNUM, d) (unwrapBN bn)
- _copy_in ba limbs $ fromIntegral $ nlimbs * (#size unsigned long)
+ _ <- _copy_in ba limbs $ fromIntegral $ nlimbs * (#size unsigned long)
negative <- (#peek BIGNUM, neg) (unwrapBN bn) :: IO CInt
if negative == 0
then return $ J## nlimbsi ba
@@ -228,7 +228,7 @@ integerToBN v@(J## nlimbs_ bytearray)
limbs <- mallocBytes ((#size unsigned long) * nlimbs)
(#poke BIGNUM, d) bnptr limbs
(#poke BIGNUM, flags) bnptr (1 :: CInt)
- _copy_out limbs bytearray (fromIntegral $ (#size unsigned long) * nlimbs)
+ _ <- _copy_out limbs bytearray (fromIntegral $ (#size unsigned long) * nlimbs)
(#poke BIGNUM, top) bnptr ((fromIntegral nlimbs) :: CInt)
(#poke BIGNUM, dmax) bnptr ((fromIntegral nlimbs) :: CInt)
(#poke BIGNUM, neg) bnptr (0 :: CInt)
View
@@ -43,7 +43,7 @@ data AESCtx = AESCtx
Mode
foreign import ccall unsafe "memcpy"
- _memcpy :: Ptr CUChar -> Ptr CChar -> CSize -> IO ()
+ _memcpy :: Ptr CUChar -> Ptr CChar -> CSize -> IO (Ptr ())
foreign import ccall unsafe "memset"
_memset :: Ptr CUChar -> CChar -> CSize -> IO ()
@@ -83,7 +83,7 @@ newAESCtx mode key iv = do
withForeignPtr ecounter (\ecptr -> _memset ecptr 0 16)
withForeignPtr ivbytes $ \ivPtr ->
BS.useAsCStringLen iv $ \(ptr, _) ->
- do _memcpy ivPtr ptr 16
+ do _ <- _memcpy ivPtr ptr 16
return $ AESCtx ctx ivbytes ecounter nref mode
-- | Encrypt some number of blocks using CBC. This is an IO function because

0 comments on commit 811c74e

Please sign in to comment.