mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
* mpicoder.c (mpi_set_buffer): Cast all left operands of a shift
to a larger type so that 16 bit CPUs don't suffer from an overflow. Suggested by TOGAWA Satoshi.
This commit is contained in:
parent
075f862277
commit
d6a87e6b28
@ -1,3 +1,9 @@
|
||||
2002-09-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* mpicoder.c (mpi_set_buffer): Cast all left operands of a shift
|
||||
to a larger type so that 16 bit CPUs don't suffer from an
|
||||
overflow. Suggested by TOGAWA Satoshi.
|
||||
|
||||
2002-08-24 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* longlong.h: Remove space between \ and newline. gcc is
|
||||
|
@ -405,10 +405,10 @@ mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign )
|
||||
|
||||
for(i=0, p = buffer+nbytes-1; p >= buffer+BYTES_PER_MPI_LIMB; ) {
|
||||
#if BYTES_PER_MPI_LIMB == 4
|
||||
alimb = *p-- ;
|
||||
alimb |= *p-- << 8 ;
|
||||
alimb |= *p-- << 16 ;
|
||||
alimb |= *p-- << 24 ;
|
||||
alimb = (mpi_limb_t)*p-- ;
|
||||
alimb |= (mpi_limb_t)*p-- << 8 ;
|
||||
alimb |= (mpi_limb_t)*p-- << 16 ;
|
||||
alimb |= (mpi_limb_t)*p-- << 24 ;
|
||||
#elif BYTES_PER_MPI_LIMB == 8
|
||||
alimb = (mpi_limb_t)*p-- ;
|
||||
alimb |= (mpi_limb_t)*p-- << 8 ;
|
||||
@ -426,9 +426,9 @@ mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign )
|
||||
if( p >= buffer ) {
|
||||
#if BYTES_PER_MPI_LIMB == 4
|
||||
alimb = *p-- ;
|
||||
if( p >= buffer ) alimb |= *p-- << 8 ;
|
||||
if( p >= buffer ) alimb |= *p-- << 16 ;
|
||||
if( p >= buffer ) alimb |= *p-- << 24 ;
|
||||
if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 8 ;
|
||||
if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 16 ;
|
||||
if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 24 ;
|
||||
#elif BYTES_PER_MPI_LIMB == 8
|
||||
alimb = (mpi_limb_t)*p-- ;
|
||||
if( p >= buffer ) alimb |= (mpi_limb_t)*p-- << 8 ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user