packages feed

hopenssl 1.3 → 1.4

raw patch · 4 files changed

+88/−14 lines, 4 filesdep +bytestringPVP ok

version bump matches the API change (PVP)

Dependencies added: bytestring

API changes (from Hackage documentation)

- OpenSSL.Digest: instance Typeable DigestState
+ OpenSSL.Digest.ByteString: digest :: MessageDigest -> ByteString -> IO [Word8]
+ OpenSSL.Digest.ByteString: update :: ByteString -> Digest Int
+ OpenSSL.Digest.ByteString.Lazy: digest :: MessageDigest -> ByteString -> IO [Word8]
+ OpenSSL.Digest.ByteString.Lazy: update :: ByteString -> Digest Int

Files

OpenSSL/Digest.hs view
@@ -1,9 +1,8 @@-{-# INCLUDE <openssl/evp.h> #-}-{-# LANGUAGE ForeignFunctionInterface, GeneralizedNewtypeDeriving, DeriveDataTypeable #-}+{-# LANGUAGE ForeignFunctionInterface #-}  {- |    Module      :  OpenSSL.Digest-   Copyright   :  (c) 2009 by Peter Simons+   Copyright   :  (c) 2010 by Peter Simons    License     :  BSD3     Maintainer  :  simons@cryp.to@@ -44,7 +43,6 @@ import Foreign.C import Control.Monad.State import Numeric ( showHex )-import Data.Typeable  -- * High-level API @@ -77,7 +75,6 @@ -- |The internal EVP context.  newtype DigestState = DST (Ptr OpaqueContext)-  deriving (Typeable)  -- |Run an 'IO' computation with an initialized -- 'DigestState'. All resources will be freed when the
+ OpenSSL/Digest/ByteString.hs view
@@ -0,0 +1,44 @@+{- |+   Module      :  OpenSSL.Digest.ByteString+   Copyright   :  (c) 2010 by Peter Simons+   License     :  BSD3++   Maintainer  :  simons@cryp.to+   Stability   :  provisional+   Portability :  portable++   Wrappers for "OpenSSL.Digest" that supports 'ByteString'.+ -}++module OpenSSL.Digest.ByteString where++import OpenSSL.Digest hiding ( update )+import Control.Monad.State ( evalStateT, lift, get )+import Foreign.Ptr ( castPtr )+import Data.Word ( Word8 )+import Data.ByteString ( ByteString )+import Data.ByteString.Unsafe ( unsafeUseAsCStringLen )++-- |A convenience wrapper which computes the given digest type of a+-- 'ByteString'. Unlike the monadic interface, this function does not+-- allow the computation to be restarted.++digest :: MessageDigest -> ByteString -> IO [Word8]+digest mdType xs =+  mkDigest mdType $ evalStateT (update xs >> final)++-- |Update the internal state with a block of data.++update :: ByteString -> Digest Int+update bs = do+    DST ctx <- get+    l <- lift $+      unsafeUseAsCStringLen bs $ \(ptr, len) ->+        digestUpdate ctx (castPtr ptr) (fromIntegral len)+    return (fromEnum l)++-- ----- Configure Emacs -----+--+-- Local Variables: ***+-- haskell-program-name: "ghci -ignore-package hopenssl -Wall -lcrypto" ***+-- End: ***
+ OpenSSL/Digest/ByteString/Lazy.hs view
@@ -0,0 +1,38 @@+{- |+   Module      :  OpenSSL.Digest.ByteString.Lazy+   Copyright   :  (c) 2010 by Peter Simons+   License     :  BSD3++   Maintainer  :  simons@cryp.to+   Stability   :  provisional+   Portability :  portable++   Wrappers for "OpenSSL.Digest" that supports lazy 'ByteString'.+ -}++module OpenSSL.Digest.ByteString.Lazy where++import OpenSSL.Digest hiding ( update )+import Data.Word ( Word8 )+import Control.Monad.State ( evalStateT )+import qualified OpenSSL.Digest.ByteString as BS ( update )+import Data.ByteString.Lazy ( ByteString, toChunks )++-- |A convenience wrapper which computes the given digest type of a+-- 'ByteString'. Unlike the monadic interface, this function does not+-- allow the computation to be restarted.++digest :: MessageDigest -> ByteString -> IO [Word8]+digest mdType xs =+  mkDigest mdType $ evalStateT (update xs >> final)++-- |Update the internal state with a block of data.++update :: ByteString -> Digest Int+update = fmap sum . mapM BS.update . toChunks++-- ----- Configure Emacs -----+--+-- Local Variables: ***+-- haskell-program-name: "ghci -ignore-package hopenssl -Wall -lcrypto" ***+-- End: ***
hopenssl.cabal view
@@ -1,9 +1,9 @@ Name:                   hopenssl-Version:                1.3+Version:                1.4 Copyright:              (c) 2004-2010 Peter Simons License:                BSD3 License-File:           LICENSE-Author:                 Peter Simons <simons@cryp.to>+Author:                 Peter Simons <simons@cryp.to>, Jesper Louis Andersen <jesper.louis.andersen@gmail.com> Maintainer:             Peter Simons <simons@cryp.to> Homepage:               http://gitorious.org/hopenssl Category:               Foreign, Cryptography@@ -17,19 +17,14 @@ Build-Type:             Simple Tested-With:            GHC == 6.12.1 -Source-Repository this-  Tag:                  v1.3-  Type:                 git-  Location:             git://gitorious.org/hopenssl/mainline.git- Source-Repository head   Type:                 git   Location:             git://gitorious.org/hopenssl/mainline.git  Library-  Build-Depends:        base >= 3 && < 5, mtl+  Build-Depends:        base >= 3 && < 5, mtl, bytestring   Extensions:           ForeignFunctionInterface   Extra-Libraries:      crypto   Includes:             "openssl/evp.h"-  Exposed-Modules:      OpenSSL.Digest+  Exposed-Modules:      OpenSSL.Digest, OpenSSL.Digest.ByteString, OpenSSL.Digest.ByteString.Lazy   Ghc-Options:          -Wall