summaryrefslogtreecommitdiff
path: root/ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-12-12 11:49:24 +0100
committerParménides GV <parmegv@sdf.org>2014-12-12 11:49:24 +0100
commit0e7e4005460964cf8dac080e3d99e1df2a1bdc4d (patch)
tree63fdba4f03bf47b0faa62b9d24cdff9a5a79a8b7 /ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c
parent61dc26ab57ad4e2dba341998cabec3f411865e46 (diff)
Updated ics-openvpn to rev924.
Diffstat (limited to 'ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c')
-rw-r--r--ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c b/ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c
index 2abf6fd6..611fa326 100644
--- a/ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c
+++ b/ics-openvpn-stripped/main/openssl/crypto/bn/bn_exp.c
@@ -680,7 +680,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
/* Dedicated window==4 case improves 512-bit RSA sign by ~15%, but as
* 512-bit RSA is hardly relevant, we omit it to spare size... */
- if (window==5)
+ if (window==5 && top>1)
{
void bn_mul_mont_gather5(BN_ULONG *rp,const BN_ULONG *ap,
const void *table,const BN_ULONG *np,
@@ -874,7 +874,14 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
bits = BN_num_bits(p);
if (bits == 0)
{
- ret = BN_one(rr);
+ /* x**0 mod 1 is still zero. */
+ if (BN_is_one(m))
+ {
+ ret = 1;
+ BN_zero(rr);
+ }
+ else
+ ret = BN_one(rr);
return ret;
}
if (a == 0)