diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-08-19  Vladimir Shabanov  <dev@vshabanov.com>
+
+	* HsOpenSSL.cabal (Version): Bump version to 0.11.7.8
+
+	* Fix up incompatible pointer issues (#94)
+	by Eric Mertens @glguy
+
 2024-06-11  Vladimir Shabanov  <dev@vshabanov.com>
 
 	* HsOpenSSL.cabal (Version): Bump version to 0.11.7.7
diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal
--- a/HsOpenSSL.cabal
+++ b/HsOpenSSL.cabal
@@ -10,7 +10,7 @@
     systems and stable. You may also be interested in the @tls@ package,
     <http://hackage.haskell.org/package/tls>, which is a pure Haskell
     implementation of SSL.
-Version:       0.11.7.7
+Version:       0.11.7.8
 License:       PublicDomain
 License-File:  COPYING
 Author:        Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen
diff --git a/OpenSSL/BIO.hs b/OpenSSL/BIO.hs
--- a/OpenSSL/BIO.hs
+++ b/OpenSSL/BIO.hs
@@ -411,10 +411,10 @@
 
 {- mem ---------------------------------------------------------------------- -}
 
-foreign import capi unsafe "openssl/bio.h BIO_s_mem"
+foreign import ccall unsafe "openssl/bio.h BIO_s_mem"
         s_mem :: IO (Ptr BIO_METHOD)
 
-foreign import capi unsafe "openssl/bio.h BIO_new_mem_buf"
+foreign import ccall unsafe "openssl/bio.h BIO_new_mem_buf"
         _new_mem_buf :: Ptr CChar -> CInt -> IO (Ptr BIO_)
 
 
@@ -466,7 +466,7 @@
 
 {- null --------------------------------------------------------------------- -}
 
-foreign import capi unsafe "openssl/bio.h BIO_s_null"
+foreign import ccall unsafe "openssl/bio.h BIO_s_null"
         s_null :: IO (Ptr BIO_METHOD)
 
 -- |@'newNullBIO'@ creates a null BIO sink\/source. Data written to
diff --git a/OpenSSL/BN.hsc b/OpenSSL/BN.hsc
--- a/OpenSSL/BN.hsc
+++ b/OpenSSL/BN.hsc
@@ -244,10 +244,10 @@
 withBN dec m = bracket (integerToBN dec) (_free . unwrapBN) m
 
 foreign import capi unsafe "openssl/bn.h BN_bn2mpi"
-        _bn2mpi :: Ptr BIGNUM -> Ptr CChar -> IO CInt
+        _bn2mpi :: Ptr BIGNUM -> Ptr CUChar -> IO CInt
 
 foreign import capi unsafe "openssl/bn.h BN_mpi2bn"
-        _mpi2bn :: Ptr CChar -> CInt -> Ptr BIGNUM -> IO (Ptr BIGNUM)
+        _mpi2bn :: Ptr CUChar -> CInt -> Ptr BIGNUM -> IO (Ptr BIGNUM)
 
 -- |This is an alias to 'bnToInteger'.
 peekBN :: BigNum -> IO Integer
@@ -265,13 +265,13 @@
   bytes <- _bn2mpi (unwrapBN bn) nullPtr
   allocaBytes (fromIntegral bytes) (\buffer -> do
     _ <- _bn2mpi (unwrapBN bn) buffer
-    BS.packCStringLen (buffer, fromIntegral bytes))
+    BS.packCStringLen (castPtr buffer, fromIntegral bytes))
 
 -- | Convert an MPI into a BigNum. See bnToMPI for details of the format
 mpiToBN :: BS.ByteString -> IO BigNum
 mpiToBN mpi = do
   BS.useAsCStringLen mpi (\(ptr, len) -> do
-    _mpi2bn ptr (fromIntegral len) nullPtr) >>= return . wrapBN
+    _mpi2bn (castPtr ptr) (fromIntegral len) nullPtr) >>= return . wrapBN
 
 -- | Convert an Integer to an MPI. See bnToMPI for the format
 integerToMPI :: Integer -> IO BS.ByteString
diff --git a/OpenSSL/EVP/Base64.hs b/OpenSSL/EVP/Base64.hs
--- a/OpenSSL/EVP/Base64.hs
+++ b/OpenSSL/EVP/Base64.hs
@@ -22,9 +22,9 @@
 import qualified Data.ByteString.Lazy.Char8 as L8
 import           Data.List
 #if MIN_VERSION_base(4,5,0)
-import           Foreign.C.Types (CChar(..), CInt(..))
+import           Foreign.C.Types (CUChar(..), CInt(..))
 #else
-import           Foreign.C.Types (CChar, CInt)
+import           Foreign.C.Types (CUChar, CInt)
 #endif
 import           Foreign.Ptr (Ptr, castPtr)
 import           System.IO.Unsafe (unsafePerformIO)
