pub unsafe extern "C" fn Hacl_Bignum64_mod_exp_consttime_precomp(
    k: *mut Hacl_Bignum_MontArithmetic_bn_mont_ctx_u64,
    a: *mut u64,
    bBits: u32,
    b: *mut u64,
    res: *mut u64
)
Expand description

Write a ^ b mod n in res.

The arguments a and the outparam res are meant to be len limbs in size, i.e. uint64_t[len]. The argument k is a montgomery context obtained through Hacl_Bignum64_mont_ctx_init.

The argument b is a bignum of any size, and bBits is an upper bound on the number of significant bits of b. A tighter bound results in faster execution time. When in doubt, the number of bits for the bignum size is always a safe default, e.g. if b is a 4096-bit bignum, bBits should be 4096.

This function is constant-time over its argument b, at the cost of a slower execution time than mod_exp_vartime_*.

Before calling this function, the caller will need to ensure that the following preconditions are observed. • b < pow2 bBits • a < n