[#BN_mod_exp2_mont]
= BN&lowbar;mod&lowbar;exp2&lowbar;mont
:mrdocs:

Montgomery modular dual exponentiation&colon; r &equals; a1&circ;p1 &ast; a2&circ;p2 mod m&period;

== Synopsis

Declared in `&lt;openssl&sol;bn&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
BN&lowbar;mod&lowbar;exp2&lowbar;mont(
    xref:BIGNUM.adoc[BIGNUM]* r,
    xref:BIGNUM.adoc[BIGNUM] const* a1,
    xref:BIGNUM.adoc[BIGNUM] const* p1,
    xref:BIGNUM.adoc[BIGNUM] const* a2,
    xref:BIGNUM.adoc[BIGNUM] const* p2,
    xref:BIGNUM.adoc[BIGNUM] const* m,
    xref:BN_CTX.adoc[BN&lowbar;CTX]* ctx,
    xref:BN_MONT_CTX.adoc[BN&lowbar;MONT&lowbar;CTX]* m&lowbar;ctx);
----

== Return Value

1 on success, or 0 on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *r*
| Destination&period;
| *a1*
| First base&period;
| *p1*
| First exponent&period;
| *a2*
| Second base&period;
| *p2*
| Second exponent&period;
| *m*
| Odd modulus matching `m&lowbar;ctx&period;`
| *ctx*
| BN&lowbar;CTX scratch space&period;
| *m&lowbar;ctx*
| Montgomery context for `m&period;`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
