packages feed

cryptonite-openssl 0.1 → 0.2

raw patch · 3 files changed

+22/−8 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Crypto.OpenSSL.ECC: PointConversion_Compressed :: PointConversionForm
+ Crypto.OpenSSL.ECC: PointConversion_Hybrid :: PointConversionForm
+ Crypto.OpenSSL.ECC: PointConversion_Uncompressed :: PointConversionForm
+ Crypto.OpenSSL.ECC: data PointConversionForm

Files

Crypto/OpenSSL/AES.hs view
@@ -4,6 +4,12 @@ -- Stability   : experimental -- Portability : Unix --+-- Small Ad-Hoc bindings to AES-GCM encryption and decryption function.+--+-- Doesn't support incremental mode yet.+--+-- TODO: full fledge AES bindings (CBC, CTR, GCM...), with incremental processing.+-- module Crypto.OpenSSL.AES     ( isSupportedGCM     , encryptGCM@@ -27,6 +33,7 @@  data Direction = DirectionEncrypt | DirectionDecrypt +-- | Get whether the OpenSSL version linked supports GCM mode (at least 1.0.x and above) isSupportedGCM :: Bool isSupportedGCM = doIO $ do     cipher <- ssl_c_aes_256_gcm@@ -49,7 +56,11 @@ {-# NOINLINE withGCM #-}  -- | One shot function to GCM data without any incremental handling-encryptGCM :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString+encryptGCM :: ByteString -- ^ Key+           -> ByteString -- ^ IV+           -> ByteString -- ^ Header (Authenticated input, will be not be copied to output)+           -> ByteString -- ^ Plaintext to encrypt+           -> ByteString -- ^ Encrypted input including the authentication tag (but not the header) encryptGCM key iv header input = withGCM DirectionEncrypt key iv $ \ctx -> do     -- consume the header as authenticated data     when (headerLength > 0) $ do@@ -71,7 +82,11 @@ {-# NOINLINE encryptGCM #-}  -- | One shot function to decrypt GCM data without any incremental handling-decryptGCM :: ByteString -> ByteString -> ByteString -> ByteString -> Maybe ByteString+decryptGCM :: ByteString -- ^ Key+           -> ByteString -- ^ IV+           -> ByteString -- ^ Header (Authenticated input)+           -> ByteString -- ^ Encrypted data+           -> Maybe ByteString -- ^ Decrypted data if authentication successful decryptGCM key iv header input     | inputLength < gcmTagLength = Nothing     | otherwise                  = withGCM DirectionDecrypt key iv $ \ctx -> do
Crypto/OpenSSL/ECC.hs view
@@ -30,6 +30,7 @@     , ecPointIsOnCurve     , ecPointEq     -- * EcPoint serialization+    , PointConversionForm(..)     , ecPointToOct     , ecPointFromOct     , ecPointFromJProjectiveGFp
cryptonite-openssl.cabal view
@@ -1,5 +1,5 @@ Name:                cryptonite-openssl-Version:             0.1+Version:             0.2 Synopsis:            Crypto stuff using OpenSSL cryptographic library Description:         cryptography License:             BSD3@@ -38,11 +38,9 @@     extra-libraries: eay32, ssl32   else     if os(osx)-      extra-libraries: crypto-      extra-lib-dirs: /usr/local/lib-      include-dirs: /usr/local/include-    else-      extra-libraries: crypto+      include-dirs: /usr/local/opt/openssl/include+      extra-lib-dirs: /usr/local/opt/openssl/lib+    extra-libraries: crypto   cpp-options:       -DUSE_OPENSSL  Test-Suite test-cryptonite-openssl