diff options
author | Benjamin Barenblat <bbaren@google.com> | 2018-09-28 18:33:35 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2018-09-28 18:33:35 -0400 |
commit | e74149a7569afd1ea7d67c77f40c37471e7e3e58 (patch) | |
tree | d8478e569eade926a72829eee9d3afe0e8f12710 /src/BTLS/Buffer.hs | |
parent | 8ac48890e98a4974980b8ca3d5e90a2e52c1a624 (diff) |
Begin implementing symmetric encryption
Support RC4. Future commits will add support for more modern algorithms.
Diffstat (limited to 'src/BTLS/Buffer.hs')
-rw-r--r-- | src/BTLS/Buffer.hs | 3 |
1 files changed, 2 insertions, 1 deletions
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) |