From 8bd7ca99961f341ce2070373e86f22505aed2b2a Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Tue, 3 Dec 2013 22:28:48 +0100 Subject: [PATCH] crypto/bn/asm/rsaz-x86_64.pl: make it work on Win64. --- crypto/bn/asm/rsaz-x86_64.pl | 2 ++ crypto/bn/rsaz_exp.c | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/crypto/bn/asm/rsaz-x86_64.pl b/crypto/bn/asm/rsaz-x86_64.pl index b55421b7db..120b473492 100755 --- a/crypto/bn/asm/rsaz-x86_64.pl +++ b/crypto/bn/asm/rsaz-x86_64.pl @@ -910,6 +910,7 @@ rsaz_512_mul_gather4: push %r14 push %r15 + mov $pwr, $pwr subq \$128+24, %rsp .Lmul_gather4_body: ___ @@ -1249,6 +1250,7 @@ rsaz_512_mul_scatter4: push %r14 push %r15 + mov $pwr, $pwr subq \$128+24, %rsp .Lmul_scatter4_body: leaq ($tbl,$pwr,4), $tbl diff --git a/crypto/bn/rsaz_exp.c b/crypto/bn/rsaz_exp.c index 2cdb02a4f0..e0221b1f2c 100644 --- a/crypto/bn/rsaz_exp.c +++ b/crypto/bn/rsaz_exp.c @@ -46,8 +46,8 @@ * See crypto/bn/asm/rsaz-avx2.pl for further details. */ void rsaz_1024_norm2red_avx2(void *red,const void *norm); -void rsaz_1024_mul_avx2(void *ret,const void *a,const void *b,const void *n,unsigned long k); -void rsaz_1024_sqr_avx2(void *ret,const void *a,const void *n,unsigned long k,int cnt); +void rsaz_1024_mul_avx2(void *ret,const void *a,const void *b,const void *n,BN_ULONG k); +void rsaz_1024_sqr_avx2(void *ret,const void *a,const void *n,BN_ULONG k,int cnt); void rsaz_1024_scatter5_avx2(void *tbl,const void *val,int i); void rsaz_1024_gather5_avx2(void *val,const void *tbl,int i); void rsaz_1024_red2norm_avx2(void *norm,const void *red); @@ -63,9 +63,9 @@ void rsaz_1024_red2norm_avx2(void *norm,const void *red); # define ALIGN64 /* not fatal, might hurt performance a little */ #endif -ALIGN64 static const unsigned long one[40] = +ALIGN64 static const BN_ULONG one[40] = {1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -ALIGN64 static const unsigned long two80[40] = +ALIGN64 static const BN_ULONG two80[40] = {0,0,1<<22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16], @@ -256,13 +256,13 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16], /* * See crypto/bn/rsaz-x86_64.pl for further details. */ -void rsaz_512_mul(void *ret,const void *a,const void *b,const void *n,unsigned long k); -void rsaz_512_mul_scatter4(void *ret,const void *a,const void *n,unsigned long k,const void *tbl,unsigned int power); -void rsaz_512_mul_gather4(void *ret,const void *a,const void *tbl,const void *n,unsigned long k,unsigned int power); -void rsaz_512_mul_by_one(void *ret,const void *a,const void *n,unsigned long k); -void rsaz_512_sqr(void *ret,const void *a,const void *n,unsigned long k,int cnt); -void rsaz_512_scatter4(void *tbl, const unsigned long *val, int power); -void rsaz_512_gather4(unsigned long *val, const void *tbl, int power); +void rsaz_512_mul(void *ret,const void *a,const void *b,const void *n,BN_ULONG k); +void rsaz_512_mul_scatter4(void *ret,const void *a,const void *n,BN_ULONG k,const void *tbl,unsigned int power); +void rsaz_512_mul_gather4(void *ret,const void *a,const void *tbl,const void *n,BN_ULONG k,unsigned int power); +void rsaz_512_mul_by_one(void *ret,const void *a,const void *n,BN_ULONG k); +void rsaz_512_sqr(void *ret,const void *a,const void *n,BN_ULONG k,int cnt); +void rsaz_512_scatter4(void *tbl, const BN_ULONG *val, int power); +void rsaz_512_gather4(BN_ULONG *val, const void *tbl, int power); void RSAZ_512_mod_exp(BN_ULONG result[8], const BN_ULONG base[8], const BN_ULONG exponent[8], @@ -270,8 +270,8 @@ void RSAZ_512_mod_exp(BN_ULONG result[8], { unsigned char storage[16*8*8+64*2+64]; /* 1.2KB */ unsigned char *table = storage + (64-((size_t)storage%64)); - unsigned long *a_inv = (unsigned long *)(table+16*8*8), - *temp = (unsigned long *)(table+16*8*8+8*8); + BN_ULONG *a_inv = (BN_ULONG *)(table+16*8*8), + *temp = (BN_ULONG *)(table+16*8*8+8*8); unsigned char *p_str = (unsigned char*)exponent; int index; unsigned int wvalue;