HsOpenSSL 0.1 → 0.1.1
raw patch · 15 files changed
+40/−78 lines, 15 filesdep ~time
Dependency ranges changed: time
Files
- HsOpenSSL.cabal +15/−13
- NEWS +4/−0
- OpenSSL.hsc +6/−5
- OpenSSL/ASN1.hsc +0/−4
- OpenSSL/BIO.hsc +3/−7
- OpenSSL/BN.hsc +0/−4
- OpenSSL/ERR.hsc +0/−4
- OpenSSL/EVP/Base64.hsc +2/−3
- OpenSSL/EVP/Cipher.hsc +2/−2
- OpenSSL/Objects.hsc +0/−4
- OpenSSL/PEM.hsc +6/−6
- OpenSSL/SSL.hsc +0/−4
- OpenSSL/Stack.hsc +2/−7
- OpenSSL/Utils.hs +0/−11
- OpenSSL/X509/Name.hsc +0/−4
HsOpenSSL.cabal view
@@ -5,7 +5,7 @@ generate RSA keys, read and write PEM files, generate message digests, sign and verify messages, encrypt and decrypt messages.-Version: 0.1+Version: 0.1.1 License: PublicDomain License-File: COPYING Author: PHO <phonohawk at ps dot sakura dot ne dot jp>@@ -15,13 +15,9 @@ Category: Cryptography Tested-With: GHC == 6.6.1 Build-Depends:- base, time+ base, time >= 1.1.1 Exposed-Modules: OpenSSL- OpenSSL.ASN1- OpenSSL.BIO- OpenSSL.BN- OpenSSL.ERR OpenSSL.EVP.Base64 OpenSSL.EVP.Cipher OpenSSL.EVP.Digest@@ -30,22 +26,27 @@ OpenSSL.EVP.Seal OpenSSL.EVP.Sign OpenSSL.EVP.Verify- OpenSSL.Objects OpenSSL.PEM OpenSSL.PKCS7 OpenSSL.RSA- OpenSSL.SSL- OpenSSL.Stack- OpenSSL.Utils OpenSSL.X509 OpenSSL.X509.Revocation- OpenSSL.X509.Name OpenSSL.X509.Request OpenSSL.X509.Store+Other-Modules:+ OpenSSL.ASN1+ OpenSSL.BIO+ OpenSSL.BN+ OpenSSL.ERR+ OpenSSL.Objects+ OpenSSL.SSL+ OpenSSL.Stack+ OpenSSL.Utils+ OpenSSL.X509.Name Extensions:- ForeignFunctionInterface+ ForeignFunctionInterface, EmptyDataDecls ghc-options:- -fglasgow-exts -O2 -fwarn-unused-imports+ -O2 -fwarn-unused-imports C-Sources: cbits/HsOpenSSL.c Include-Dirs:@@ -54,6 +55,7 @@ HsOpenSSL.h Extra-Source-Files: HsOpenSSL.buildinfo.in+ NEWS cbits/HsOpenSSL.h configure configure.ac
+ NEWS view
@@ -0,0 +1,4 @@+Changes from 0.1 to 0.1.1+-------------------------+* Moved hidden modules from Exposed-Modules to Other-Modules.+* Added "time >= 1.1.1" to the Build-Depends.
OpenSSL.hsc view
@@ -41,8 +41,9 @@ -- [/ENGINE cryptographic module/] The default implementations work -- very well, don't they? ----- So if you find out some features you want aren't supported, you--- must write your own patch. Happy hacking.+-- 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" @@ -59,9 +60,9 @@ -- |Computation of @'withOpenSSL' action@ initializes the OpenSSL--- library and computes @action@. Every applications that use OpenSSL--- must wrap any other operations related to OpenSSL or they might--- crash.+-- library and computes @action@. Every applications that use+-- HsOpenSSL must wrap any operations related to OpenSSL with+-- 'withOpenSSL', or they might crash. -- -- > module Main where -- > import OpenSSL
OpenSSL/ASN1.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- #include "HsOpenSSL.h" module OpenSSL.ASN1
OpenSSL/BIO.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- {- --------------------------------------------------------------------------- -} {- -} {- FOR INTERNAL USE ONLY -}@@ -241,7 +237,7 @@ bioReadBS bio maxLen = withBioPtr bio $ \ bioPtr -> createAndTrim maxLen $ \ bufPtr ->- _read bioPtr (unsafeCoercePtr bufPtr) maxLen >>= interpret+ _read bioPtr (castPtr bufPtr) maxLen >>= interpret where interpret :: Int -> IO Int interpret n@@ -287,7 +283,7 @@ bioGetsBS bio maxLen = withBioPtr bio $ \ bioPtr -> createAndTrim maxLen $ \ bufPtr ->- _gets bioPtr (unsafeCoercePtr bufPtr) maxLen >>= interpret+ _gets bioPtr (castPtr bufPtr) maxLen >>= interpret where interpret :: Int -> IO Int interpret n@@ -446,7 +442,7 @@ in -- ByteString への參照を BIO の finalizer に持たせる。 withForeignPtr foreignBuf $ \ buf ->- do bioPtr <- _new_mem_buf (unsafeCoercePtr $ buf `plusPtr` off) len+ do bioPtr <- _new_mem_buf (castPtr $ buf `plusPtr` off) len >>= failIfNull bio <- newForeignPtr _free bioPtr
OpenSSL/BN.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- module OpenSSL.BN ( BigNum , BIGNUM
OpenSSL/ERR.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- module OpenSSL.ERR ( getError , peekError
OpenSSL/EVP/Base64.hsc view
@@ -22,7 +22,6 @@ import Data.List import Foreign import Foreign.C-import OpenSSL.Utils -- エンコード時: 最低 3 バイト以上になるまで次のブロックを取り出し續け@@ -50,7 +49,7 @@ = unsafePerformIO $ unsafeUseAsCStringLen inBS $ \ (inBuf, inLen) -> createAndTrim maxOutLen $ \ outBuf ->- _EncodeBlock (unsafeCoercePtr outBuf) inBuf inLen+ _EncodeBlock (castPtr outBuf) inBuf inLen where maxOutLen = (inputLen `div` 3 + 1) * 4 + 1 -- +1: '\0' inputLen = B8.length inBS@@ -104,7 +103,7 @@ unsafePerformIO $ unsafeUseAsCStringLen inBS $ \ (inBuf, inLen) -> createAndTrim (B8.length inBS) $ \ outBuf ->- _DecodeBlock (unsafeCoercePtr outBuf) inBuf inLen+ _DecodeBlock (castPtr outBuf) inBuf inLen -- |@'decodeBase64' str@ lazilly decodes a stream of data from -- Base64. The string doesn't have to be finite.
OpenSSL/EVP/Cipher.hsc view
@@ -150,7 +150,7 @@ unsafeUseAsCStringLen inBS $ \ (inBuf, inLen) -> createAndTrim (inLen + _ctx_block_size ctxPtr - 1) $ \ outBuf -> alloca $ \ outLenPtr ->- _CipherUpdate ctxPtr (unsafeCoercePtr outBuf) outLenPtr inBuf inLen+ _CipherUpdate ctxPtr (castPtr outBuf) outLenPtr inBuf inLen >>= failIf (/= 1) >> peek outLenPtr @@ -160,7 +160,7 @@ = withCipherCtxPtr ctx $ \ ctxPtr -> createAndTrim (_ctx_block_size ctxPtr) $ \ outBuf -> alloca $ \ outLenPtr ->- _CipherFinal ctxPtr (unsafeCoercePtr outBuf) outLenPtr+ _CipherFinal ctxPtr (castPtr outBuf) outLenPtr >>= failIf (/= 1) >> peek outLenPtr
OpenSSL/Objects.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- #include "HsOpenSSL.h" module OpenSSL.Objects
OpenSSL/PEM.hsc view
@@ -190,7 +190,7 @@ do pkeyPtr <- case supply of PwNone -> withCString "" $ \ strPtr ->- _read_bio_PrivateKey bioPtr nullPtr nullFunPtr (unsafeCoercePtr strPtr)+ _read_bio_PrivateKey bioPtr nullPtr nullFunPtr (castPtr strPtr) PwStr passStr -> do cbPtr <- mkPemPasswordCallback $@@ -248,7 +248,7 @@ readPublicKey' bio = withBioPtr bio $ \ bioPtr -> withCString "" $ \ passPtr ->- _read_bio_PUBKEY bioPtr nullPtr nullFunPtr (unsafeCoercePtr passPtr)+ _read_bio_PUBKEY bioPtr nullPtr nullFunPtr (castPtr passPtr) >>= failIfNull >>= wrapPKeyPtr @@ -293,7 +293,7 @@ readX509' bio = withBioPtr bio $ \ bioPtr -> withCString "" $ \ passPtr ->- _read_bio_X509_AUX bioPtr nullPtr nullFunPtr (unsafeCoercePtr passPtr)+ _read_bio_X509_AUX bioPtr nullPtr nullFunPtr (castPtr passPtr) >>= failIfNull >>= wrapX509 @@ -358,7 +358,7 @@ readX509Req' bio = withBioPtr bio $ \ bioPtr -> withCString "" $ \ passPtr ->- _read_bio_X509_REQ bioPtr nullPtr nullFunPtr (unsafeCoercePtr passPtr)+ _read_bio_X509_REQ bioPtr nullPtr nullFunPtr (castPtr passPtr) >>= failIfNull >>= wrapX509Req @@ -404,7 +404,7 @@ readCRL' bio = withBioPtr bio $ \ bioPtr -> withCString "" $ \ passPtr ->- _read_bio_X509_CRL bioPtr nullPtr nullFunPtr (unsafeCoercePtr passPtr)+ _read_bio_X509_CRL bioPtr nullPtr nullFunPtr (castPtr passPtr) >>= failIfNull >>= wrapCRL @@ -449,7 +449,7 @@ readPkcs7' bio = withBioPtr bio $ \ bioPtr -> withCString "" $ \ passPtr ->- _read_bio_PKCS7 bioPtr nullPtr nullFunPtr (unsafeCoercePtr passPtr)+ _read_bio_PKCS7 bioPtr nullPtr nullFunPtr (castPtr passPtr) >>= failIfNull >>= wrapPkcs7Ptr
OpenSSL/SSL.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- module OpenSSL.SSL ( loadErrorStrings , addAllAlgorithms
OpenSSL/Stack.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- module OpenSSL.Stack ( STACK , mapStack@@ -12,7 +8,6 @@ import Control.Exception import Foreign-import OpenSSL.Utils data STACK@@ -37,14 +32,14 @@ mapStack :: (Ptr a -> IO b) -> Ptr STACK -> IO [b] mapStack m st = do num <- skNum st- mapM (\ i -> skValue st i >>= return . unsafeCoercePtr >>= m)+ mapM (\ i -> skValue st i >>= return . castPtr >>= m) $ take num [0..] newStack :: [Ptr a] -> IO (Ptr STACK) newStack values = do st <- skNewNull- mapM_ (skPush st . unsafeCoercePtr) values+ mapM_ (skPush st . castPtr) values return st
OpenSSL/Utils.hs view
@@ -1,18 +1,11 @@-{- -*- haskell -*- -}---- #hide- module OpenSSL.Utils ( failIfNull , failIf , raiseOpenSSLError-- , unsafeCoercePtr ) where import Foreign-import GHC.Base import OpenSSL.ERR @@ -32,7 +25,3 @@ raiseOpenSSLError :: IO a raiseOpenSSLError = getError >>= errorString >>= fail---unsafeCoercePtr :: Ptr a -> Ptr b-unsafeCoercePtr = unsafeCoerce#
OpenSSL/X509/Name.hsc view
@@ -1,7 +1,3 @@-{- -*- haskell -*- -}---- #hide- #include "HsOpenSSL.h" module OpenSSL.X509.Name