![]() | ![]() | ||||||||||||||
| |||||||||||||||
| BN_mod_mul_montgomery(3)
NAMEBN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_init, BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, BN_from_montgomery, BN_to_montgomery - Montgomery multiplication
SYNOPSIS#include <openssl/bn.h> BN_MONT_CTX *BN_MONT_CTX_new(void); void BN_MONT_CTX_init(BN_MONT_CTX *ctx); void BN_MONT_CTX_free(BN_MONT_CTX *mont); int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
BN_MONT_CTX *mont, BN_CTX *ctx);
int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont,
BN_CTX *ctx);
int BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont,
BN_CTX *ctx);
DESCRIPTIONThese 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.
For all functions, ctx is a previously allocated BN_CTX used for temporary variables. The BN_MONT_CTX structure is defined as follows: typedef struct bn_mont_ctx_st
{
int ri;
BIGNUM RR;
BIGNUM N;
BIGNUM Ni;
BN_ULONG n0;
int flags;
} BN_MONT_CTX;
RETURN VALUES
For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).
SEE ALSObn(3), err(3), BN_add(3), BN_CTX_new(3)
HISTORY
| ||||||||||||||