packages feed

cipher-aes 0.2.2 → 0.2.3

raw patch · 3 files changed

+32/−9 lines, 3 filesdep ~crypto-cipher-typesPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: crypto-cipher-types

API changes (from Hackage documentation)

+ Crypto.Cipher.AES: instance AEADModeImpl AES GCM
+ Crypto.Cipher.AES: instance BlockCipher AES
+ Crypto.Cipher.AES: instance Cipher AES

Files

Crypto/Cipher/AES.hs view
@@ -64,21 +64,44 @@ -- | AES with 256 bit key newtype AES256 = AES256 AES +instance Cipher AES where+    cipherName    _ = "AES"+    cipherKeySize _ = KeySizeEnum [16,24,32]+    cipherInit k    = initAES k+ instance Cipher AES128 where     cipherName    _ = "AES128"-    cipherKeySize _ = Just 16+    cipherKeySize _ = KeySizeFixed 16     cipherInit k    = AES128 $ initAES k  instance Cipher AES192 where     cipherName    _ = "AES192"-    cipherKeySize _ = Just 24+    cipherKeySize _ = KeySizeFixed 24     cipherInit k    = AES192 $ initAES k  instance Cipher AES256 where     cipherName    _ = "AES256"-    cipherKeySize _ = Just 32+    cipherKeySize _ = KeySizeFixed 32     cipherInit k    = AES256 $ initAES k +instance BlockCipher AES where+    blockSize _ = 16+    ecbEncrypt = encryptECB+    ecbDecrypt = decryptECB+    cbcEncrypt = encryptCBC+    cbcDecrypt = decryptCBC+    ctrCombine = encryptCTR+    xtsEncrypt = encryptXTS+    xtsDecrypt = decryptXTS+    aeadInit AEAD_GCM aes iv = Just $ AEAD aes $ AEADState $ gcmInit aes iv+    aeadInit _        _    _ = Nothing++instance AEADModeImpl AES GCM where+    aeadStateAppendHeader _ = gcmAppendAAD+    aeadStateEncrypt = gcmAppendEncrypt+    aeadStateDecrypt = gcmAppendDecrypt+    aeadStateFinalize = gcmFinish+ #define INSTANCE_BLOCKCIPHER(CSTR) \ instance BlockCipher CSTR where \     { blockSize _ = 16 \@@ -141,7 +164,7 @@     | len == 16 = initWithRounds 10     | len == 24 = initWithRounds 12     | len == 32 = initWithRounds 14-    | otherwise = error "not a valid key length"+    | otherwise = error "AES: not a valid key length (valid=16,24,32)"   where len = byteableLength k         initWithRounds nbR = AES $ unsafeCreateSecureMem (16+2*2*16*nbR) aesInit         aesInit ptr = withBytePtr k $ \ikey ->
cbits/aes_x86ni.c view
@@ -42,7 +42,7 @@ #define ALIGN_UP(addr, size) (((addr) + ((size) - 1)) & (~((size) - 1))) #define ALIGNMENT(n) __attribute__((aligned(n))) -static __m128i aes_128_key_expansion(__m128i key, __m128i keygened, int shuffle)+static __m128i aes_128_key_expansion(__m128i key, __m128i keygened, const uint8_t shuffle) { 	keygened = _mm_shuffle_epi32(keygened, shuffle); 	key = _mm_xor_si128(key, _mm_slli_si128(key, 4));
cipher-aes.cabal view
@@ -1,5 +1,5 @@ Name:                cipher-aes-Version:             0.2.2+Version:             0.2.3 Description:     Fast AES cipher implementation with advanced mode of operations.     .@@ -34,7 +34,7 @@   Build-Depends:     base >= 4 && < 5                    , bytestring                    , byteable-                   , crypto-cipher-types+                   , crypto-cipher-types >= 0.0.3                    , securemem >= 0.1.2   Exposed-modules:   Crypto.Cipher.AES   ghc-options:       -Wall -optc-O3 -fno-cse -fwarn-tabs@@ -52,7 +52,7 @@   Main-Is:           Tests.hs   Build-depends:     base >= 4 && < 5                    , cipher-aes-                   , crypto-cipher-types+                   , crypto-cipher-types >= 0.0.3                    , crypto-cipher-tests                    , bytestring                    , byteable@@ -67,7 +67,7 @@   Build-depends:     base >= 4 && < 5                    , bytestring                    , cipher-aes-                   , crypto-cipher-types+                   , crypto-cipher-types >= 0.0.3                    , crypto-cipher-benchmarks                    , criterion                    , mtl