diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal index 7c9ab54..3283c61 100644 --- a/HsOpenSSL.cabal +++ b/HsOpenSSL.cabal @@ -12,7 +12,7 @@ Description: , which is a pure Haskell implementation of SSL. . -Version: 0.11.1.1 +Version: 0.11.2.0 License: PublicDomain License-File: COPYING Author: Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen @@ -46,7 +46,7 @@ Flag fast-bignum Description: Enable fast moving of bignums between OpenSSL and GMP (GHC Only). Default: - True + False Library Build-Depends: @@ -125,7 +125,7 @@ Test-Suite test-cipher Main-Is: Test/OpenSSL/Cipher.hs Build-Depends: HsOpenSSL, - HUnit >= 1.0 && < 1.3, + HUnit >= 1.0 && < 1.4, base == 4.*, bytestring >= 0.9 && < 0.11, test-framework >= 0.8 && < 0.9, @@ -138,7 +138,7 @@ Test-Suite test-dsa Main-Is: Test/OpenSSL/DSA.hs Build-Depends: HsOpenSSL, - HUnit >= 1.0 && < 1.3, + HUnit >= 1.0 && < 1.4, base == 4.*, bytestring >= 0.9 && < 0.11, test-framework >= 0.8 && < 0.9, @@ -151,7 +151,7 @@ Test-Suite test-evp-base64 Main-Is: Test/OpenSSL/EVP/Base64.hs Build-Depends: HsOpenSSL, - HUnit >= 1.0 && < 1.3, + HUnit >= 1.0 && < 1.4, base == 4.*, bytestring >= 0.9 && < 0.11, test-framework >= 0.8 && < 0.9, diff --git a/OpenSSL/EVP/Internal.hsc b/OpenSSL/EVP/Internal.hsc index 159376a..185bd06 100644 --- a/OpenSSL/EVP/Internal.hsc +++ b/OpenSSL/EVP/Internal.hsc @@ -14,6 +14,7 @@ module OpenSSL.EVP.Internal ( withNewCipherCtxPtr, CryptoMode(..), + cipherSetPadding, cipherInitBS, cipherUpdateBS, cipherFinalBS, @@ -132,6 +133,16 @@ fromCryptoMode :: Num a => CryptoMode -> a fromCryptoMode Encrypt = 1 fromCryptoMode Decrypt = 0 +foreign import ccall unsafe "EVP_CIPHER_CTX_set_padding" + _SetPadding :: Ptr EVP_CIPHER_CTX -> CInt -> IO CInt + +cipherSetPadding :: CipherCtx -> Int -> IO CipherCtx +cipherSetPadding ctx pad + = do withCipherCtxPtr ctx $ \ctxPtr -> + _SetPadding ctxPtr (fromIntegral pad) + >>= failIf_ (/= 1) + return ctx + foreign import ccall unsafe "EVP_CipherInit" _CipherInit :: Ptr EVP_CIPHER_CTX -> Ptr EVP_CIPHER