BN_mod_exp_mont

Compute modular exponentiation using Montgomery reduction: r = (a ^ p) mod m.

Synopsis

Declared in <openssl/bn.h>

int
BN_mod_exp_mont(
    BIGNUM* r,
    BIGNUM const* a,
    BIGNUM const* p,
    BIGNUM const* m,
    BN_CTX* ctx,
    BN_MONT_CTX* m_ctx);

Return Value

1 on success, or 0 on error.

Parameters

NameDescription
rDestination for the result.
aBase.
pExponent.
mModulus (must be odd).
ctxBN_CTX scratch space.
m_ctxMontgomery context for m, or NULL to build one temporarily.