-- |
-- Module      : SecureBlock
-- License     : BSD-3-Clause
-- Copyright   : (c) 2025 Olivier Chéron
--
-- Use a type-level annotation to decide between a scrubbed block or a regular
-- block
--
{-# LANGUAGE CPP #-}
module SecureBlock
    ( SecureBlock, create, index, iterModify, new, thaw
    , unsafeCast, unsafeFreeze, toNormalForm
#ifdef ML_KEM_TESTING
    , eq, Marking.showsPrec, toList, SecureBlock.length
#endif
    ) where

import Base
import Block (MutableBlock)
import Marking
import qualified Block

iterModify :: (PrimType ty, PrimMonad prim) => (ty -> ty) -> MutableBlock ty (PrimState prim) -> prim ()
iterModify :: forall ty (prim :: * -> *).
(PrimType ty, PrimMonad prim) =>
(ty -> ty) -> MutableBlock ty (PrimState prim) -> prim ()
iterModify = (ty -> ty) -> MutableBlock ty (PrimState prim) -> prim ()
forall ty (prim :: * -> *).
(PrimType ty, PrimMonad prim) =>
(ty -> ty) -> MutableBlock ty (PrimState prim) -> prim ()
Block.iterModify

#ifdef ML_KEM_TESTING
length :: (Classified marking, PrimType ty) => SecureBlock marking ty -> CountOf ty
length = lengthBlock
#endif