From: Tomas Mraz Date: Wed, 3 Dec 2025 11:17:13 +0000 (+0100) Subject: Avoid warning about zero extending unsigned int on Windows X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=209c91c320460b676869427ea463b330aed119eb;p=thirdparty%2Fopenssl.git Avoid warning about zero extending unsigned int on Windows Reviewed-by: Neil Horman Reviewed-by: Norbert Pocs (Merged from https://github.com/openssl/openssl/pull/29300) --- diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c index 6a763b09543..e09b6a3d723 100644 --- a/crypto/bn/bn_gcd.c +++ b/crypto/bn/bn_gcd.c @@ -654,7 +654,8 @@ int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) for (i = 0; i < m; i++) { /* conditionally flip signs if delta is positive and g is odd */ - cond = ((unsigned int)-delta >> (8 * sizeof(delta) - 1)) & g->d[0] & 1 + cond = ((unsigned int)-delta >> (8 * sizeof(delta) - 1)) + & (unsigned int)g->d[0] & 1 /* make sure g->top > 0 (i.e. if top == 0 then g == 0 always) */ & (~((unsigned int)(g->top - 1) >> (sizeof(g->top) * 8 - 1))); delta = (-cond & -delta) | ((cond - 1) & delta); @@ -666,7 +667,7 @@ int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) delta++; if (!BN_add(temp, g, r)) goto err; - BN_consttime_swap(g->d[0] & 1 /* g is odd */ + BN_consttime_swap((unsigned int)g->d[0] & 1 /* g is odd */ /* make sure g->top > 0 (i.e. if top == 0 then g == 0 always) */ & (~((unsigned int)(g->top - 1) >> (sizeof(g->top) * 8 - 1))), g, temp, top);