diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+# CHANGELOG for crypton
+
+## 1.0.5
+
+* Setter/Getter for ChaCha counter.
+  [#63](https://github.com/kazu-yamamoto/crypton/pull/63)
+* Add simple interface to generate full blocks
+  [#60](https://github.com/kazu-yamamoto/crypton/pull/60)
+* Avoid `ghc-prim` dependency.
+  [#61](https://github.com/kazu-yamamoto/crypton/pull/61)
+
 ## 1.0.4
 
 * Ed448.sign: avoid extra re-derive of public key.
diff --git a/Crypto/Cipher/ChaCha.hs b/Crypto/Cipher/ChaCha.hs
--- a/Crypto/Cipher/ChaCha.hs
+++ b/Crypto/Cipher/ChaCha.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
 {-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 
@@ -18,6 +19,10 @@
     initializeSimple,
     generateSimple,
     StateSimple,
+
+    -- * Seeking and cursor for DRG purposes
+    generateSimpleBlock,
+    ChaChaState (..),
 ) where
 
 import Crypto.Internal.ByteArray (
@@ -39,6 +44,54 @@
 newtype StateSimple = StateSimple ScrubbedBytes -- just ChaCha's state
     deriving (NFData)
 
+class ChaChaState a where
+    getCounter64 :: a -> Word64
+    setCounter64 :: Word64 -> a -> a
+    getCounter32 :: a -> Word32
+    setCounter32 :: Word32 -> a -> a
+
+instance ChaChaState State where
+    getCounter64 (State st) = getCounter64' st ccrypton_chacha_get_state
+    setCounter64 n (State st) = State $ setCounter64' n st ccrypton_chacha_get_state
+    getCounter32 (State st) = getCounter32' st ccrypton_chacha_get_state
+    setCounter32 n (State st) = State $ setCounter32' n st ccrypton_chacha_get_state
+
+instance ChaChaState StateSimple where
+    getCounter64 (StateSimple st) = getCounter64' st id
+    setCounter64 n (StateSimple st) = StateSimple $ setCounter64' n st id
+    getCounter32 (StateSimple st) = getCounter32' st id
+    setCounter32 n (StateSimple st) = StateSimple $ setCounter32' n st id
+
+getCounter64' :: ScrubbedBytes -> (Ptr a -> Ptr StateSimple) -> Word64
+getCounter64' currSt conv =
+    unsafeDoIO $ do
+        B.withByteArray currSt $ \stPtr ->
+            ccrypton_chacha_counter64 $ conv stPtr
+
+getCounter32' :: ScrubbedBytes -> (Ptr a -> Ptr StateSimple) -> Word32
+getCounter32' currSt conv =
+    unsafeDoIO $ do
+        B.withByteArray currSt $ \stPtr ->
+            ccrypton_chacha_counter32 $ conv stPtr
+
+setCounter64'
+    :: Word64 -> ScrubbedBytes -> (Ptr a -> Ptr StateSimple) -> ScrubbedBytes
+setCounter64' newCounter prevSt conv =
+    unsafeDoIO $ do
+        newSt <- B.copy prevSt (\_ -> return ())
+        B.withByteArray newSt $ \stPtr ->
+            ccrypton_chacha_set_counter64 (conv stPtr) newCounter
+        return newSt
+
+setCounter32'
+    :: Word32 -> ScrubbedBytes -> (Ptr a -> Ptr StateSimple) -> ScrubbedBytes
+setCounter32' newCounter prevSt conv =
+    unsafeDoIO $ do
+        newSt <- B.copy prevSt (\_ -> return ())
+        B.withByteArray newSt $ \stPtr ->
+            ccrypton_chacha_set_counter32 (conv stPtr) newCounter
+        return newSt
+
 -- | Initialize a new ChaCha context with the number of rounds,
 -- the key and the nonce associated.
 initialize
@@ -163,15 +216,31 @@
             ccrypton_chacha_random 8 dstPtr stPtr (fromIntegral nbBytes)
     return (output, StateSimple newSt)
 
-foreign import ccall "crypton_chacha_init_core"
+-- | similar to 'generate' but accepts a number of rounds, and always generates
+--   64 bytes (a single block)
+generateSimpleBlock
+    :: ByteArray ba
+    => Word8
+    -> StateSimple
+    -> (ba, StateSimple)
+generateSimpleBlock nbRounds (StateSimple prevSt)
+    | nbRounds `notElem` [8, 12, 20] = error "ChaCha: rounds should be 8, 12 or 20"
+    | otherwise = unsafeDoIO $ do
+        newSt <- B.copy prevSt (\_ -> return ())
+        output <- B.alloc 64 $ \dstPtr ->
+            B.withByteArray newSt $ \stPtr ->
+                ccrypton_chacha_generate_simple_block dstPtr stPtr nbRounds
+        return (output, StateSimple newSt)
+
+foreign import ccall unsafe "crypton_chacha_init_core"
     ccrypton_chacha_init_core
         :: Ptr StateSimple -> Int -> Ptr Word8 -> Int -> Ptr Word8 -> IO ()
 
-foreign import ccall "crypton_chacha_init"
+foreign import ccall unsafe "crypton_chacha_init"
     ccrypton_chacha_init
         :: Ptr State -> Int -> Int -> Ptr Word8 -> Int -> Ptr Word8 -> IO ()
 
-foreign import ccall "crypton_xchacha_init"
+foreign import ccall unsafe "crypton_xchacha_init"
     ccrypton_xchacha_init :: Ptr State -> Int -> Ptr Word8 -> Ptr Word8 -> IO ()
 
 foreign import ccall "crypton_chacha_combine"
@@ -182,3 +251,22 @@
 
 foreign import ccall "crypton_chacha_random"
     ccrypton_chacha_random :: Int -> Ptr Word8 -> Ptr StateSimple -> CUInt -> IO ()
+
+foreign import ccall unsafe "crypton_chacha_counter64"
+    ccrypton_chacha_counter64 :: Ptr StateSimple -> IO Word64
+
+foreign import ccall unsafe "crypton_chacha_set_counter64"
+    ccrypton_chacha_set_counter64 :: Ptr StateSimple -> Word64 -> IO ()
+
+foreign import ccall unsafe "crypton_chacha_counter32"
+    ccrypton_chacha_counter32 :: Ptr StateSimple -> IO Word32
+
+foreign import ccall unsafe "crypton_chacha_set_counter32"
+    ccrypton_chacha_set_counter32 :: Ptr StateSimple -> Word32 -> IO ()
+
+foreign import ccall unsafe "crypton_chacha_generate_simple_block"
+    ccrypton_chacha_generate_simple_block
+        :: Ptr Word8 -> Ptr StateSimple -> Word8 -> IO ()
+
+foreign import capi unsafe "crypton_chacha.h crypton_chacha_get_state"
+    ccrypton_chacha_get_state :: Ptr State -> Ptr StateSimple
diff --git a/Crypto/Internal/CompatPrim.hs b/Crypto/Internal/CompatPrim.hs
--- a/Crypto/Internal/CompatPrim.hs
+++ b/Crypto/Internal/CompatPrim.hs
@@ -28,9 +28,9 @@
 #endif
 
 #if __GLASGOW_HASKELL__ >= 902
-import GHC.Prim
+import GHC.Exts
 #else
-import GHC.Prim hiding (Word32#)
+import GHC.Exts hiding (Word32#)
 type Word32# = Word#
 #endif
 
diff --git a/Crypto/Internal/Endian.hs b/Crypto/Internal/Endian.hs
new file mode 100644
--- /dev/null
+++ b/Crypto/Internal/Endian.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE CPP #-}
+
+-- |
+-- Module      : Crypto.Internal.Endian
+-- License     : BSD-style
+-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
+-- Stability   : stable
+-- Portability : good
+module Crypto.Internal.Endian (
+    fromBE64,
+    toBE64,
+    fromLE64,
+    toLE64,
+) where
+
+import Crypto.Internal.Compat (byteSwap64)
+import Data.Word (Word64)
+
+#ifdef ARCH_IS_LITTLE_ENDIAN
+fromLE64 :: Word64 -> Word64
+fromLE64 = id
+
+toLE64 :: Word64 -> Word64
+toLE64 = id
+
+fromBE64 :: Word64 -> Word64
+fromBE64 = byteSwap64
+
+toBE64 :: Word64 -> Word64
+toBE64 = byteSwap64
+#else
+fromLE64 :: Word64 -> Word64
+fromLE64 = byteSwap64
+
+toLE64 :: Word64 -> Word64
+toLE64 = byteSwap64
+
+fromBE64 :: Word64 -> Word64
+fromBE64 = id
+
+toBE64 :: Word64 -> Word64
+toBE64 = id
+#endif
diff --git a/Crypto/Internal/WordArray.hs b/Crypto/Internal/WordArray.hs
--- a/Crypto/Internal/WordArray.hs
+++ b/Crypto/Internal/WordArray.hs
@@ -38,8 +38,7 @@
 import Crypto.Internal.CompatPrim
 import Data.Bits (xor)
 import Data.Word
-import GHC.Prim
-import GHC.Types
+import GHC.Base
 import GHC.Word
 
 -- | Array of Word8
diff --git a/Crypto/PubKey/RSA/PKCS15.hs b/Crypto/PubKey/RSA/PKCS15.hs
--- a/Crypto/PubKey/RSA/PKCS15.hs
+++ b/Crypto/PubKey/RSA/PKCS15.hs
@@ -421,7 +421,9 @@
     => Maybe hashAlg
     -> PublicKey
     -> ByteString
+    -- ^ Message
     -> ByteString
+    -- ^ Signature
     -> Bool
 verify hashAlg pk m sm =
     case makeSignature hashAlg (public_size pk) m of
diff --git a/cbits/crypton_chacha.c b/cbits/crypton_chacha.c
--- a/cbits/crypton_chacha.c
+++ b/cbits/crypton_chacha.c
@@ -260,9 +260,12 @@
 	for (; bytes >= 64; bytes -= 64, src += 64, dst += 64) {
 		/* generate new chunk and update state */
 		chacha_core(ctx->nb_rounds, &out, st);
-		st->d[12] += 1;
-		if (st->d[12] == 0)
-			st->d[13] += 1;
+		uint32_t t0 = le32_to_cpu(st->d[12]);
+		st->d[12] = cpu_to_le32(t0 + 1);
+		if (st->d[12] == 0) {
+			uint32_t t1 = le32_to_cpu(st->d[13]);
+			st->d[13] = cpu_to_le32(t1 + 1);
+		}
 
 		for (i = 0; i < 64; ++i)
 			dst[i] = src[i] ^ out.b[i];
@@ -271,14 +274,17 @@
 	if (bytes > 0) {
 		/* generate new chunk and update state */
 		chacha_core(ctx->nb_rounds, &out, st);
-		st->d[12] += 1;
-		if (st->d[12] == 0)
-			st->d[13] += 1;
+		uint32_t t0 = le32_to_cpu(st->d[12]);
+		st->d[12] = cpu_to_le32(t0 + 1);
+		if (st->d[12] == 0) {
+			uint32_t t1 = le32_to_cpu(st->d[13]);
+			st->d[13] = cpu_to_le32(t1 + 1);
+		}
 
 		/* xor as much as needed */
 		for (i = 0; i < bytes; i++)
 			dst[i] = src[i] ^ out.b[i];
-		
+
 		/* copy the left over in the buffer */
 		ctx->prev_len = 64 - bytes;
 		ctx->prev_ofs = i;
@@ -288,6 +294,41 @@
 	}
 }
 
+uint64_t crypton_chacha_counter64(crypton_chacha_state *st)
+{
+	uint64_t result = ((uint64_t) le32_to_cpu(st->d[12]))
+		| (((uint64_t) le32_to_cpu(st->d[13])) << 32);
+	return result;
+}
+
+uint32_t crypton_chacha_counter32(crypton_chacha_state *st)
+{
+	return le32_to_cpu(st->d[12]);
+}
+
+void crypton_chacha_set_counter64(crypton_chacha_state *st, uint64_t block_counter)
+{
+	uint64_t current_counter;
+	current_counter = ((uint64_t) le32_to_cpu(st->d[12]))
+		| (((uint64_t) le32_to_cpu(st->d[13])) << 32);
+
+	if (current_counter == block_counter)
+		return;
+
+	st->d[12] = cpu_to_le32((uint32_t) block_counter);
+	st->d[13] = cpu_to_le32((uint32_t) (block_counter >> 32));
+}
+
+void crypton_chacha_set_counter32(crypton_chacha_state *st, uint32_t block_counter)
+{
+	uint32_t current_counter = le32_to_cpu(st->d[12]);
+
+	if (current_counter == block_counter)
+		return;
+
+	st->d[12] = cpu_to_le32(block_counter);
+}
+
 void crypton_chacha_generate(uint8_t *dst, crypton_chacha_context *ctx, uint32_t bytes)
 {
 	crypton_chacha_state *st;
@@ -319,18 +360,24 @@
 		for (; bytes >= 64; bytes -= 64, dst += 64) {
 			/* generate new chunk and update state */
 			chacha_core(ctx->nb_rounds, (block *) dst, st);
-			st->d[12] += 1;
-			if (st->d[12] == 0)
-				st->d[13] += 1;
+			uint32_t t0 = le32_to_cpu(st->d[12]);
+			st->d[12] = cpu_to_le32(t0 + 1);
+			if (st->d[12] == 0) {
+				uint32_t t1 = le32_to_cpu(st->d[13]);
+				st->d[13] = cpu_to_le32(t1 + 1);
+			}
 		}
 	} else {
 		/* xor new 64-bytes chunks and store the left over if any */
 		for (; bytes >= 64; bytes -= 64, dst += 64) {
 			/* generate new chunk and update state */
 			chacha_core(ctx->nb_rounds, &out, st);
-			st->d[12] += 1;
-			if (st->d[12] == 0)
-				st->d[13] += 1;
+			uint32_t t0 = le32_to_cpu(st->d[12]);
+			st->d[12] = cpu_to_le32(t0 + 1);
+			if (st->d[12] == 0) {
+				uint32_t t1 = le32_to_cpu(st->d[13]);
+				st->d[13] = cpu_to_le32(t1 + 1);
+			}
 
 			for (i = 0; i < 64; ++i)
 				dst[i] = out.b[i];
@@ -340,19 +387,43 @@
 	if (bytes > 0) {
 		/* generate new chunk and update state */
 		chacha_core(ctx->nb_rounds, &out, st);
-		st->d[12] += 1;
-		if (st->d[12] == 0)
-			st->d[13] += 1;
+		uint32_t t0 = le32_to_cpu(st->d[12]);
+		st->d[12] = cpu_to_le32(t0 + 1);
+		if (st->d[12] == 0) {
+			uint32_t t1 = le32_to_cpu(st->d[13]);
+			st->d[13] = cpu_to_le32(t1 + 1);
+		}
 
 		/* xor as much as needed */
 		for (i = 0; i < bytes; i++)
 			dst[i] = out.b[i];
-		
+
 		/* copy the left over in the buffer */
 		ctx->prev_len = 64 - bytes;
 		ctx->prev_ofs = i;
 		for (; i < 64; i++)
 			ctx->prev[i] = out.b[i];
+	}
+}
+
+void crypton_chacha_generate_simple_block(uint8_t *dst, crypton_chacha_state *st, uint8_t rounds)
+{
+	if (ALIGNED64(dst)) {
+		chacha_core(rounds, (block *) dst, st);
+	} else {
+		block out;
+		int i;
+		chacha_core(rounds, &out, st);
+		for (i = 0; i < 64; ++i) {
+			dst[i] = out.b[i];
+		}
+	}
+
+	uint32_t t0 = le32_to_cpu(st->d[12]);
+	st->d[12] = cpu_to_le32(t0 + 1);
+	if (st->d[12] == 0) {
+		uint32_t t1 = le32_to_cpu(st->d[13]);
+		st->d[13] = cpu_to_le32(t1 + 1);
 	}
 }
 
diff --git a/cbits/crypton_chacha.h b/cbits/crypton_chacha.h
--- a/cbits/crypton_chacha.h
+++ b/cbits/crypton_chacha.h
@@ -51,5 +51,10 @@
 void crypton_xchacha_init(crypton_chacha_context *ctx, uint8_t nb_rounds, const uint8_t *key, const uint8_t *iv);
 void crypton_chacha_combine(uint8_t *dst, crypton_chacha_context *st, const uint8_t *src, uint32_t bytes);
 void crypton_chacha_generate(uint8_t *dst, crypton_chacha_context *st, uint32_t bytes);
-
+uint64_t crypton_chacha_counter64(crypton_chacha_state *st);
+uint32_t crypton_chacha_counter32(crypton_chacha_state *st);
+void crypton_chacha_set_counter64(crypton_chacha_state *st, uint64_t block_counter);
+void crypton_chacha_set_counter32(crypton_chacha_state *st, uint32_t block_counter);
+void crypton_chacha_generate_simple_block(uint8_t *dst, crypton_chacha_state *st, uint8_t rounds);
+#define crypton_chacha_get_state(context) (&((crypton_chacha_context *) context)->st)
 #endif
diff --git a/crypton.cabal b/crypton.cabal
--- a/crypton.cabal
+++ b/crypton.cabal
@@ -1,13 +1,13 @@
 cabal-version:      1.18
 name:               crypton
-version:            1.0.4
+version:            1.0.5
 license:            BSD3
 license-file:       LICENSE
 copyright:          Vincent Hanquez <vincent@snarc.org>
 maintainer:         Kazu Yamamoto <kazu@iij.ad.jp>
 author:             Vincent Hanquez <vincent@snarc.org>
 stability:          experimental
-tested-with:        ghc ==9.2.2 ghc ==9.0.2 ghc ==8.10.7 ghc ==8.8.4
+tested-with:        GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.2
 homepage:           https://github.com/kazu-yamamoto/crypton
 bug-reports:        https://github.com/kazu-yamamoto/crypton/issues
 synopsis:           Cryptography Primitives sink
@@ -41,29 +41,29 @@
 extra-source-files:
     cbits/*.h
     cbits/aes/*.h
-    cbits/ed25519/*.h
+    cbits/aes/x86ni_impl.c
+    cbits/argon2/*.c
+    cbits/argon2/*.h
+    cbits/blake2/ref/*.h
+    cbits/blake2/sse/*.h
+    cbits/crypton_hash_prefix.c
+    cbits/decaf/ed448goldilocks/decaf.c
+    cbits/decaf/ed448goldilocks/decaf_tables.c
     cbits/decaf/include/*.h
-    cbits/decaf/include/decaf/*.h
     cbits/decaf/include/arch_32/*.h
     cbits/decaf/include/arch_ref64/*.h
+    cbits/decaf/include/decaf/*.h
+    cbits/decaf/p448/*.h
     cbits/decaf/p448/arch_32/*.h
     cbits/decaf/p448/arch_ref64/*.h
-    cbits/decaf/p448/*.h
-    cbits/decaf/ed448goldilocks/decaf_tables.c
-    cbits/decaf/ed448goldilocks/decaf.c
+    cbits/ed25519/*.h
     cbits/include32/p256/*.h
     cbits/include64/p256/*.h
-    cbits/blake2/ref/*.h
-    cbits/blake2/sse/*.h
-    cbits/argon2/*.h
-    cbits/argon2/*.c
-    cbits/aes/x86ni_impl.c
-    cbits/crypton_hash_prefix.c
     tests/*.hs
 
 extra-doc-files:
-    README.md
     CHANGELOG.md
+    README.md
 
 source-repository head
     type:     git
@@ -121,12 +121,13 @@
     manual:      True
 
 library
+    -- cabal-fmt: expand . -CHANGELOG -CONTRIBUTING -Crypto.Math.Polynomial -Crypto.Random.Entropy.RDRand -Crypto.Random.Entropy.Unix -Crypto.Random.Entropy.Windows -LICENSE -Makefile -QA -README -Setup -Crypto.Cipher.Blowfish.Box -Crypto.Cipher.Blowfish.Primitive -Crypto.Cipher.CAST5.Primitive -Crypto.Cipher.Camellia.Primitive -Crypto.Cipher.DES.Primitive -Crypto.Cipher.Twofish.Primitive -Crypto.Cipher.Types.AEAD -Crypto.Cipher.Types.Base -Crypto.Cipher.Types.Block -Crypto.Cipher.Types.GF -Crypto.Cipher.Types.Stream -Crypto.Cipher.Types.Utils -Crypto.ECC.Simple.Prim -Crypto.ECC.Simple.Types -Crypto.Error.Types -Crypto.Hash.Blake2 -Crypto.Hash.Blake2b -Crypto.Hash.Blake2bp -Crypto.Hash.Blake2s -Crypto.Hash.Blake2sp -Crypto.Hash.Keccak -Crypto.Hash.MD2 -Crypto.Hash.MD4 -Crypto.Hash.MD5 -Crypto.Hash.RIPEMD160 -Crypto.Hash.SHA1 -Crypto.Hash.SHA224 -Crypto.Hash.SHA256 -Crypto.Hash.SHA3 -Crypto.Hash.SHA384 -Crypto.Hash.SHA512 -Crypto.Hash.SHA512t -Crypto.Hash.SHAKE -Crypto.Hash.Skein256 -Crypto.Hash.Skein512 -Crypto.Hash.Tiger -Crypto.Hash.Types -Crypto.Hash.Whirlpool -Crypto.Internal.Builder -Crypto.Internal.ByteArray -Crypto.Internal.Compat -Crypto.Internal.CompatPrim -Crypto.Internal.DeepSeq -Crypto.Internal.Endian -Crypto.Internal.Imports -Crypto.Internal.Nat -Crypto.Internal.WordArray -Crypto.Internal.Words -Crypto.Number.Compat -Crypto.PubKey.ElGamal -Crypto.PubKey.Internal -Crypto.Random.ChaChaDRG -Crypto.Random.Entropy.Backend -Crypto.Random.Entropy.Source -Crypto.Random.HmacDRG -Crypto.Random.Probabilistic -Crypto.Random.SystemDRG -Crypto.Cipher.AES.Primitive
     exposed-modules:
         Crypto.Cipher.AES
         Crypto.Cipher.AESGCMSIV
         Crypto.Cipher.Blowfish
-        Crypto.Cipher.CAST5
         Crypto.Cipher.Camellia
+        Crypto.Cipher.CAST5
         Crypto.Cipher.ChaCha
         Crypto.Cipher.ChaChaPoly1305
         Crypto.Cipher.DES
@@ -143,11 +144,20 @@
         Crypto.ECC
         Crypto.ECC.Edwards25519
         Crypto.Error
+        Crypto.Hash
+        Crypto.Hash.Algorithms
+        Crypto.Hash.IO
+        Crypto.KDF.Argon2
+        Crypto.KDF.BCrypt
+        Crypto.KDF.BCryptPBKDF
+        Crypto.KDF.HKDF
+        Crypto.KDF.PBKDF2
+        Crypto.KDF.Scrypt
         Crypto.MAC.CMAC
-        Crypto.MAC.Poly1305
         Crypto.MAC.HMAC
         Crypto.MAC.KeyedBlake2
         Crypto.MAC.KMAC
+        Crypto.MAC.Poly1305
         Crypto.Number.Basic
         Crypto.Number.F2m
         Crypto.Number.Generate
@@ -155,91 +165,51 @@
         Crypto.Number.Nat
         Crypto.Number.Prime
         Crypto.Number.Serialize
-        Crypto.Number.Serialize.LE
         Crypto.Number.Serialize.Internal
         Crypto.Number.Serialize.Internal.LE
-        Crypto.KDF.Argon2
-        Crypto.KDF.PBKDF2
-        Crypto.KDF.Scrypt
-        Crypto.KDF.BCrypt
-        Crypto.KDF.BCryptPBKDF
-        Crypto.KDF.HKDF
-        Crypto.Hash
-        Crypto.Hash.IO
-        Crypto.Hash.Algorithms
+        Crypto.Number.Serialize.LE
         Crypto.OTP
         Crypto.PubKey.Curve25519
         Crypto.PubKey.Curve448
-        Crypto.PubKey.MaskGenFunction
         Crypto.PubKey.DH
         Crypto.PubKey.DSA
-        Crypto.PubKey.ECC.Generate
-        Crypto.PubKey.ECC.Prim
         Crypto.PubKey.ECC.DH
         Crypto.PubKey.ECC.ECDSA
+        Crypto.PubKey.ECC.Generate
         Crypto.PubKey.ECC.P256
+        Crypto.PubKey.ECC.Prim
         Crypto.PubKey.ECC.Types
         Crypto.PubKey.ECDSA
         Crypto.PubKey.ECIES
         Crypto.PubKey.Ed25519
         Crypto.PubKey.Ed448
         Crypto.PubKey.EdDSA
+        Crypto.PubKey.MaskGenFunction
+        Crypto.PubKey.Rabin.Basic
+        Crypto.PubKey.Rabin.Modified
+        Crypto.PubKey.Rabin.OAEP
+        Crypto.PubKey.Rabin.RW
+        Crypto.PubKey.Rabin.Types
         Crypto.PubKey.RSA
+        Crypto.PubKey.RSA.OAEP
         Crypto.PubKey.RSA.PKCS15
         Crypto.PubKey.RSA.Prim
         Crypto.PubKey.RSA.PSS
-        Crypto.PubKey.RSA.OAEP
         Crypto.PubKey.RSA.Types
-        Crypto.PubKey.Rabin.OAEP
-        Crypto.PubKey.Rabin.Basic
-        Crypto.PubKey.Rabin.Modified
-        Crypto.PubKey.Rabin.RW
-        Crypto.PubKey.Rabin.Types
         Crypto.Random
-        Crypto.Random.Types
         Crypto.Random.Entropy
-        Crypto.Random.EntropyPool
         Crypto.Random.Entropy.Unsafe
+        Crypto.Random.EntropyPool
+        Crypto.Random.Types
         Crypto.System.CPU
         Crypto.Tutorial
 
-    cc-options:       -std=gnu99
-    c-sources:
-        cbits/crypton_chacha.c
-        cbits/crypton_salsa.c
-        cbits/crypton_xsalsa.c
-        cbits/crypton_rc4.c
-        cbits/crypton_cpu.c
-        cbits/p256/p256.c
-        cbits/p256/p256_ec.c
-        cbits/crypton_blake2s.c
-        cbits/crypton_blake2sp.c
-        cbits/crypton_blake2b.c
-        cbits/crypton_blake2bp.c
-        cbits/crypton_poly1305.c
-        cbits/crypton_sha1.c
-        cbits/crypton_sha256.c
-        cbits/crypton_sha512.c
-        cbits/crypton_sha3.c
-        cbits/crypton_md2.c
-        cbits/crypton_md4.c
-        cbits/crypton_md5.c
-        cbits/crypton_ripemd.c
-        cbits/crypton_skein256.c
-        cbits/crypton_skein512.c
-        cbits/crypton_tiger.c
-        cbits/crypton_whirlpool.c
-        cbits/crypton_scrypt.c
-        cbits/crypton_pbkdf2.c
-        cbits/ed25519/ed25519.c
-        cbits/argon2/argon2.c
-
     other-modules:
         Crypto.Cipher.AES.Primitive
         Crypto.Cipher.Blowfish.Box
         Crypto.Cipher.Blowfish.Primitive
-        Crypto.Cipher.CAST5.Primitive
         Crypto.Cipher.Camellia.Primitive
+        Crypto.Cipher.CAST5.Primitive
         Crypto.Cipher.DES.Primitive
         Crypto.Cipher.Twofish.Primitive
         Crypto.Cipher.Types.AEAD
@@ -248,51 +218,83 @@
         Crypto.Cipher.Types.GF
         Crypto.Cipher.Types.Stream
         Crypto.Cipher.Types.Utils
+        Crypto.ECC.Simple.Prim
+        Crypto.ECC.Simple.Types
         Crypto.Error.Types
-        Crypto.Number.Compat
-        Crypto.Hash.Types
         Crypto.Hash.Blake2
-        Crypto.Hash.Blake2s
-        Crypto.Hash.Blake2sp
         Crypto.Hash.Blake2b
         Crypto.Hash.Blake2bp
+        Crypto.Hash.Blake2s
+        Crypto.Hash.Blake2sp
+        Crypto.Hash.Keccak
+        Crypto.Hash.MD2
+        Crypto.Hash.MD4
+        Crypto.Hash.MD5
+        Crypto.Hash.RIPEMD160
         Crypto.Hash.SHA1
         Crypto.Hash.SHA224
         Crypto.Hash.SHA256
+        Crypto.Hash.SHA3
         Crypto.Hash.SHA384
         Crypto.Hash.SHA512
         Crypto.Hash.SHA512t
-        Crypto.Hash.SHA3
         Crypto.Hash.SHAKE
-        Crypto.Hash.Keccak
-        Crypto.Hash.MD2
-        Crypto.Hash.MD4
-        Crypto.Hash.MD5
-        Crypto.Hash.RIPEMD160
         Crypto.Hash.Skein256
         Crypto.Hash.Skein512
         Crypto.Hash.Tiger
+        Crypto.Hash.Types
         Crypto.Hash.Whirlpool
-        Crypto.Random.Entropy.Source
-        Crypto.Random.Entropy.Backend
-        Crypto.Random.ChaChaDRG
-        Crypto.Random.HmacDRG
-        Crypto.Random.SystemDRG
-        Crypto.Random.Probabilistic
-        Crypto.PubKey.Internal
-        Crypto.PubKey.ElGamal
-        Crypto.ECC.Simple.Types
-        Crypto.ECC.Simple.Prim
         Crypto.Internal.Builder
         Crypto.Internal.ByteArray
         Crypto.Internal.Compat
         Crypto.Internal.CompatPrim
         Crypto.Internal.DeepSeq
+        Crypto.Internal.Endian
         Crypto.Internal.Imports
         Crypto.Internal.Nat
-        Crypto.Internal.Words
         Crypto.Internal.WordArray
+        Crypto.Internal.Words
+        Crypto.Number.Compat
+        Crypto.PubKey.ElGamal
+        Crypto.PubKey.Internal
+        Crypto.Random.ChaChaDRG
+        Crypto.Random.Entropy.Backend
+        Crypto.Random.Entropy.Source
+        Crypto.Random.HmacDRG
+        Crypto.Random.Probabilistic
+        Crypto.Random.SystemDRG
 
+    cc-options:       -std=gnu99
+    c-sources:
+        cbits/argon2/argon2.c
+        cbits/crypton_blake2b.c
+        cbits/crypton_blake2bp.c
+        cbits/crypton_blake2s.c
+        cbits/crypton_blake2sp.c
+        cbits/crypton_chacha.c
+        cbits/crypton_cpu.c
+        cbits/crypton_md2.c
+        cbits/crypton_md4.c
+        cbits/crypton_md5.c
+        cbits/crypton_pbkdf2.c
+        cbits/crypton_poly1305.c
+        cbits/crypton_rc4.c
+        cbits/crypton_ripemd.c
+        cbits/crypton_salsa.c
+        cbits/crypton_scrypt.c
+        cbits/crypton_sha1.c
+        cbits/crypton_sha256.c
+        cbits/crypton_sha3.c
+        cbits/crypton_sha512.c
+        cbits/crypton_skein256.c
+        cbits/crypton_skein512.c
+        cbits/crypton_tiger.c
+        cbits/crypton_whirlpool.c
+        cbits/crypton_xsalsa.c
+        cbits/ed25519/ed25519.c
+        cbits/p256/p256.c
+        cbits/p256/p256_ec.c
+
     default-language: Haskell2010
     include-dirs:
         cbits cbits/ed25519 cbits/decaf/include cbits/decaf/p448
@@ -300,11 +302,10 @@
 
     ghc-options:      -Wall -fwarn-tabs -optc-O3
     build-depends:
-        base >=4.13 && <5,
-        bytestring,
-        memory >=0.14.18,
-        basement >=0.0.6,
-        ghc-prim
+          base        >=4.13    && <5
+        , basement    >=0.0.6
+        , bytestring
+        , memory      >=0.14.18
 
     if flag(old_toolchain_inliner)
         cc-options: -fgnu89-inline
@@ -317,25 +318,25 @@
 
     if (arch(x86_64) || arch(aarch64))
         c-sources:
+            cbits/decaf/ed448goldilocks/decaf_all.c
+            cbits/decaf/ed448goldilocks/eddsa.c
+            cbits/decaf/ed448goldilocks/scalar.c
             cbits/decaf/p448/arch_ref64/f_impl.c
-            cbits/decaf/p448/f_generic.c
             cbits/decaf/p448/f_arithmetic.c
+            cbits/decaf/p448/f_generic.c
             cbits/decaf/utils.c
-            cbits/decaf/ed448goldilocks/scalar.c
-            cbits/decaf/ed448goldilocks/decaf_all.c
-            cbits/decaf/ed448goldilocks/eddsa.c
 
         include-dirs: cbits/decaf/include/arch_ref64 cbits/decaf/p448/arch_ref64
 
     else
         c-sources:
+            cbits/decaf/ed448goldilocks/decaf_all.c
+            cbits/decaf/ed448goldilocks/eddsa.c
+            cbits/decaf/ed448goldilocks/scalar.c
             cbits/decaf/p448/arch_32/f_impl.c
-            cbits/decaf/p448/f_generic.c
             cbits/decaf/p448/f_arithmetic.c
+            cbits/decaf/p448/f_generic.c
             cbits/decaf/utils.c
-            cbits/decaf/ed448goldilocks/scalar.c
-            cbits/decaf/ed448goldilocks/decaf_all.c
-            cbits/decaf/ed448goldilocks/eddsa.c
 
         include-dirs: cbits/decaf/include/arch_32 cbits/decaf/p448/arch_32
 
@@ -362,9 +363,9 @@
     if ((flag(support_aesni) && ((os(linux) || os(freebsd)) || os(osx))) && (arch(i386) || arch(x86_64)))
         cc-options: -DWITH_AESNI
         c-sources:
-            cbits/aes/x86ni.c
             cbits/aes/generic.c
             cbits/aes/gf.c
+            cbits/aes/x86ni.c
             cbits/crypton_aes.c
 
         if !flag(use_target_attributes)
@@ -384,19 +385,19 @@
 
     if (arch(x86_64) || flag(support_sse))
         c-sources:
-            cbits/blake2/sse/blake2s.c
-            cbits/blake2/sse/blake2sp.c
             cbits/blake2/sse/blake2b.c
             cbits/blake2/sse/blake2bp.c
+            cbits/blake2/sse/blake2s.c
+            cbits/blake2/sse/blake2sp.c
 
         include-dirs: cbits/blake2/sse
 
     else
         c-sources:
-            cbits/blake2/ref/blake2s-ref.c
-            cbits/blake2/ref/blake2sp-ref.c
             cbits/blake2/ref/blake2b-ref.c
             cbits/blake2/ref/blake2bp-ref.c
+            cbits/blake2/ref/blake2s-ref.c
+            cbits/blake2/ref/blake2sp-ref.c
 
         include-dirs: cbits/blake2/ref
 
@@ -415,7 +416,7 @@
     else
         other-modules: Crypto.Random.Entropy.Unix
 
-    if (impl(ghc >=0) && flag(integer-gmp))
+    if (impl(ghc) && flag(integer-gmp))
         build-depends: integer-gmp
 
     if flag(support_deepseq)
@@ -432,57 +433,59 @@
     type:             exitcode-stdio-1.0
     main-is:          Tests.hs
     hs-source-dirs:   tests
+
+    -- cabal-fmt: expand tests -Tests
     other-modules:
-        BlockCipher
-        ChaCha
         BCrypt
         BCryptPBKDF
+        BlockCipher
+        ChaCha
+        ChaChaPoly1305
         ECC
         ECC.Edwards25519
         ECDSA
         Hash
         Imports
+        KAT_AES
         KAT_AES.KATCBC
+        KAT_AES.KATCCM
         KAT_AES.KATECB
         KAT_AES.KATGCM
-        KAT_AES.KATCCM
         KAT_AES.KATOCB3
         KAT_AES.KATXTS
-        KAT_AES
         KAT_AESGCMSIV
         KAT_AFIS
         KAT_Argon2
+        KAT_Blake2
         KAT_Blowfish
-        KAT_CAST5
         KAT_Camellia
+        KAT_CAST5
+        KAT_CMAC
         KAT_Curve25519
         KAT_Curve448
         KAT_DES
         KAT_Ed25519
         KAT_Ed448
         KAT_EdDSA
-        KAT_Blake2
-        KAT_CMAC
         KAT_HKDF
         KAT_HMAC
         KAT_KMAC
         KAT_MiyaguchiPreneel
-        KAT_PBKDF2
         KAT_OTP
+        KAT_PBKDF2
+        KAT_PubKey
         KAT_PubKey.DSA
         KAT_PubKey.ECC
         KAT_PubKey.ECDSA
         KAT_PubKey.OAEP
-        KAT_PubKey.PSS
         KAT_PubKey.P256
-        KAT_PubKey.RSA
+        KAT_PubKey.PSS
         KAT_PubKey.Rabin
-        KAT_PubKey
+        KAT_PubKey.RSA
         KAT_RC4
         KAT_Scrypt
         KAT_TripleDES
         KAT_Twofish
-        ChaChaPoly1305
         Number
         Number.F2m
         Padding
@@ -496,14 +499,14 @@
         -Wall -fno-warn-orphans -fno-warn-missing-signatures -rtsopts
 
     build-depends:
-        base >=4.13 && <5,
-        bytestring,
-        memory,
-        tasty,
-        tasty-quickcheck,
-        tasty-hunit,
-        tasty-kat,
-        crypton
+          base              >=4.13 && <5
+        , bytestring
+        , crypton
+        , memory
+        , tasty
+        , tasty-hunit
+        , tasty-kat
+        , tasty-quickcheck
 
 benchmark bench-crypton
     type:             exitcode-stdio-1.0
@@ -513,10 +516,12 @@
     default-language: Haskell2010
     ghc-options:      -Wall -fno-warn-missing-signatures
     build-depends:
-        base >=4.13 && <5,
-        bytestring,
-        deepseq,
-        memory,
-        gauge,
-        random,
-        crypton
+          base        >=4.13 && <5
+        , bytestring
+        , crypton
+        , deepseq
+        , gauge
+        , memory
+        , random
+
+-- cabal-fmt: indent 4
