HsOpenSSL 0.10.1.3 → 0.10.1.4
raw patch · 5 files changed
+52/−41 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- HsOpenSSL.cabal +3/−3
- NEWS +6/−0
- OpenSSL.hsc +11/−9
- OpenSSL/EVP/Internal.hsc +7/−6
- OpenSSL/X509.hsc +25/−23
HsOpenSSL.cabal view
@@ -12,10 +12,10 @@ 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.+ encourages you to use and improve the tls package instead as long+ as possible. .-Version: 0.10.1.3+Version: 0.10.1.4 License: PublicDomain License-File: COPYING Author: Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen
NEWS view
@@ -1,5 +1,11 @@ -*- coding: utf-8 -*- +Changes from 0.10.1.3 to 0.10.1.4+---------------------------------+* Fixed #7 "Haskell Platform 2011.4 Support", reported by stepcut:+ - Foreign.ForeignPtr.Unsafe does not exist prior to base-4.4++ Changes from 0.10.1.2 to 0.10.1.3 --------------------------------- * OpenSSL.Session:
OpenSSL.hsc view
@@ -1,11 +1,17 @@ {- -*- haskell -*- -} --- |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. But since OpenSSL is a very large library, it is uneasy--- to cover every parts of it.+-- |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. --+-- 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+-- encourages you to use and improve the tls package instead as long+-- as possible.+-- -- Features that aren't (yet) supported: -- -- [/SSL network connection/] ssl(3) functionalities aren't fully@@ -35,10 +41,6 @@ -- -- [/ENGINE cryptographic module/] The default implementations work -- very well, don't they?------ So if you find out any features you want aren't supported, you must--- write your own patch (or take over the HsOpenSSL project). Happy--- hacking. #include "HsOpenSSL.h"
OpenSSL/EVP/Internal.hsc view
@@ -1,4 +1,3 @@- module OpenSSL.EVP.Internal ( Cipher(..), EVP_CIPHER,@@ -59,10 +58,12 @@ #endif import Foreign.Ptr (Ptr, castPtr, FunPtr) import Foreign.C.String (peekCStringLen)-import Foreign.ForeignPtr (- ForeignPtr, newForeignPtr, withForeignPtr, addForeignPtrFinalizer,- mallocForeignPtrBytes, touchForeignPtr)-import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)+import Foreign.ForeignPtr+#if MIN_VERSION_base(4,4,0)+import Foreign.ForeignPtr.Unsafe as Unsafe+#else+import Foreign.ForeignPtr as Unsafe+#endif import Foreign.Storable (Storable(..)) import Foreign.Marshal.Alloc (alloca, allocaBytes) import Foreign.Marshal.Array (allocaArray)@@ -301,7 +302,7 @@ withPKeyPtr pk f unsafePKeyToPtr :: VaguePKey -> Ptr EVP_PKEY-unsafePKeyToPtr (VaguePKey pkey) = unsafeForeignPtrToPtr pkey+unsafePKeyToPtr (VaguePKey pkey) = Unsafe.unsafeForeignPtrToPtr pkey touchPKey :: VaguePKey -> IO () touchPKey (VaguePKey pkey) = touchForeignPtr pkey
OpenSSL/X509.hsc view
@@ -1,5 +1,3 @@-{- -*- haskell -*- -}- {-# OPTIONS_HADDOCK prune #-} -- |An interface to X.509 certificate.@@ -49,22 +47,26 @@ , getSubjectEmail ) where--import Control.Monad-import Data.Time.Clock-import Data.Maybe-import Foreign hiding (unsafeForeignPtrToPtr)-import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)-import Foreign.C-import OpenSSL.ASN1-import OpenSSL.BIO-import OpenSSL.EVP.Digest hiding (digest)-import OpenSSL.EVP.PKey-import OpenSSL.EVP.Verify-import OpenSSL.EVP.Internal-import OpenSSL.Utils-import OpenSSL.Stack-import OpenSSL.X509.Name+import Control.Monad+import Data.Time.Clock+import Data.Maybe+import Foreign.ForeignPtr+#if MIN_VERSION_base(4,4,0)+import Foreign.ForeignPtr.Unsafe as Unsafe+#else+import Foreign.ForeignPtr as Unsafe+#endif+import Foreign.Ptr+import Foreign.C+import OpenSSL.ASN1+import OpenSSL.BIO+import OpenSSL.EVP.Digest+import OpenSSL.EVP.PKey+import OpenSSL.EVP.Verify+import OpenSSL.EVP.Internal+import OpenSSL.Utils+import OpenSSL.Stack+import OpenSSL.X509.Name -- |@'X509'@ is an opaque object that represents X.509 certificate. newtype X509 = X509 (ForeignPtr X509_)@@ -170,7 +172,7 @@ unsafeX509ToPtr :: X509 -> Ptr X509_-unsafeX509ToPtr (X509 x509) = unsafeForeignPtrToPtr x509+unsafeX509ToPtr (X509 x509) = Unsafe.unsafeForeignPtrToPtr x509 touchX509 :: X509 -> IO ()@@ -200,10 +202,10 @@ signX509 x509 key mDigest = withX509Ptr x509 $ \ x509Ptr -> withPKeyPtr' key $ \ pkeyPtr ->- do digest <- case mDigest of- Just md -> return md- Nothing -> pkeyDefaultMD key- withMDPtr digest $ \ digestPtr ->+ do dig <- case mDigest of+ Just md -> return md+ Nothing -> pkeyDefaultMD key+ withMDPtr dig $ \ digestPtr -> _sign x509Ptr pkeyPtr digestPtr >>= failIf_ (== 0) return ()