val mod_exp_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
let mod_exp_vartime len n a bBits b res =
  BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res
val mod_exp_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
let mod_exp_vartime len n a bBits b res =
BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res
Hacl.Bignum64.fst.checked
prims.fst.checked Hacl.Bignum.Montgomery.fsti.checked Hacl.Bignum.MontArithmetic.fsti.checked Hacl.Bignum.ModReduction.fst.checked Hacl.Bignum.ModInv.fst.checked Hacl.Bignum.Exponentiation.fsti.checked Hacl.Bignum.Convert.fst.checked Hacl.Bignum.AlmostMontgomery.fsti.checked Hacl.Bignum.fsti.checked FStar.Pervasives.fsti.checked FStar.Mul.fst.checked
Hacl.Bignum64.fst
Hacl.Bignum.meta_len Hacl.Bignum64.t_limbs Hacl.Bignum.Definitions.lbignum Lib.IntTypes.size_t Prims.b2t Prims.op_LessThanOrEqual FStar.Mul.op_Star Lib.IntTypes.bits Lib.IntTypes.v Lib.IntTypes.U32 Lib.IntTypes.PUB Hacl.Bignum.Definitions.blocks0 Lib.IntTypes.size Lib.IntTypes.max_size_t Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_check Hacl.Bignum64.ke Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_vt Prims.bool
module Hacl.Bignum64

open FStar.Mul

module BN = Hacl.Bignum
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module AM = Hacl.Bignum.AlmostMontgomery
module MA = Hacl.Bignum.MontArithmetic
module BI = Hacl.Bignum.ModInv
module BM = Hacl.Bignum.Montgomery

#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"

inline_for_extraction noextract
let kam (len:BN.meta_len t_limbs) =
  AM.mk_runtime_almost_mont #t_limbs len

inline_for_extraction noextract
let ke (len:BN.meta_len t_limbs) =
  BE.mk_runtime_exp #t_limbs len

let add len a b res =
  (ke len).BE.bn.BN.add a b res

let sub len a b res =
  (ke len).BE.bn.BN.sub a b res

let add_mod len n a b res =
  (ke len).BE.bn.BN.add_mod_n n a b res

let sub_mod len n a b res =
  (ke len).BE.bn.BN.sub_mod_n n a b res

let mul len a b res =
  (ke len).BE.bn.BN.mul a b res

let sqr len a res =
  (ke len).BE.bn.BN.sqr a res

[@CInline]
let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len =
  BR.bn_mod_slow_precomp (kam len)

let mod len n a res =
  BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res
val mod_exp_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
len: Hacl.Bignum.meta_len Hacl.Bignum64.t_limbs
  -> Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum64.t_limbs len