BN_mod_exp_mont_consttime

Compute modular exponentiation in constant time: rr = (a ^ p) mod m.

Synopsis

Declared in <openssl/bn.h>

int
BN_mod_exp_mont_consttime(
    BIGNUM* rr,
    BIGNUM const* a,
    BIGNUM const* p,
    BIGNUM const* m,
    BN_CTX* ctx,
    BN_MONT_CTX* in_mont);

Return Value

1 on success, or 0 on error.

Parameters

NameDescription
rrDestination for the result.
aBase.
pExponent (treated as secret for timing purposes).
mOdd modulus.
ctxBN_CTX for temporary storage.
in_montOptional precomputed Montgomery context for m, or NULL to build one.