Manual Pages for UNIX Darwin command on man BN_mod_add
MyWebUniversity

Manual Pages for UNIX Darwin command on man BN_mod_add

BNadd(3) OpenSSL BNadd(3)

NAME

BNadd, BNsub, BNmul, BNsqr, BNdiv, BNmod, BNnnmod, BNmodadd,

BNmodsub, BNmodmul, BNmodsqr, BNexp, BNmodexp, BNgcd -

arithmetic operations on BIGNUMs

SYNOPSIS

#include

int BNadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BNsub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BNmul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BNCTX *ctx); int BNsqr(BIGNUM *r, BIGNUM *a, BNCTX *ctx); int BNdiv(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, BNCTX *ctx); int BNmod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BNCTX *ctx); int BNnnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BNCTX *ctx); int BNmodadd(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BNCTX *ctx); int BNmodsub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BNCTX *ctx); int BNmodmul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BNCTX *ctx); int BNmodsqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BNCTX *ctx); int BNexp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BNCTX *ctx); int BNmodexp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BNCTX *ctx); int BNgcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BNCTX *ctx);

DESCRIPTION

BNadd() adds a and b and places the result in r ("r=a+b"). r may be the same BBIIGGNNUUMM as a or b.

BNsub() subtracts b from a and places the result in r ("r=a-b").

BNmul() multiplies a and b and places the result in r ("r=a*b"). r may be the same BBIIGGNNUUMM as a or b. For multiplication by powers of 2, use BNlshift(3). BNsqr() takes the square of a and places the result in r ("r=a^2"). r and a may be the same BBIIGGNNUUMM. This function is faster than BNmul(r,a,a). BNdiv() divides a by d and places the result in dv and the remainder

in rem ("dv=a/d, rem=a%d"). Either of dv and rem may be NNUULLLL, in which

case the respective value is not returned. The result is rounded towards zero; thus if a is negative, the remainder will be zero or negative. For division by powers of 2, use BNrshift(3). BNmod() corresponds to BNdiv() with dv set to NNUULLLL.

BNnnmod() reduces a modulo m and places the non-negative remainder in

r.

BNmodadd() adds a to b modulo m and places the non-negative result in

r.

BNmodsub() subtracts b from a modulo m and places the non-negative

result in r.

BNmodmul() multiplies a by b and finds the non-negative remainder

respective to modulus m ("r=(a*b) mod m"). r may be the same BBIIGGNNUUMM as a or b. For more efficient algorithms for repeated computations using the same modulus, see BNmodmulmontgomery(3) and BNmodmulreciprocal(3). BNmodsqr() takes the square of a modulo mm and places the result in r.

BNexp() raises a to the p-th power and places the result in r

("r=a^p"). This function is faster than repeated applications of BNmul().

BNmodexp() computes a to the p-th power modulo m ("r=a^p % m"). This

function uses less time and space than BNexp(). BNgcd() computes the greatest common divisor of a and b and places the result in r. r may be the same BBIIGGNNUUMM as a or b. For all functions, ctx is a previously allocated BBNNCCTTXX used for temporary variables; see BNCTXnew(3). Unless noted otherwise, the result BBIIGGNNUUMM must be different from the arguments.

RETURN VALUES

For all functions, 1 is returned for success, 0 on error. The return value should always be checked (e.g., "if (!BNadd(r,a,b)) goto err;"). The error codes can be obtained by ERRgeterror(3).

SEE ALSO

bn(3), ERRgeterror(3), BNCTXnew(3), BNaddword(3), BNsetbit(3) HISTORY BNadd(), BNsub(), BNsqr(), BNdiv(), BNmod(), BNmodmul(), BNmodexp() and BNgcd() are available in all versions of SSLeay and OpenSSL. The ctx argument to BNmul() was added in SSLeay 0.9.1b. BNexp() appeared in SSLeay 0.9.0. BNnnmod(), BNmodadd(), BNmodsub(), and BNmodsqr() were added in OpenSSL 0.9.7.

0.9.7l 2002-09-25 BNadd(3)




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