Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions HsOpenSSL.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Description:
<http://hackage.haskell.org/package/tls>, 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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions OpenSSL/EVP/Internal.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module OpenSSL.EVP.Internal (
withNewCipherCtxPtr,

CryptoMode(..),
cipherSetPadding,
cipherInitBS,
cipherUpdateBS,
cipherFinalBS,
Expand Down Expand Up @@ -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
Expand Down