Lazily initialize a shared Montgomery context under a lock.

Synopsis

Declared in <openssl/bn.h>

BN_MONT_CTX*
BN_MONT_CTX_set_locked(
    BN_MONT_CTX** pmont,
    CRYPTO_RWLOCK* lock,
    BIGNUM const* mod,
    BN_CTX* ctx);

Return Value

The initialized Montgomery context at *`pmont,` or NULL on error.

Parameters

Name

Description

pmont

Address of the Montgomery context pointer; allocated and set on first use.

lock

Read/write lock serializing initialization of *`pmont.`

mod

Modulus used to build the Montgomery context.

ctx

BN_CTX scratch space for the initialization.

Created with MrDocs