HsOpenSSL 0.10.1.2 → 0.10.1.3
raw patch · 12 files changed
+52/−18 lines, 12 filesdep ~basedep ~networkPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, network
API changes (from Hackage documentation)
+ OpenSSL.PKCS7: data PKCS7
+ OpenSSL.PKCS7: withPkcs7Ptr :: Pkcs7 -> (Ptr PKCS7 -> IO a) -> IO a
+ OpenSSL.PKCS7: wrapPkcs7Ptr :: Ptr PKCS7 -> IO Pkcs7
+ OpenSSL.Session: instance Typeable SSL
+ OpenSSL.Session: instance Typeable SSLContext
+ OpenSSL.Session: instance Typeable ShutdownType
+ OpenSSL.Session: instance Typeable VerificationMode
+ OpenSSL.Session: instance Typeable1 SSLResult
- OpenSSL.DSA: class DSAKey k
+ OpenSSL.DSA: class DSAKey k where dsaSize dsa = unsafePerformIO $ withDSAPtr dsa $ \ dsaPtr -> fmap fromIntegral (_size dsaPtr) dsaP = peekI ((\ hsc_ptr -> peekByteOff hsc_ptr 12)) dsaQ = peekI ((\ hsc_ptr -> peekByteOff hsc_ptr 16)) dsaG = peekI ((\ hsc_ptr -> peekByteOff hsc_ptr 20)) dsaPublic = peekI ((\ hsc_ptr -> peekByteOff hsc_ptr 24))
- OpenSSL.EVP.PKey: class PublicKey a => KeyPair a
+ OpenSSL.EVP.PKey: class PublicKey a => KeyPair a where fromKeyPair = SomeKeyPair toKeyPair (SomeKeyPair pk) = cast pk
- OpenSSL.EVP.PKey: class (Eq k, Typeable k, PKey k) => PublicKey k
+ OpenSSL.EVP.PKey: class (Eq k, Typeable k, PKey k) => PublicKey k where fromPublicKey = SomePublicKey toPublicKey (SomePublicKey pk) = cast pk
- OpenSSL.RSA: class RSAKey k
+ OpenSSL.RSA: class RSAKey k where rsaSize rsa = unsafePerformIO $ withRSAPtr rsa $ \ rsaPtr -> fmap fromIntegral (_size rsaPtr) rsaN = peekI ((\ hsc_ptr -> peekByteOff hsc_ptr 16)) rsaE = peekI ((\ hsc_ptr -> peekByteOff hsc_ptr 20))
Files
- HsOpenSSL.cabal +15/−6
- NEWS +12/−0
- OpenSSL/BN.hsc +4/−1
- OpenSSL/DSA.hsc +2/−1
- OpenSSL/EVP/Base64.hsc +2/−1
- OpenSSL/EVP/Digest.hsc +2/−1
- OpenSSL/EVP/Internal.hsc +2/−1
- OpenSSL/EVP/Open.hsc +2/−1
- OpenSSL/RSA.hsc +2/−1
- OpenSSL/Session.hsc +5/−2
- OpenSSL/Utils.hs +2/−2
- OpenSSL/X509.hsc +2/−1
HsOpenSSL.cabal view
@@ -1,12 +1,21 @@ Name: HsOpenSSL Synopsis: (Incomplete) OpenSSL binding for Haskell Description:- HsOpenSSL is an (incomplete) OpenSSL binding for Haskell. It can- generate RSA and DSA keys, read and write PEM files, generate- message digests, sign and verify messages, encrypt and decrypt- messages. It has also some capabilities of creating SSL clients- and servers.-Version: 0.10.1.2+ .+ HsOpenSSL is an OpenSSL binding for Haskell. It can generate RSA+ and DSA keys, read and write PEM files, generate message digests,+ sign and verify messages, encrypt and decrypt messages. It has+ also some capabilities of creating SSL clients and servers.+ .+ Please note that this project has started at the time when there+ were no pure-Haskell implementations of TLS. Now there is tls+ package (<http://hackage.haskell.org/package/tls>), which looks+ pretty saner than HsOpenSSL especially for initialisation and+ error handlings. So PHO (the initial author of HsOpenSSL) highly+ recommends you to use and improve the tls package instead of this+ as long as possible.+ .+Version: 0.10.1.3 License: PublicDomain License-File: COPYING Author: Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen
NEWS view
@@ -1,5 +1,17 @@ -*- coding: utf-8 -*- +Changes from 0.10.1.2 to 0.10.1.3+---------------------------------+* OpenSSL.Session:+ - SSL, SSLContext, SSLResult, ShutdownType and VerificationMode are+ now instances of Typeable.++* Applied a series of patches "Various fixes for GHC 7.5" by Ben Gamari:+ - Use unsafeForeignPtrToPtr from Foreign.ForeignPtr.Unsafe+ - Use unsafePerformIO from System.IO.Unsafe+ - Add Num to constraints with Bits++ Changes from 0.10.1.1 to 0.10.1.2 --------------------------------- * Applied a patch by Mikhail Vorozhtsov:
OpenSSL/BN.hsc view
@@ -43,9 +43,12 @@ where import Control.Exception hiding (try)-import Foreign import qualified Data.ByteString as BS+import Foreign.Marshal+import Foreign.Ptr+import Foreign.Storable import OpenSSL.Utils+import System.IO.Unsafe #ifndef __GLASGOW_HASKELL__ import Control.Monad
OpenSSL/DSA.hsc view
@@ -34,7 +34,8 @@ import Control.Monad import qualified Data.ByteString as BS import Data.Typeable-import Foreign+import Foreign hiding (unsafePerformIO)+import System.IO.Unsafe (unsafePerformIO) import Foreign.C (CString) import Foreign.C.Types import OpenSSL.BN
OpenSSL/EVP/Base64.hsc view
@@ -22,8 +22,9 @@ import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Lazy.Char8 as L8 import Data.List-import Foreign+import Foreign hiding (unsafePerformIO) import Foreign.C+import System.IO.Unsafe (unsafePerformIO) -- On encoding, we keep fetching the next block until we get at least
OpenSSL/EVP/Digest.hsc view
@@ -24,7 +24,8 @@ import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Lazy.Char8 as L8 import Control.Applicative ((<$>))-import Foreign+import Foreign hiding (unsafePerformIO)+import System.IO.Unsafe (unsafePerformIO) import Foreign.C import OpenSSL.EVP.Internal import OpenSSL.Objects
OpenSSL/EVP/Internal.hsc view
@@ -61,7 +61,8 @@ import Foreign.C.String (peekCStringLen) import Foreign.ForeignPtr ( ForeignPtr, newForeignPtr, withForeignPtr, addForeignPtrFinalizer,- mallocForeignPtrBytes, touchForeignPtr, unsafeForeignPtrToPtr)+ mallocForeignPtrBytes, touchForeignPtr)+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) import Foreign.Storable (Storable(..)) import Foreign.Marshal.Alloc (alloca, allocaBytes) import Foreign.Marshal.Array (allocaArray)
OpenSSL/EVP/Open.hsc view
@@ -12,7 +12,8 @@ import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Lazy.Char8 as L8-import Foreign+import Foreign hiding (unsafePerformIO)+import System.IO.Unsafe (unsafePerformIO) import Foreign.C import OpenSSL.EVP.Cipher hiding (cipher) import OpenSSL.EVP.PKey
OpenSSL/RSA.hsc view
@@ -32,7 +32,8 @@ import Control.Monad import Data.Typeable-import Foreign+import Foreign hiding (unsafePerformIO)+import System.IO.Unsafe (unsafePerformIO) import Foreign.C import OpenSSL.BN import OpenSSL.Utils
OpenSSL/Session.hsc view
@@ -102,6 +102,7 @@ , ctxPtr :: ForeignPtr SSLContext_ , ctxVfCb :: IORef (Maybe (FunPtr VerifyCb)) }+ deriving Typeable data SSLMethod_ @@ -212,6 +213,7 @@ , vpClientOnce :: Bool -- ^ only request once per connection , vpCallback :: Maybe (Bool -> X509StoreCtx -> IO Bool) -- ^ optional callback }+ deriving Typeable foreign import ccall unsafe "SSL_CTX_set_verify" _ssl_set_verify_mode :: Ptr SSLContext_ -> CInt -> FunPtr VerifyCb -> IO ()@@ -286,6 +288,7 @@ , sslFd :: Fd -- ^ Get the underlying socket Fd , sslSocket :: Maybe Socket -- ^ Get the socket underlying an SSL connection }+ deriving Typeable foreign import ccall unsafe "SSL_new" _ssl_new :: Ptr SSLContext_ -> IO (Ptr SSL_) foreign import ccall unsafe "&SSL_free" _ssl_free :: FunPtr (Ptr SSL_ -> IO ())@@ -342,7 +345,7 @@ data SSLResult a = SSLDone a -- ^ operation finished successfully | WantRead -- ^ needs more data from the network | WantWrite -- ^ needs more outgoing buffer space- deriving (Eq, Show, Functor, Foldable, Traversable)+ deriving (Eq, Show, Functor, Foldable, Traversable, Typeable) -- | Block until the operation is finished. sslBlock :: (SSL -> IO (SSLResult a)) -> SSL -> IO a@@ -490,7 +493,7 @@ data ShutdownType = Bidirectional -- ^ wait for the peer to also shutdown | Unidirectional -- ^ only send our shutdown- deriving (Eq, Show)+ deriving (Eq, Show, Typeable) -- | Cleanly shutdown an SSL connection. Note that SSL has a concept of a -- secure shutdown, which is distinct from just closing the TCP connection.
OpenSSL/Utils.hs view
@@ -45,7 +45,7 @@ raiseOpenSSLError = getError >>= errorString >>= fail -- | Convert an integer to a hex string-toHex :: (Bits i) => i -> String+toHex :: (Num i, Bits i) => i -> String toHex = reverse . map hexByte . unfoldr step where step 0 = Nothing step i = Just (i .&. 0xf, i `shiftR` 4)@@ -69,7 +69,7 @@ hexByte _ = undefined -- | Convert a hex string to an integer-fromHex :: (Bits i) => String -> i+fromHex :: (Num i, Bits i) => String -> i fromHex = foldl step 0 where step acc hexchar = (acc `shiftL` 4) .|. byteHex hexchar
OpenSSL/X509.hsc view
@@ -53,7 +53,8 @@ import Control.Monad import Data.Time.Clock import Data.Maybe-import Foreign+import Foreign hiding (unsafeForeignPtrToPtr)+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) import Foreign.C import OpenSSL.ASN1 import OpenSSL.BIO