From c4ec9f3adee0cfe4eb3db2f523195526dd5120c8 Mon Sep 17 00:00:00 2001 From: Anton K Date: Mon, 28 Mar 2016 16:47:03 +0300 Subject: [PATCH 1/2] Add cipherSetPadding function It allows to set non-default padding to context (or turn it off completely) --- OpenSSL/EVP/Internal.hsc | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 From d103f4acacad442f0039a7942b6483a50e583f9e Mon Sep 17 00:00:00 2001 From: Anton K Date: Thu, 21 Apr 2016 19:46:49 +0300 Subject: [PATCH 2/2] Bump major version, bump HUnit upper bound --- HsOpenSSL.cabal | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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,