Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
NAME
BN_MONT_CTX_new, BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_set_locked, BN_MONT_CTX_copy, BN_mod_mul_montgomery, BN_from_montgomery, BN_to_montgomery — Montgomery multiplicationSYNOPSIS
#include <openssl/bn.h>BN_MONT_CTX_new(void);
BN_MONT_CTX_free(BN_MONT_CTX *mont);
BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx);
BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, const BIGNUM *m, BN_CTX *ctx);
BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_MONT_CTX *mont, BN_CTX *ctx);
BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx);
BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx);
DESCRIPTION
These functions implement Montgomery multiplication. They are used automatically when BN_mod_exp(3) is called with suitable input, but they may be useful when several operations are to be performed using the same modulus.Mont(a, b) := a*
b* R^-1
r=
a* R^-1
Mont(a,R^2
) = a* R