vincenthz / hs-cipher-aes

DEPRECATED - use cryptonite - a comprehensive fast AES implementation for haskell that supports aesni and advanced cryptographic modes.
Other
21 stars 15 forks source link

No way to increment the IV #4

Closed TomMD closed 10 years ago

TomMD commented 11 years ago

There's no easy/obvious way to increment the IV.

vincenthz commented 11 years ago

a valid point, i need to think of something for this. it will probably end up going in the crypto-types repository, and it need to allow arbitrary increment values. I've got some code for this in cprng-aes but it's inefficient.

TomMD commented 11 years ago

My use of GCM actually uses Word64 and stack allocation. Representative Pseudo Haskell:

type ByteStringPtr = Ptr Word8
lowLevelAES_GCM :: Key -> Word64 -> ByteStringPtr -> ByteStringPtr -> IO ()
lowLevelAES_GCM k ctr pt ct =
   alloca word64Size $ \ptr -> do
       pokeBE ptr ctr
       aes_gcm k ptr pt ct

I'm exploring such a aes_gcm api in my knock-off "cipher-aes128" package.

vincenthz commented 10 years ago

now it's available in the crypto-cipher-types. Probably need to add some more methods to manipulate them but add is done.