From 19b3e97caf561811cebf668302718c2ed222139a Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Mon, 15 May 2023 17:19:36 -0400
Subject: [PATCH] un-nail AES128 with ScopedTypeVariables and explicit forall

---
 src/Tahoe/SDMF/Internal/Encoding.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Tahoe/SDMF/Internal/Encoding.hs b/src/Tahoe/SDMF/Internal/Encoding.hs
index 9df4d7e..e9f66dc 100644
--- a/src/Tahoe/SDMF/Internal/Encoding.hs
+++ b/src/Tahoe/SDMF/Internal/Encoding.hs
@@ -1,10 +1,11 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
 {- | Implement the scheme for encoding ciphertext into SDMF shares (and
  decoding it again).
 -}
 module Tahoe.SDMF.Internal.Encoding where
 
 import Control.Monad.IO.Class (MonadIO (liftIO))
-import Crypto.Cipher.AES (AES128)
 import Crypto.Cipher.Types (BlockCipher (blockSize), IV, makeIV)
 import Crypto.Random (MonadRandom (getRandomBytes))
 import Data.Bifunctor (Bifunctor (bimap))
@@ -18,10 +19,9 @@ import Tahoe.SDMF.Internal.Capability (Reader (..), Writer (..), deriveReader)
 import qualified Tahoe.SDMF.Internal.Keys as Keys
 import Tahoe.SDMF.Internal.Share (HashChain (HashChain), Share (..))
 
---- XXX Not sure why I have to nail down AES128 here
-randomIV :: MonadRandom m => m (Maybe (IV AES128))
+randomIV :: forall c m. (BlockCipher c, MonadRandom m) => m (Maybe (IV c))
 -- XXX Secure enough random source?
-randomIV = (makeIV :: B.ByteString -> Maybe (IV AES128)) <$> getRandomBytes (blockSize (undefined :: AES128))
+randomIV = (makeIV :: B.ByteString -> Maybe (IV c)) <$> getRandomBytes (blockSize (undefined :: c))
 
 {- | Given a pre-determined key pair and sequence number, encode some
  ciphertext into a collection of SDMF shares.
-- 
GitLab