.\" $OpenBSD: bn.3,v 1.4 2016/11/06 15:52:50 jmc Exp $ .\" .Dd $Mdocdate: November 6 2016 $ .Dt BN 3 .Os .Sh NAME .Nm bn .Nd multiprecision integer arithmetics .Sh SYNOPSIS .In openssl/bn.h .Sh DESCRIPTION This library performs arithmetic operations on integers of arbitrary size. It was written for use in public key cryptography, such as RSA and Diffie-Hellman. .Pp 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. .Pp The basic object in this library is a .Vt BIGNUM . It is used to hold a single large integer. This type should be considered opaque and fields should not be modified or accessed directly. .Pp The creation of .Vt BIGNUM objects is described in .Xr BN_new 3 ; .Xr BN_add 3 describes most of the arithmetic operations. Comparison is described in .Xr BN_cmp 3 ; .Xr BN_zero 3 describes certain assignments, .Xr BN_rand 3 the generation of random numbers, .Xr BN_generate_prime 3 deals with prime numbers and .Xr BN_set_bit 3 with bit operations. The conversion of .Vt BIGNUM Ns s to external formats is described in .Xr BN_bn2bin 3 . .Sh SEE ALSO .Xr BN_add 3 , .Xr BN_add_word 3 , .Xr BN_BLINDING_new 3 , .Xr BN_bn2bin 3 , .Xr BN_cmp 3 , .Xr BN_copy 3 , .Xr BN_CTX_new 3 , .Xr BN_CTX_start 3 , .Xr bn_dump 3 , .Xr BN_generate_prime 3 , .Xr BN_mod_inverse 3 , .Xr BN_mod_mul_montgomery 3 , .Xr BN_mod_mul_reciprocal 3 , .Xr BN_new 3 , .Xr BN_num_bytes 3 , .Xr BN_rand 3 , .Xr BN_set_bit 3 , .Xr BN_set_negative 3 , .Xr BN_swap 3 , .Xr BN_zero 3 , .Xr dh 3 , .Xr ERR 3 , .Xr rsa 3