From e74149a7569afd1ea7d67c77f40c37471e7e3e58 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Fri, 28 Sep 2018 18:33:35 -0400 Subject: Begin implementing symmetric encryption Support RC4. Future commits will add support for more modern algorithms. --- src/BTLS/Buffer.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/BTLS/Buffer.hs') diff --git a/src/BTLS/Buffer.hs b/src/BTLS/Buffer.hs index 354c787..a74acf5 100644 --- a/src/BTLS/Buffer.hs +++ b/src/BTLS/Buffer.hs @@ -26,7 +26,8 @@ import qualified Data.ByteString.Unsafe as ByteString import Foreign (Storable(peek), Ptr, alloca, allocaArray, castPtr) import Foreign.C.Types -unsafeUseAsCBuffer :: ByteString -> ((Ptr a, CULong) -> IO b) -> IO b +unsafeUseAsCBuffer :: + Integral size => ByteString -> ((Ptr a, size) -> IO b) -> IO b unsafeUseAsCBuffer bs f = ByteString.unsafeUseAsCStringLen bs $ \(pStr, len) -> f (castPtr pStr, fromIntegral len) -- cgit v1.2.3