packages feed

cipher-aes128 0.7.0.1 → 0.7.0.2

raw patch · 3 files changed

+41/−17 lines, 3 filesdep −cipher-aessetup-changedPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: cipher-aes

API changes (from Hackage documentation)

- Crypto.Cipher.AES128: instance AES_GCM AESKey128
- Crypto.Cipher.AES128: instance AES_GCM AESKey192
- Crypto.Cipher.AES128: instance AES_GCM AESKey256
- Crypto.Cipher.AES128: instance BlockCipher AESKey128
- Crypto.Cipher.AES128: instance BlockCipher AESKey192
- Crypto.Cipher.AES128: instance BlockCipher AESKey256
- Crypto.Cipher.AES128: instance Eq AuthTag
- Crypto.Cipher.AES128: instance Serialize AESKey128
- Crypto.Cipher.AES128: instance Serialize AESKey192
- Crypto.Cipher.AES128: instance Serialize AESKey256
- Crypto.Cipher.AES128: unAuthTag :: AuthTag -> ByteString
- Crypto.Cipher.AES128.Internal: _ctxFP2 :: GCM k -> ForeignPtr CTXStruct
- Crypto.Cipher.AES128.Internal: _gcmFP :: GCM k -> GCMpc
- Crypto.Cipher.AES128.Internal: _keyFP :: GCM k -> k
- Crypto.Cipher.AES128.Internal: aK256 :: RawKey256 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: bK256 :: RawKey256 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: cK256 :: RawKey256 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: dK256 :: RawKey256 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: expandedKey128 :: AESKey128 -> ForeignPtr AESKeyStruct
- Crypto.Cipher.AES128.Internal: expandedKey192 :: AESKey192 -> ForeignPtr AESKeyStruct
- Crypto.Cipher.AES128.Internal: expandedKey256 :: AESKey256 -> ForeignPtr AESKeyStruct
- Crypto.Cipher.AES128.Internal: highK128 :: RawKey128 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: highK192 :: RawKey192 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: instance GetExpanded AESKey128
- Crypto.Cipher.AES128.Internal: instance GetExpanded AESKey192
- Crypto.Cipher.AES128.Internal: instance GetExpanded AESKey256
- Crypto.Cipher.AES128.Internal: lowK128 :: RawKey128 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: lowK192 :: RawKey192 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: midK192 :: RawKey192 -> {-# UNPACK #-} !Word64
- Crypto.Cipher.AES128.Internal: rawKey128 :: AESKey128 -> !RawKey128
- Crypto.Cipher.AES128.Internal: rawKey192 :: AESKey192 -> !RawKey192
- Crypto.Cipher.AES128.Internal: rawKey256 :: AESKey256 -> !RawKey256
+ Crypto.Cipher.AES128: [unAuthTag] :: AuthTag -> ByteString
+ Crypto.Cipher.AES128: instance Crypto.Cipher.AES128.AES_GCM Crypto.Cipher.AES128.Internal.AESKey128
+ Crypto.Cipher.AES128: instance Crypto.Cipher.AES128.AES_GCM Crypto.Cipher.AES128.Internal.AESKey192
+ Crypto.Cipher.AES128: instance Crypto.Cipher.AES128.AES_GCM Crypto.Cipher.AES128.Internal.AESKey256
+ Crypto.Cipher.AES128: instance Crypto.Classes.BlockCipher Crypto.Cipher.AES128.Internal.AESKey128
+ Crypto.Cipher.AES128: instance Crypto.Classes.BlockCipher Crypto.Cipher.AES128.Internal.AESKey192
+ Crypto.Cipher.AES128: instance Crypto.Classes.BlockCipher Crypto.Cipher.AES128.Internal.AESKey256
+ Crypto.Cipher.AES128: instance Data.Serialize.Serialize Crypto.Cipher.AES128.Internal.AESKey128
+ Crypto.Cipher.AES128: instance Data.Serialize.Serialize Crypto.Cipher.AES128.Internal.AESKey192
+ Crypto.Cipher.AES128: instance Data.Serialize.Serialize Crypto.Cipher.AES128.Internal.AESKey256
+ Crypto.Cipher.AES128: instance GHC.Classes.Eq Crypto.Cipher.AES128.AuthTag
+ Crypto.Cipher.AES128.Internal: [_ctxFP2] :: GCM k -> ForeignPtr CTXStruct
+ Crypto.Cipher.AES128.Internal: [_gcmFP] :: GCM k -> GCMpc
+ Crypto.Cipher.AES128.Internal: [_keyFP] :: GCM k -> k
+ Crypto.Cipher.AES128.Internal: [aK256, bK256, cK256, dK256] :: RawKey256 -> {-# UNPACK #-} !Word64
+ Crypto.Cipher.AES128.Internal: [expandedKey128] :: AESKey128 -> ForeignPtr AESKeyStruct
+ Crypto.Cipher.AES128.Internal: [expandedKey192] :: AESKey192 -> ForeignPtr AESKeyStruct
+ Crypto.Cipher.AES128.Internal: [expandedKey256] :: AESKey256 -> ForeignPtr AESKeyStruct
+ Crypto.Cipher.AES128.Internal: [lowK128, highK128] :: RawKey128 -> {-# UNPACK #-} !Word64
+ Crypto.Cipher.AES128.Internal: [lowK192, midK192, highK192] :: RawKey192 -> {-# UNPACK #-} !Word64
+ Crypto.Cipher.AES128.Internal: [rawKey128] :: AESKey128 -> !RawKey128
+ Crypto.Cipher.AES128.Internal: [rawKey192] :: AESKey192 -> !RawKey192
+ Crypto.Cipher.AES128.Internal: [rawKey256] :: AESKey256 -> !RawKey256
+ Crypto.Cipher.AES128.Internal: instance Crypto.Cipher.AES128.Internal.GetExpanded Crypto.Cipher.AES128.Internal.AESKey128
+ Crypto.Cipher.AES128.Internal: instance Crypto.Cipher.AES128.Internal.GetExpanded Crypto.Cipher.AES128.Internal.AESKey192
+ Crypto.Cipher.AES128.Internal: instance Crypto.Cipher.AES128.Internal.GetExpanded Crypto.Cipher.AES128.Internal.AESKey256
- Crypto.Cipher.AES128: blockSize :: BlockCipher k => Tagged * k BitLength
+ Crypto.Cipher.AES128: blockSize :: Tagged * k BitLength
- Crypto.Cipher.AES128: buildKey :: BlockCipher k => ByteString -> Maybe k
+ Crypto.Cipher.AES128: buildKey :: ByteString -> Maybe k
- Crypto.Cipher.AES128: cbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: cbc :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: cbcLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: cbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: cfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: cfb :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: cfbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: cfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: ctr :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: ctr :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: ctrLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: ctrLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: decryptBlock :: BlockCipher k => k -> ByteString -> ByteString
+ Crypto.Cipher.AES128: decryptBlock :: k -> ByteString -> ByteString
- Crypto.Cipher.AES128: ecb :: BlockCipher k => k -> ByteString -> ByteString
+ Crypto.Cipher.AES128: ecb :: k -> ByteString -> ByteString
- Crypto.Cipher.AES128: ecbLazy :: BlockCipher k => k -> ByteString -> ByteString
+ Crypto.Cipher.AES128: ecbLazy :: k -> ByteString -> ByteString
- Crypto.Cipher.AES128: encryptBlock :: BlockCipher k => k -> ByteString -> ByteString
+ Crypto.Cipher.AES128: encryptBlock :: k -> ByteString -> ByteString
- Crypto.Cipher.AES128: keyLength :: BlockCipher k => Tagged * k BitLength
+ Crypto.Cipher.AES128: keyLength :: Tagged * k BitLength
- Crypto.Cipher.AES128: ofb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: ofb :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: ofbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: ofbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: siv :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
+ Crypto.Cipher.AES128: siv :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- Crypto.Cipher.AES128: sivLazy :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
+ Crypto.Cipher.AES128: sivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- Crypto.Cipher.AES128: unCbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unCbc :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unCbcLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unCbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unCfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unCfb :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unCfbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unCfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unCtr :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unCtr :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unCtrLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unCtrLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unEcb :: BlockCipher k => k -> ByteString -> ByteString
+ Crypto.Cipher.AES128: unEcb :: k -> ByteString -> ByteString
- Crypto.Cipher.AES128: unEcbLazy :: BlockCipher k => k -> ByteString -> ByteString
+ Crypto.Cipher.AES128: unEcbLazy :: k -> ByteString -> ByteString
- Crypto.Cipher.AES128: unOfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unOfb :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unOfbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
+ Crypto.Cipher.AES128: unOfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- Crypto.Cipher.AES128: unSiv :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
+ Crypto.Cipher.AES128: unSiv :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- Crypto.Cipher.AES128: unSivLazy :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
+ Crypto.Cipher.AES128: unSivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- Crypto.Cipher.AES128.Internal: RKey128 :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> RawKey128
+ Crypto.Cipher.AES128.Internal: RKey128 :: {-# UNPACK #-} !Word64 -> RawKey128
- Crypto.Cipher.AES128.Internal: RKey192 :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> RawKey192
+ Crypto.Cipher.AES128.Internal: RKey192 :: {-# UNPACK #-} !Word64 -> RawKey192
- Crypto.Cipher.AES128.Internal: RKey256 :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> RawKey256
+ Crypto.Cipher.AES128.Internal: RKey256 :: {-# UNPACK #-} !Word64 -> RawKey256

Files

Benchmark/bench.hs view
@@ -1,5 +1,4 @@-import Crypto.Cipher.AES128-import Crypto.Cipher.AES+import qualified Crypto.Cipher.AES128 as AES128 import Crypto.Classes import Crypto.Types import Criterion@@ -12,11 +11,9 @@     let iv  = zeroIV         ivV = B.replicate 16 0     pt <- getEntropy (2^16)-    k  <- buildKeyIO :: IO AESKey128-    let kV = initAES (B.pack [0..15])+    k  <- buildKeyIO :: IO AES128.AESKey128+    let kV = AES.initAES (B.pack [0..15])     defaultMain-        [ bench "aes-ecb cipher-aes128" $ nf (encryptBlock k) pt-        , bench "aes-ctr cipher-aes128" $ nf (fst . ctr k iv) pt-        , bench "aes-ecb cipher-aes"    $ nf (encryptECB kV) pt-        , bench "aes-ctr cipher-aes"    $ nf (encryptCTR kV ivV) pt-        , bench "aes-gcm cipher-aes"    $ nf (fst . encryptGCM kV ivV B.empty) pt]+        [ bench "aes-ecb cipher-aes128" $ nf (AES128.encryptBlock k) pt+        , bench "aes-ctr cipher-aes128" $ nf (fst . AES128.ctr k iv) pt+        ]
Setup.hs view
@@ -1,14 +1,15 @@+{-# LANGUAGE CPP #-}+import Control.Monad (unless) import Distribution.Simple import Distribution.Simple.LocalBuildInfo-import Distribution.Simple.Setup-import Distribution.PackageDescription import Distribution.Simple.Utils import Distribution.Simple.Program import Distribution.Verbosity import System.Process-import System.Directory import System.Exit+import System.IO (hFlush, stdout) +main :: IO () main = defaultMainWithHooks hk  where  hk = simpleUserHooks { buildHook = \pd lbi uh bf -> do@@ -17,7 +18,7 @@                                             mConf  = lookupProgram ccProg (withPrograms lbi)                                             hcConf = lookupProgram hcProg (withPrograms lbi)                                             err = error "Could not determine C compiler"-                                            cc  = locationPath . programLocation  . maybe err id $ mConf+                                            _cc  = locationPath . programLocation  . maybe err id $ mConf                                             hc  = locationPath . programLocation  . maybe err id $ hcConf                                         b <- canUseAesIntrinsicsFlag hc                                         let newWithPrograms1 = userSpecifyArgs "gcc" aesArgs (withPrograms lbi)@@ -40,6 +41,30 @@                                 , "int real_main() {"                                 , "return 0; }"                                 ])-        ec <- rawSystemExitCode normal cc (aesArgsHC ++ ["-c", tmpDir ++ "/testIntrinsic.c"])+        ec <- myRawSystemExitCode normal cc (aesArgsHC ++ ["-c", tmpDir ++ "/testIntrinsic.c"])         notice normal $ "Result of NI Intrinsics Test: " ++ show (ec == ExitSuccess)         return (ec == ExitSuccess)++myRawSystemExitCode :: Verbosity -> FilePath -> [String] -> IO ExitCode+#if __GLASGOW_HASKELL__ >= 704+-- We know for sure, that if GHC >= 7.4 implies Cabal >= 1.14+myRawSystemExitCode = rawSystemExitCode+#else+-- Legacy branch:+-- We implement our own 'rawSystemExitCode', this will even work if+-- the user happens to have Cabal >= 1.14 installed with GHC 7.0 or+-- 7.2+myRawSystemExitCode verbosity path args = do+    printRawCommandAndArgs verbosity path args+    hFlush stdout+    exitcode <- rawSystem path args+    unless (exitcode == ExitSuccess) $ do+        debug verbosity $ path ++ " returned " ++ show exitcode+    return exitcode+  where+    printRawCommandAndArgs :: Verbosity -> FilePath -> [String] -> IO ()+    printRawCommandAndArgs verbosity path args+      | verbosity >= deafening = print (path, args)+      | verbosity >= verbose = putStrLn $ unwords (path : args)+      | otherwise = return ()+#endif
cipher-aes128.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                cipher-aes128-version:             0.7.0.1+version:             0.7.0.2 synopsis:            AES and common modes using AES-NI when available. description:         Cipher-aes128 is an implementation of AES and common modes of operation.  It borrows Hanquez's C AES code (see 'cipher-aes') but                      is unique due to including compile-time detection of@@ -20,7 +20,8 @@ build-type:          Custom -- build-type:          Simple -- ^^^ For HaLVM-cabal-version:       >=1.12+cabal-version:       >=1.10+tested-with:         GHC==7.10.3  extra-source-files:       ./cbits/*.h, ./cbits/*.c                         , AUTHORS@@ -63,9 +64,10 @@   type:         exitcode-stdio-1.0   hs-source-dirs:       . Benchmark   main-is:              bench.hs-  build-depends:        base < 5, criterion, crypto-api, entropy, bytestring, tagged, cereal, cipher-aes+  build-depends:        base < 5, criterion, crypto-api, entropy, bytestring, tagged, cereal   ghc-options:          -O2   include-dirs:        cbits+  default-language:    Haskell2010   c-sources:           ./cbits/aes.c                      , ./cbits/aes_generic.c                      , ./cbits/aes_x86ni.c