val nonce : i: MiTLS.Crypto.Indexing.id -> Type0
let nonce (i:I.id) = iv (I.cipherAlg_of_id i)
(**
  This interfaces provides an abstraction for the verified Hacl* Crypto.AEAD.Main module,
  using FStar.Bytes rather than buffers.
*)
module MiTLS.AEAD
open MiTLS
module HS = FStar.HyperStack //Added automatically

module I = MiTLS.Crypto.Indexing
module U32 = FStar.UInt32
module U128 = FStar.UInt128
module Plain = MiTLS.Crypto.Plain

open FStar.Bytes
open FStar.UInt32
open MiTLS.Mem
open MiTLS.Pkg

let ivlen (alg:I.cipherAlg) = 12ul

let taglen = 16ul

let iv (alg:I.cipherAlg) =
  let open FStar.Mul in
  n:U128.t { U128.v n < pow2 (8 * v (ivlen alg)) }

let aadmax =
  assert_norm (2000 <= pow2 32 - 1);
  2000ul // arbitrary; enough for TLS

type aadlen_32 = l:U32.t {l <=^ aadmax}

val keylen   : I.id -> U32.t

val statelen : I.id -> U32.t

type cipher (i:I.id) (l:nat{l + v taglen < pow2 32}) = lbytes (l + (UInt32.v taglen))

type cipher32 (i:I.id) (l:U32.t{UInt.size (v l + 16) 32}) = lbytes32 (l +^ taglen)

inline_for_extraction
val entry : i:I.id -> Type0
/
prims.fst.checked MiTLS.Pkg.fst.checked MiTLS.Mem.fst.checked MiTLS.Flag.fst.checked MiTLS.Crypto.Plain.fsti.checked MiTLS.Crypto.Indexing.fst.checked FStar.UInt32.fsti.checked FStar.UInt128.fsti.checked FStar.UInt.fsti.checked FStar.Set.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.fsti.checked FStar.Mul.fst.checked FStar.Monotonic.Heap.fsti.checked FStar.Map.fsti.checked FStar.HyperStack.fst.checked FStar.Bytes.fsti.checked
MiTLS.AEAD.fsti
i: MiTLS.Crypto.Indexing.id -> Type0
MiTLS.Crypto.Indexing.id MiTLS.AEAD.iv MiTLS.Crypto.Indexing.cipherAlg_of_id
let nonce (i: I.id) =
  
iv (I.cipherAlg_of_id i)