Home GnuPG

ec: fix left shift overflows on WIN64 build

Description

ec: fix left shift overflows on WIN64 build

* mpi/ec.c (ec_mulm_448): Cast constants to (mpi_limb_t) before
shifting left by 32.

Patch fixes following warnings:

.../libgcrypt/mpi/ec.c: In function 'ec_mulm_448':
.../libgcrypt/mpi/ec.c:563:35: warning: left shift count >= width of type [-Wshift-count-overflow]

563 |   b0[LIMB_SIZE_HALF_448-1] &= (1UL<<32)-1;
    |                                   ^~

.../libgcrypt/mpi/ec.c:564:35: warning: left shift count >= width of type [-Wshift-count-overflow]

564 |   a2[LIMB_SIZE_HALF_448-1] &= (1UL<<32)-1;
    |                                   ^~

.../libgcrypt/mpi/ec.c:576:29: warning: left shift count >= width of type [-Wshift-count-overflow]

576 |       b1_rest = b1v & ((1UL <<32)-1);
    |                             ^~

.../libgcrypt/mpi/ec.c:577:29: warning: left shift count >= width of type [-Wshift-count-overflow]

577 |       a3_rest = a3v & ((1UL <<32)-1);
    |                             ^~

.../libgcrypt/mpi/ec.c:586:37: warning: left shift count >= width of type [-Wshift-count-overflow]

586 |   wp[LIMB_SIZE_HALF_448-1] &= ((1UL <<32)-1);
    |                                     ^~

.../libgcrypt/mpi/ec.c:603:29: warning: left shift count >= width of type [-Wshift-count-overflow]

603 |       b1_rest = b1v & ((1UL <<32)-1);
    |                             ^~
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Nov 5 2019, 9:06 PM
Parents
rC1322c6a5d1e9: mpi/amd64: use SSE2 for shifting instead of MMX
Branches
Unknown
Tags
Unknown