Manual Pages for UNIX Darwin command on man BN_MONT_CTX_free
MyWebUniversity

Manual Pages for UNIX Darwin command on man BN_MONT_CTX_free

BNmodmulmontgomery(3) OpenSSL BNmodmulmontgomery(3)

NAME

BNmodmulmontgomery, BNMONTCTXnew, BNMONTCTXinit, BNMONTCTXfree, BNMONTCTXset, BNMONTCTXcopy,

BNfrommontgomery, BNtomontgomery - Montgomery multiplication

SYNOPSIS

#include

BNMONTCTX *BNMONTCTXnew(void); void BNMONTCTXinit(BNMONTCTX *ctx); void BNMONTCTXfree(BNMONTCTX *mont); int BNMONTCTXset(BNMONTCTX *mont, const BIGNUM *m, BNCTX *ctx); BNMONTCTX *BNMONTCTXcopy(BNMONTCTX *to, BNMONTCTX *from); int BNmodmulmontgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, BNMONTCTX *mont, BNCTX *ctx); int BNfrommontgomery(BIGNUM *r, BIGNUM *a, BNMONTCTX *mont, BNCTX *ctx); int BNtomontgomery(BIGNUM *r, BIGNUM *a, BNMONTCTX *mont, BNCTX *ctx);

DESCRIPTION

These functions implement Montgomery multiplication. They are used automatically when BNmodexp(3) is called with suitable input, but they may be useful when several operations are to be performed using the same modulus. BNMONTCTXnew() allocates and initializes a BBNNMMOONNTTCCTTXX structure. BNMONTCTXinit() initializes an existing uninitialized BBNNMMOONNTTCCTTXX. BNMONTCTXset() sets up the mont structure from the modulus m by precomputing its inverse and a value R. BNMONTCTXcopy() copies the BBNNMMOONNTTCCTTXX from to to. BNMONTCTXfree() frees the components of the BBNNMMOONNTTCCTTXX, and, if it was created by BNMONTCTXnew(), also the structure itself.

BNmodmulmontgomery() computes Mont(a,b):=a*b*R^-1 and places the

result in r.

BNfrommontgomery() performs the Montgomery reduction r = a*R^-1.

BNtomontgomery() computes Mont(a,R^2), i.e. a*R. Note that a must be

non-negative and smaller than the modulus.

For all functions, ctx is a previously allocated BBNNCCTTXX used for temporary variables. The BBNNMMOONNTTCCTTXX structure is defined as follows: typedef struct bnmontctxst { int ri; /* number of bits in R */ BIGNUM RR; /* R^2 (used to convert to Montgomery form) */ BIGNUM N; /* The modulus */

BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1

* (Ni is only stored for bignum algorithm) */ BNULONG n0; /* least significant word of Ni */ int flags; } BNMONTCTX; BNtomontgomery() is a macro.

RETURN VALUES

BNMONTCTXnew() returns the newly allocated BBNNMMOONNTTCCTTXX, and NULL on error. BNMONTCTXinit() and BNMONTCTXfree() have no return values. For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by ERRgeterror(3). WWAARRNNIINNGG The inputs must be reduced modulo mm, otherwise the result will be outside the expected range.

SEE ALSO

bn(3), ERRgeterror(3), BNadd(3), BNCTXnew(3) HISTORY BNMONTCTXnew(), BNMONTCTXfree(), BNMONTCTXset(), BNmodmulmontgomery(), BNfrommontgomery() and BNtomontgomery() are available in all versions of SSLeay and OpenSSL. BNMONTCTXinit() and BNMONTCTXcopy() were added in SSLeay 0.9.1b.

0.9.7l 2002-09-25 BNmodmulmontgomery(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™