projects
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f7eb0ab
)
bn_exp.c: improve portability.
author
Andy Polyakov
<appro@openssl.org>
Sat, 27 Aug 2011 19:38:55 +0000
(19:38 +0000)
committer
Andy Polyakov
<appro@openssl.org>
Sat, 27 Aug 2011 19:38:55 +0000
(19:38 +0000)
crypto/bn/bn_exp.c
patch
|
blob
|
history
diff --git
a/crypto/bn/bn_exp.c
b/crypto/bn/bn_exp.c
index 5b00aa1e3c5b2c1503a776e424e0a3cc0a14a155..aae00491db21202ef1e484fa98837f8a1b7914fd 100644
(file)
--- a/
crypto/bn/bn_exp.c
+++ b/
crypto/bn/bn_exp.c
@@
-654,16
+654,21
@@
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
numPowers = 1 << window;
powerbufLen = sizeof(m->d[0])*(top*numPowers +
(top>numPowers?top:numPowers));
numPowers = 1 << window;
powerbufLen = sizeof(m->d[0])*(top*numPowers +
(top>numPowers?top:numPowers));
+#ifdef alloca
if (powerbufLen < 3072)
powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
if (powerbufLen < 3072)
powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
- else if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
+ else
+#endif
+ if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
goto err;
powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
memset(powerbuf, 0, powerbufLen);
goto err;
powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
memset(powerbuf, 0, powerbufLen);
+#ifdef alloca
if (powerbufLen < 3072)
powerbufFree = NULL;
if (powerbufLen < 3072)
powerbufFree = NULL;
+#endif
computeTemp.d = (BN_ULONG *)(powerbuf + sizeof(m->d[0])*top*numPowers);
computeTemp.top = computeTemp.dmax = top;
computeTemp.d = (BN_ULONG *)(powerbuf + sizeof(m->d[0])*top*numPowers);
computeTemp.top = computeTemp.dmax = top;