Document the BN library.
[openssl.git] / crypto / bn / bn.h
index 80421a24ccda37cf5db8210611ad6d35119ddca0..5d789ff96cafe5b33f21c952b0a74768b8b1a79d 100644 (file)
@@ -142,7 +142,7 @@ extern "C" {
 #endif
 
 #ifdef THIRTY_TWO_BIT
-#ifdef WIN32
+#if defined(WIN32) && !defined(__GNUC__)
 #define BN_ULLONG      unsigned _int64
 #else
 #define BN_ULLONG      unsigned long long
@@ -283,7 +283,8 @@ typedef struct bn_recp_ctx_st
 #define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\
        r,a,&((mont)->RR),(mont),ctx)
 
-#define BN_prime_checks                (5)
+#define BN_prime_checks 0 /* default: select number of iterations
+                            based on the size of the number */
 
 #define BN_num_bytes(a)        ((BN_num_bits(a)+7)/8)
 #define BN_is_word(a,w)        (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w)))
@@ -329,11 +330,11 @@ int       BN_bn2mpi(const BIGNUM *a, unsigned char *to);
 int    BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
 int    BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
 int    BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
-int    BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b);
+int    BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
 int    BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
 int    BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
               BN_CTX *ctx);
-int    BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b,BN_CTX *ctx);
+int    BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
 int    BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx);
 BN_ULONG BN_mod_word(BIGNUM *a, BN_ULONG w);
 BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
@@ -381,7 +382,7 @@ int         BN_hex2bn(BIGNUM **a, const char *str);
 int    BN_dec2bn(BIGNUM **a, const char *str);
 int    BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx);
 BIGNUM *BN_mod_inverse(BIGNUM *ret,BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
-BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int strong,BIGNUM *add,
+BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,BIGNUM *add,
                BIGNUM *rem,void (*callback)(int,int,void *),void *cb_arg);
 int    BN_is_prime(BIGNUM *p,int nchecks,void (*callback)(int,int,void *),
                BN_CTX *ctx,void *cb_arg);