=pod =head1 NAME BN_mod_exp_mont, BN_mod_exp_mont_consttime, BN_mod_exp_mont_consttime_x2 - Montgomery exponentiation =head1 SYNOPSIS #include int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1, const BIGNUM *m1, BN_MONT_CTX *in_mont1, BIGNUM *rr2, const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m2, BN_MONT_CTX *in_mont2, BN_CTX *ctx); =head1 DESCRIPTION BN_mod_exp_mont() computes I to the I

-th power modulo I (C) using Montgomery multiplication. I is a Montgomery context and can be NULL. In the case I is NULL, it will be initialized within the function, so you can save time on initialization if you provide it in advance. BN_mod_exp_mont_consttime() computes I to the I

-th power modulo I (C) using Montgomery multiplication. It is a variant of L that uses fixed windows and the special precomputation memory layout to limit data-dependency to a minimum to protect secret exponents. It is called automatically when L is called with parameters I, I

, I, any of which have B flag. BN_mod_exp_mont_consttime_x2() computes two independent exponentiations I to the I-th power modulo I (C) and I to the I-th power modulo I (C) using Montgomery multiplication. For some fixed and equal modulus sizes I and I it uses optimizations that allow to speedup two exponentiations. In all other cases the function reduces to two calls of L. =head1 RETURN VALUES For all functions 1 is returned for success, 0 on error. The error codes can be obtained by L. =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L. =cut