Closed TomMD closed 10 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.
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.
now it's available in the crypto-cipher-types. Probably need to add some more methods to manipulate them but add is done.
There's no easy/obvious way to increment the IV.