[#BN_MONT_CTX_set_locked]
= BN&lowbar;MONT&lowbar;CTX&lowbar;set&lowbar;locked
:mrdocs:

Lazily initialize a shared Montgomery context under a lock&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BN_MONT_CTX.adoc[BN&lowbar;MONT&lowbar;CTX]*
BN&lowbar;MONT&lowbar;CTX&lowbar;set&lowbar;locked(
    xref:BN_MONT_CTX.adoc[BN&lowbar;MONT&lowbar;CTX]** pmont,
    xref:CRYPTO_RWLOCK.adoc[CRYPTO&lowbar;RWLOCK]* lock,
    xref:BIGNUM.adoc[BIGNUM] const* mod,
    xref:BN_CTX.adoc[BN&lowbar;CTX]* ctx);
----

== Return Value

The initialized Montgomery context at &ast;`pmont,` or NULL on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *pmont*
| Address of the Montgomery context pointer&semi; allocated and set on first use&period;
| *lock*
| Read&sol;write lock serializing initialization of &ast;`pmont&period;`
| *mod*
| Modulus used to build the Montgomery context&period;
| *ctx*
| BN&lowbar;CTX scratch space for the initialization&period;
|===


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