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

Name

Description

rr

Destination for the result.

a

Base.

p

Exponent (treated as secret for timing purposes).

m

Odd modulus.

ctx

BN_CTX for temporary storage.

in_mont

Optional precomputed Montgomery context for m, or NULL to build one.

Created with MrDocs