@@ -50,7 +50,7 @@
 {- encode -------------------------------------------------------------------- -}
 
 foreign import capi unsafe "openssl/evp.h EVP_EncodeBlock"
-        _EncodeBlock :: Ptr CChar -> Ptr CChar -> CInt -> IO CInt
+        _EncodeBlock :: Ptr CUChar -> Ptr CUChar -> CInt -> IO CInt
 
 
 encodeBlock :: B8.ByteString -> B8.ByteString
@@ -59,7 +59,7 @@
       unsafeUseAsCStringLen inBS $ \ (inBuf, inLen) ->
       createAndTrim maxOutLen $ \ outBuf ->
       fmap fromIntegral
-           (_EncodeBlock (castPtr outBuf) inBuf (fromIntegral inLen))
+           (_EncodeBlock (castPtr outBuf) (castPtr inBuf) (fromIntegral inLen))
     where
       maxOutLen = (inputLen `div` 3 + 1) * 4 + 1 -- +1: '\0'
       inputLen  = B8.length inBS
@@ -104,7 +104,7 @@
 {- decode -------------------------------------------------------------------- -}
 
 foreign import capi unsafe "openssl/evp.h EVP_DecodeBlock"
-        _DecodeBlock :: Ptr CChar -> Ptr CChar -> CInt -> IO CInt
+        _DecodeBlock :: Ptr CUChar -> Ptr CUChar -> CInt -> IO CInt
 
 
 decodeBlock :: B8.ByteString -> B8.ByteString
@@ -113,7 +113,7 @@
       unsafePerformIO $
       unsafeUseAsCStringLen inBS $ \ (inBuf, inLen) ->
       createAndTrim (B8.length inBS) $ \ outBuf ->
-      _DecodeBlock (castPtr outBuf) inBuf (fromIntegral inLen)
+      _DecodeBlock (castPtr outBuf) (castPtr inBuf) (fromIntegral inLen)
            >>= \ outLen -> return (fromIntegral outLen - paddingLen)
     where
       paddingLen :: Int
diff --git a/OpenSSL/EVP/Internal.hsc b/OpenSSL/EVP/Internal.hsc
--- a/OpenSSL/EVP/Internal.hsc
+++ b/OpenSSL/EVP/Internal.hsc
@@ -66,7 +66,7 @@
 import Control.Applicative ((<$>))
 #endif
 import Control.Exception (mask, mask_, bracket, onException)
-import Foreign.C.Types (CChar)
+import Foreign.C.Types (CChar, CUChar)
 #if MIN_VERSION_base(4,5,0)
 import Foreign.C.Types (CInt(..), CUInt(..), CSize(..))
 #else
@@ -335,10 +335,10 @@
   _hmac_init :: Ptr HMAC_CTX -> Ptr () -> CInt -> Ptr EVP_MD -> IO CInt
 
 foreign import capi unsafe "openssl/hmac.h HMAC_Update"
-  _hmac_update :: Ptr HMAC_CTX -> Ptr CChar -> CInt -> IO CInt
+  _hmac_update :: Ptr HMAC_CTX -> Ptr CUChar -> CSize -> IO CInt
 
 foreign import capi unsafe "openssl/hmac.h HMAC_Final"
-  _hmac_final :: Ptr HMAC_CTX -> Ptr CChar -> Ptr CInt -> IO CUInt
+  _hmac_final :: Ptr HMAC_CTX -> Ptr CUChar -> Ptr CUInt -> IO CUInt
 
 foreign import capi unsafe "HsOpenSSL &HsOpenSSL_HMAC_CTX_free"
   _hmac_ctx_free :: FunPtr (Ptr HMAC_CTX -> IO ())
diff --git a/cbits/HsOpenSSL.h b/cbits/HsOpenSSL.h
--- a/cbits/HsOpenSSL.h
+++ b/cbits/HsOpenSSL.h
@@ -20,18 +20,6 @@
 #include <openssl/x509v3.h>
 #include <openssl/dsa.h>
 
-/* A dirty hack to work around for broken versions of Cabal:
- * https://github.com/phonohawk/HsOpenSSL/issues/8
- *
- * The trick is to abuse the fact that -Icbits is (almost) always
- * passed to hsc2hs so we can reach the cabal_macros.h from cbits, but
- * see #23, #24 and #25...
- */
-#if !defined(MIN_VERSION_base) && \
-    !defined(HSOPENSSL_NEED_NOT_INCLUDE_CABAL_MACROS_H)
-#  include "../dist/build/autogen/cabal_macros.h"
-#endif
-
 /* LibreSSL *******************************************************************/
 #if (defined LIBRESSL_VERSION_NUMBER && OPENSSL_VERSION_NUMBER == 0x20000000L)
 #undef OPENSSL_VERSION_NUMBER
