Sync crypto/ with OpenSSL 0.9.6g (trivial changes only).
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@194 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
23afca950e
commit
1687645d7b
13
crypto/bn.h
13
crypto/bn.h
@ -103,7 +103,9 @@ void xfree(void *mem);
|
||||
* be on. Again this in only really a problem on machines
|
||||
* using "long long's", are 32bit, and are not using my assembler code. */
|
||||
#if defined(MSDOS) || defined(WINDOWS) || defined(WIN32) || defined(linux)
|
||||
#define BN_DIV2W
|
||||
# ifndef BN_DIV2W
|
||||
# define BN_DIV2W
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* assuming long is 64bit - this is the DEC Alpha
|
||||
@ -166,7 +168,7 @@ void xfree(void *mem);
|
||||
#define BN_BYTES 4
|
||||
#define BN_BITS2 32
|
||||
#define BN_BITS4 16
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
/* VC++ doesn't like the LL suffix */
|
||||
#define BN_MASK (0xffffffffffffffffL)
|
||||
#else
|
||||
@ -342,6 +344,7 @@ void BN_CTX_end(BN_CTX *ctx);
|
||||
int BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
|
||||
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
|
||||
int BN_rand_range(BIGNUM *rnd, BIGNUM *range);
|
||||
int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range);
|
||||
int BN_num_bits(const BIGNUM *a);
|
||||
int BN_num_bits_word(BN_ULONG);
|
||||
BIGNUM *BN_new(void);
|
||||
@ -382,8 +385,8 @@ int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp2_mont(BIGNUM *r, BIGNUM *a1, BIGNUM *p1,BIGNUM *a2,
|
||||
BIGNUM *p2,BIGNUM *m,BN_CTX *ctx,BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m,BN_CTX *ctx);
|
||||
int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p,
|
||||
BIGNUM *m,BN_CTX *ctx);
|
||||
int BN_mask_bits(BIGNUM *a,int n);
|
||||
int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
|
||||
#ifndef NO_FP_API
|
||||
@ -416,7 +419,6 @@ int BN_is_prime(const BIGNUM *p,int nchecks,
|
||||
int BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
|
||||
void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,
|
||||
int do_trial_division);
|
||||
void ERR_load_BN_strings(void );
|
||||
|
||||
BN_MONT_CTX *BN_MONT_CTX_new(void );
|
||||
void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
|
||||
@ -487,4 +489,3 @@ int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -127,7 +127,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
|
||||
#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC) && !defined(BN_DIV3W)
|
||||
# if defined(__GNUC__) && __GNUC__>=2
|
||||
# if defined(__i386)
|
||||
# if defined(__i386) || defined (__i386__)
|
||||
/*
|
||||
* There were two reasons for implementing this template:
|
||||
* - GNU C generates a call to a function (__udivdi3 to be exact)
|
||||
@ -189,10 +189,10 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
||||
|
||||
/* First we normalise the numbers */
|
||||
norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2);
|
||||
BN_lshift(sdiv,divisor,norm_shift);
|
||||
if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err;
|
||||
sdiv->neg=0;
|
||||
norm_shift+=BN_BITS2;
|
||||
BN_lshift(snum,num,norm_shift);
|
||||
if (!(BN_lshift(snum,num,norm_shift))) goto err;
|
||||
snum->neg=0;
|
||||
div_n=sdiv->top;
|
||||
num_n=snum->top;
|
||||
@ -314,7 +314,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
||||
tmp->top=j;
|
||||
|
||||
j=wnum.top;
|
||||
BN_sub(&wnum,&wnum,tmp);
|
||||
if (!BN_sub(&wnum,&wnum,tmp)) goto err;
|
||||
|
||||
snum->top=snum->top+wnum.top-j;
|
||||
|
||||
@ -322,7 +322,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
||||
{
|
||||
q--;
|
||||
j=wnum.top;
|
||||
BN_add(&wnum,&wnum,sdiv);
|
||||
if (!BN_add(&wnum,&wnum,sdiv)) goto err;
|
||||
snum->top+=wnum.top-j;
|
||||
}
|
||||
*(resp--)=q;
|
||||
|
@ -510,7 +510,7 @@ err:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MONT_MUL_MOD
|
||||
#ifdef MONT_MUL_MOD
|
||||
int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
|
||||
{
|
||||
@ -795,7 +795,7 @@ err:
|
||||
#endif
|
||||
|
||||
/* The old fallback, simple version :-) */
|
||||
int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
|
||||
int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,
|
||||
BN_CTX *ctx)
|
||||
{
|
||||
int i,j,bits,ret=0,wstart,wend,window,wvalue,ts=0;
|
||||
|
@ -633,7 +633,7 @@ int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||
|
||||
if ((al == 0) || (bl == 0))
|
||||
{
|
||||
BN_zero(r);
|
||||
if (!BN_zero(r)) goto err;
|
||||
return(1);
|
||||
}
|
||||
top=al+bl;
|
||||
@ -676,14 +676,14 @@ int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA))
|
||||
{
|
||||
bn_wexpand(b,al);
|
||||
if (bn_wexpand(b,al) == NULL) goto err;
|
||||
b->d[bl]=0;
|
||||
bl++;
|
||||
i--;
|
||||
}
|
||||
else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA))
|
||||
{
|
||||
bn_wexpand(a,bl);
|
||||
if (bn_wexpand(a,bl) == NULL) goto err;
|
||||
a->d[al]=0;
|
||||
al++;
|
||||
i++;
|
||||
@ -698,16 +698,16 @@ int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||
t = BN_CTX_get(ctx);
|
||||
if (al == j) /* exact multiple */
|
||||
{
|
||||
bn_wexpand(t,k*2);
|
||||
bn_wexpand(rr,k*2);
|
||||
if (bn_wexpand(t,k*2) == NULL) goto err;
|
||||
if (bn_wexpand(rr,k*2) == NULL) goto err;
|
||||
bn_mul_recursive(rr->d,a->d,b->d,al,t->d);
|
||||
}
|
||||
else
|
||||
{
|
||||
bn_wexpand(a,k);
|
||||
bn_wexpand(b,k);
|
||||
bn_wexpand(t,k*4);
|
||||
bn_wexpand(rr,k*4);
|
||||
if (bn_wexpand(a,k) == NULL ) goto err;
|
||||
if (bn_wexpand(b,k) == NULL ) goto err;
|
||||
if (bn_wexpand(t,k*4) == NULL ) goto err;
|
||||
if (bn_wexpand(rr,k*4) == NULL ) goto err;
|
||||
for (i=a->top; i<k; i++)
|
||||
a->d[i]=0;
|
||||
for (i=b->top; i<k; i++)
|
||||
|
@ -244,7 +244,7 @@ printf(" bn_sqr_recursive %d * %d\n",n2,n2);
|
||||
if (!zero)
|
||||
bn_sqr_recursive(&(t[n2]),t,n,p);
|
||||
else
|
||||
memset(&(t[n2]),0,n*sizeof(BN_ULONG));
|
||||
memset(&(t[n2]),0,n2*sizeof(BN_ULONG));
|
||||
bn_sqr_recursive(r,a,n,p);
|
||||
bn_sqr_recursive(&(r[n2]),&(a[n]),n,p);
|
||||
|
||||
|
@ -198,7 +198,7 @@
|
||||
*
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
# if defined(__i386)
|
||||
# if defined(__i386) || defined(__i386__)
|
||||
# define ROTATE(a,n) ({ register unsigned int ret; \
|
||||
asm ( \
|
||||
"roll %1,%0" \
|
||||
@ -224,7 +224,7 @@
|
||||
*/
|
||||
# if defined(__GNUC__) && __GNUC__>=2 && !defined(NO_ASM) && !defined(NO_INLINE_ASM)
|
||||
/* some GNU C inline assembler templates by <appro@fy.chalmers.se> */
|
||||
# if defined(__i386) && !defined(I386_ONLY)
|
||||
# if (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
|
||||
# define BE_FETCH32(a) ({ register unsigned int l=(a);\
|
||||
asm ( \
|
||||
"bswapl %0" \
|
||||
|
@ -65,7 +65,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef MD5_ASM
|
||||
# if defined(__i386) || defined(_M_IX86) || defined(__INTEL__)
|
||||
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
|
||||
# define md5_block_host_order md5_block_asm_host_order
|
||||
# elif defined(__sparc) && defined(ULTRASPARC)
|
||||
void md5_block_asm_data_order_aligned (MD5_CTX *c, const MD5_LONG *p,int num);
|
||||
@ -76,7 +76,7 @@
|
||||
void md5_block_host_order (MD5_CTX *c, const void *p,int num);
|
||||
void md5_block_data_order (MD5_CTX *c, const void *p,int num);
|
||||
|
||||
#if defined(__i386) || defined(_M_IX86) || defined(__INTEL__)
|
||||
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
|
||||
/*
|
||||
* *_block_host_order is expected to handle aligned data while
|
||||
* *_block_data_order - unaligned. As algorithm and host (x86)
|
||||
|
@ -114,7 +114,7 @@
|
||||
# endif
|
||||
|
||||
# ifdef SHA1_ASM
|
||||
# if defined(__i386) || defined(_M_IX86) || defined(__INTEL__)
|
||||
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
|
||||
# define sha1_block_host_order sha1_block_asm_host_order
|
||||
# define DONT_IMPLEMENT_BLOCK_HOST_ORDER
|
||||
# define sha1_block_data_order sha1_block_asm_data_order
|
||||
|
Loading…
Reference in New Issue
Block a user