~singpolyma/gsasl-haskell

641d071121e935b62ad0b6cdb52e2dc3d4aef78b — Stephen Paul Weber 8 months ago 58bfa24 master 0.4.0
These deprecated procedures have been removed now
2 files changed, 2 insertions(+), 62 deletions(-)

M gsasl.cabal
M lib/Network/Protocol/SASL/GNU.hs
M gsasl.cabal => gsasl.cabal +2 -2
@@ 1,5 1,5 @@
name: gsasl
version: 0.3.7
version: 0.4.0
license: GPL-3
license-file: COPYING
author: John Millikin <john@john-millikin.com>


@@ 21,7 21,7 @@ source-repository head
source-repository this
  type: git
  location: https://git.sr.ht/~singpolyma/gsasl-haskell
  tag: 0.3.7
  tag: 0.4.0

library
  default-language: Haskell2010

M lib/Network/Protocol/SASL/GNU.hs => lib/Network/Protocol/SASL/GNU.hs +0 -60
@@ 63,10 63,6 @@ module Network.Protocol.SASL.GNU
	-- * Bundled codecs
	, toBase64
	, fromBase64
	, md5
	, sha1
	, hmacMD5
	, hmacSHA1
	, nonce
	, random
	) where


@@ 780,50 776,6 @@ toBase64 = base64Helper gsasl_base64_to
fromBase64 :: B.ByteString -> B.ByteString
fromBase64 = base64Helper gsasl_base64_from

md5 :: B.ByteString -> B.ByteString
md5 input = unsafePerformIO $
	B.unsafeUseAsCStringLen input $ \(pIn, inLen) ->
	F.alloca $ \pOut ->
	F.allocaBytes 16 $ \outBuf -> do
	F.poke pOut outBuf
	gsasl_md5 pIn (fromIntegral inLen) pOut >>= checkRC
	B.packCStringLen (outBuf, 16)

sha1 :: B.ByteString -> B.ByteString
sha1 input = unsafePerformIO $
	B.unsafeUseAsCStringLen input $ \(pIn, inLen) ->
	F.alloca $ \pOut -> do
	gsasl_sha1 pIn (fromIntegral inLen) pOut >>= checkRC
	outBuf <- F.peek pOut
	ret <- B.packCStringLen (outBuf, 20)
	F.free outBuf
	return ret


hmacMD5 :: B.ByteString -- ^ Key
        -> B.ByteString -- ^ Input data
        -> B.ByteString
hmacMD5 key input = unsafePerformIO $
	B.unsafeUseAsCStringLen key $ \(pKey, keyLen) ->
	B.unsafeUseAsCStringLen input $ \(pIn, inLen) ->
	F.alloca $ \pOut ->
	F.allocaBytes 16 $ \outBuf -> do
	F.poke pOut outBuf
	gsasl_hmac_md5 pKey (fromIntegral keyLen) pIn (fromIntegral inLen) pOut >>= checkRC
	B.packCStringLen (outBuf, 16)

hmacSHA1 :: B.ByteString -- ^ Key
         -> B.ByteString -- ^ Input data
         -> B.ByteString
hmacSHA1 key input = unsafePerformIO $
	B.unsafeUseAsCStringLen key $ \(pKey, keyLen) ->
	B.unsafeUseAsCStringLen input $ \(pIn, inLen) ->
	F.alloca $ \pOut ->
	F.allocaBytes 20 $ \outBuf -> do
	F.poke pOut outBuf
	gsasl_hmac_sha1 pKey (fromIntegral keyLen) pIn (fromIntegral inLen) pOut >>= checkRC
	B.packCStringLen (outBuf, 20)

-- | Returns unpredictable data of a given size
nonce :: Integer -> IO B.ByteString
nonce size = F.allocaBytes (fromInteger size) $ \buf -> do


@@ 943,18 895,6 @@ foreign import ccall "gsasl.h gsasl_base64_to"
foreign import ccall "gsasl.h gsasl_base64_from"
	gsasl_base64_from :: F.CString -> F.CSize -> F.Ptr F.CString -> F.Ptr F.CSize -> IO F.CInt

foreign import ccall "gsasl.h gsasl_md5"
	gsasl_md5 :: F.CString -> F.CSize -> F.Ptr F.CString -> IO F.CInt

foreign import ccall "gsasl.h gsasl_sha1"
	gsasl_sha1 :: F.CString -> F.CSize -> F.Ptr F.CString -> IO F.CInt

foreign import ccall "gsasl.h gsasl_hmac_md5"
	gsasl_hmac_md5 :: F.CString -> F.CSize -> F.CString -> F.CSize -> F.Ptr F.CString -> IO F.CInt

foreign import ccall "gsasl.h gsasl_hmac_sha1"
	gsasl_hmac_sha1 :: F.CString -> F.CSize -> F.CString -> F.CSize -> F.Ptr F.CString -> IO F.CInt

foreign import ccall "gsasl.h gsasl_nonce"
	gsasl_nonce :: F.CString -> F.CSize -> IO F.CInt