aboutsummaryrefslogtreecommitdiff
path: root/openssl/crypto/bn/bn_gf2m.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-06-15 20:18:50 +0200
committerMike DePaulo <mikedep333@gmail.com>2015-06-22 01:16:46 -0400
commit36da4a2e0e43928a29ac2ee5c55bf681e90e2f42 (patch)
tree92633e1022d705c72d0f97315891e719648dd17e /openssl/crypto/bn/bn_gf2m.c
parentbec4be4c48239613ed1c704ae71bf08754eef711 (diff)
downloadvcxsrv-36da4a2e0e43928a29ac2ee5c55bf681e90e2f42.tar.gz
vcxsrv-36da4a2e0e43928a29ac2ee5c55bf681e90e2f42.tar.bz2
vcxsrv-36da4a2e0e43928a29ac2ee5c55bf681e90e2f42.zip
Update to openssl-1.0.2crelease/external-1.17.0.0-x
Diffstat (limited to 'openssl/crypto/bn/bn_gf2m.c')
-rw-r--r--openssl/crypto/bn/bn_gf2m.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/openssl/crypto/bn/bn_gf2m.c b/openssl/crypto/bn/bn_gf2m.c
index aeee49a01..cfa1c7ce1 100644
--- a/openssl/crypto/bn/bn_gf2m.c
+++ b/openssl/crypto/bn/bn_gf2m.c
@@ -450,8 +450,7 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[])
d0 = p[k] % BN_BITS2;
d1 = BN_BITS2 - d0;
z[n] ^= (zz << d0);
- tmp_ulong = zz >> d1;
- if (d0 && tmp_ulong)
+ if (d0 && (tmp_ulong = zz >> d1))
z[n + 1] ^= tmp_ulong;
}
@@ -694,9 +693,10 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
}
# else
{
- int i, ubits = BN_num_bits(u), vbits = BN_num_bits(v), /* v is copy
- * of p */
- top = p->top;
+ int i;
+ int ubits = BN_num_bits(u);
+ int vbits = BN_num_bits(v); /* v is copy of p */
+ int top = p->top;
BN_ULONG *udp, *bdp, *vdp, *cdp;
bn_wexpand(u, top);
@@ -740,8 +740,12 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
ubits--;
}
- if (ubits <= BN_BITS2 && udp[0] == 1)
- break;
+ if (ubits <= BN_BITS2) {
+ if (udp[0] == 0) /* poly was reducible */
+ goto err;
+ if (udp[0] == 1)
+ break;
+ }
if (ubits < vbits) {
i = ubits;