Manual Pages for UNIX Darwin command on man bn
MyWebUniversity

Manual Pages for UNIX Darwin command on man bn

bn(3) OpenSSL bn(3)

NAME

bn - multiprecision integer arithmetics

SYNOPSIS

#include

BIGNUM *BNnew(void); void BNfree(BIGNUM *a); void BNinit(BIGNUM *); void BNclear(BIGNUM *a); void BNclearfree(BIGNUM *a); BNCTX *BNCTXnew(void); void BNCTXinit(BNCTX *c); void BNCTXfree(BNCTX *c); BIGNUM *BNcopy(BIGNUM *a, const BIGNUM *b); BIGNUM *BNdup(const BIGNUM *a); BIGNUM *BNswap(BIGNUM *a, BIGNUM *b); int BNnumbytes(const BIGNUM *a); int BNnumbits(const BIGNUM *a); int BNnumbitsword(BNULONG w); 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 *rem, const BIGNUM *a, const BIGNUM *m, BNCTX *ctx); int BNmodadd(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BNCTX *ctx); int BNmodsub(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BNCTX *ctx); int BNmodmul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BNCTX *ctx); int BNmodsqr(BIGNUM *ret, 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); int BNaddword(BIGNUM *a, BNULONG w); int BNsubword(BIGNUM *a, BNULONG w); int BNmulword(BIGNUM *a, BNULONG w); BNULONG BNdivword(BIGNUM *a, BNULONG w); BNULONG BNmodword(const BIGNUM *a, BNULONG w); int BNcmp(BIGNUM *a, BIGNUM *b); int BNucmp(BIGNUM *a, BIGNUM *b); int BNiszero(BIGNUM *a); int BNisone(BIGNUM *a); int BNisword(BIGNUM *a, BNULONG w); int BNisodd(BIGNUM *a); int BNzero(BIGNUM *a); int BNone(BIGNUM *a); const BIGNUM *BNvalueone(void); int BNsetword(BIGNUM *a, unsigned long w); unsigned long BNgetword(BIGNUM *a); int BNrand(BIGNUM *rnd, int bits, int top, int bottom); int BNpseudorand(BIGNUM *rnd, int bits, int top, int bottom); int BNrandrange(BIGNUM *rnd, BIGNUM *range); int BNpseudorandrange(BIGNUM *rnd, BIGNUM *range); BIGNUM *BNgenerateprime(BIGNUM *ret, int bits,int safe, BIGNUM *add, BIGNUM *rem, void (*callback)(int, int, void *), void *cbarg); int BNisprime(const BIGNUM *p, int nchecks, void (*callback)(int, int, void *), BNCTX *ctx, void *cbarg); int BNsetbit(BIGNUM *a, int n); int BNclearbit(BIGNUM *a, int n); int BNisbitset(const BIGNUM *a, int n); int BNmaskbits(BIGNUM *a, int n); int BNlshift(BIGNUM *r, const BIGNUM *a, int n); int BNlshift1(BIGNUM *r, BIGNUM *a); int BNrshift(BIGNUM *r, BIGNUM *a, int n); int BNrshift1(BIGNUM *r, BIGNUM *a);

int BNbn2bin(const BIGNUM *a, unsigned char *to);

BIGNUM *BNbin2bn(const unsigned char *s, int len, BIGNUM *ret);

char *BNbn2hex(const BIGNUM *a);

char *BNbn2dec(const BIGNUM *a);

int BNhex2bn(BIGNUM **a, const char *str);

int BNdec2bn(BIGNUM **a, const char *str);

int BNprint(BIO *fp, const BIGNUM *a); int BNprintfp(FILE *fp, const BIGNUM *a);

int BNbn2mpi(const BIGNUM *a, unsigned char *to);

BIGNUM *BNmpi2bn(unsigned char *s, int len, BIGNUM *ret);

BIGNUM *BNmodinverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, BNCTX *ctx); BNRECPCTX *BNRECPCTXnew(void); void BNRECPCTXinit(BNRECPCTX *recp); void BNRECPCTXfree(BNRECPCTX *recp); int BNRECPCTXset(BNRECPCTX *recp, const BIGNUM *m, BNCTX *ctx); int BNmodmulreciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, BNRECPCTX *recp, BNCTX *ctx); 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

The Big Number library is part of libcrypto. It performs arithmetic operations on integers of arbitrary size. It was written for use in

public key cryptography, such as RSA and Diffie-Hellman.

It uses dynamic memory allocation for storing its data structures. That means that there is no limit on the size of the numbers manipulated by these functions, but return values must always be checked in case a memory allocation error has occurred. The basic object in this library is a BBIIGGNNUUMM. It is used to hold a single large integer. This type should be considered opaque and fields should not be modified or accessed directly. The creation of BBIIGGNNUUMM objects is described in BNnew(3); BNadd(3) describes most of the arithmetic operations. Comparison is described in BNcmp(3); BNzero(3) describes certain assignments, BNrand(3) the generation of random numbers, BNgenerateprime(3) deals with prime numbers and BNsetbit(3) with bit operations. The conversion of

BBIIGGNNUUMMs to external formats is described in BNbn2bin(3).

SEE ALSO

bninternal(3), dh(3), err(3), rand(3), rsa(3), BNnew(3),

BNCTXnew(3), BNcopy(3), BNswap(3), BNnumbytes(3), BNadd(3), BNaddword(3), BNcmp(3), BNzero(3), BNrand(3),

BNgenerateprime(3), BNsetbit(3), BNbn2bin(3), BNmodinverse(3),

BNmodmulreciprocal(3), BNmodmulmontgomery(3)

0.9.7l 2009-11-20 bn(3)




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