diff options
author | Matt Caswell <matt@openssl.org> | 2014-10-29 00:16:06 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-12-08 22:41:27 +0100 |
commit | 1939187922a8240b3dd18c455da3636ac754983d (patch) | |
tree | c70dc4c4780451c11f0be6987be1611ffbcd4d11 /crypto/bn/bn_lcl.h | |
parent | Update apps for bn opaque change (diff) | |
download | openssl-1939187922a8240b3dd18c455da3636ac754983d.tar.xz openssl-1939187922a8240b3dd18c455da3636ac754983d.zip |
Make bn opaque
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/bn/bn_lcl.h')
-rw-r--r-- | crypto/bn/bn_lcl.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h index 116dac458c..5ca1b9c911 100644 --- a/crypto/bn/bn_lcl.h +++ b/crypto/bn/bn_lcl.h @@ -119,6 +119,56 @@ extern "C" { #endif +struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int dmax; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; + }; + +/* Used for montgomery multiplication */ +struct bn_mont_ctx_st + { + int ri; /* number of bits in R */ + BIGNUM RR; /* 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) */ + BN_ULONG n0[2];/* least significant word(s) of Ni; + (type changed with 0.9.9, was "BN_ULONG n0;" before) */ + int flags; + }; + +/* Used for reciprocal division/mod functions + * It cannot be shared between threads + */ +struct bn_recp_ctx_st + { + BIGNUM N; /* the divisor */ + BIGNUM Nr; /* the reciprocal */ + int num_bits; + int shift; + int flags; + }; + +/* Used for slow "generation" functions. */ +struct bn_gencb_st + { + unsigned int ver; /* To handle binary (in)compatibility */ + void *arg; /* callback-specific data */ + union + { + /* if(ver==1) - handles old style callbacks */ + void (*cb_1)(int, int, void *); + /* if(ver==2) - new callback style */ + int (*cb_2)(int, int, BN_GENCB *); + } cb; + }; + + /* * BN_window_bits_for_exponent_size -- macro for sliding window mod_exp functions * @@ -506,6 +556,10 @@ extern "C" { } #endif /* !BN_LLONG */ +void BN_init(BIGNUM *a); +void BN_RECP_CTX_init(BN_RECP_CTX *recp); +void BN_MONT_CTX_init(BN_MONT_CTX *ctx); + void bn_mul_normal(BN_ULONG *r,BN_ULONG *a,int na,BN_ULONG *b,int nb); void bn_mul_comba8(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b); void bn_mul_comba4(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b); |