1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

chnages done at the train

This commit is contained in:
Werner Koch 1998-08-07 08:53:38 +00:00
parent 48a041279d
commit 6d21f2838d
19 changed files with 167 additions and 126 deletions

View file

@ -1,3 +1,7 @@
Thu Aug 6 16:39:28 1998 Werner Koch,mobil,,, (wk@tobold)
* mpi-bit.c (mpi_set_bytes): Removed.
Wed Aug 5 15:11:12 1998 Werner Koch (wk@(none))
* mpicoder.c (mpi_read_from_buffer): New.

View file

@ -57,12 +57,6 @@ void g10m_swap( MPI a, MPI b) { mpi_swap( a, b ); }
void g10m_set( MPI w, MPI u) { mpi_set( w, u ); }
void g10m_set_ui( MPI w, ulong u ) { mpi_set_ui( w, u ); }
void
g10m_set_bytes( MPI a, unsigned nbits, byte (*fnc)(int), int opaque )
{
mpi_set_bytes( a, nbits, fnc, opaque );
}
int g10m_cmp( MPI u, MPI v ) { return mpi_cmp( u, v ); }
int g10m_cmp_ui( MPI u, ulong v ) { return mpi_cmp_ui( u, v ); }

View file

@ -177,56 +177,6 @@ mpi_clear_bit( MPI a, unsigned n )
}
void
mpi_set_bytes( MPI a, unsigned nbits, byte (*fnc)(int), int opaque )
{
byte *p;
unsigned nlimbs, nlimbs2, xbits, xbytes;
unsigned n;
int i;
nlimbs = nbits / BITS_PER_MPI_LIMB;
xbits = nbits % BITS_PER_MPI_LIMB;
nlimbs2 = xbits? (nlimbs+1):nlimbs;
xbytes = xbits / 8;
xbits = xbits % 8;
if( a->alloced < nlimbs2 )
mpi_resize(a, nlimbs2 );
a->nlimbs = nlimbs2;
for(n=0; n < nlimbs; n++ ) {
p = (byte*)(a->d+n);
#ifdef LITTLE_ENDIAN_HOST
for(i=0; i < BYTES_PER_MPI_LIMB; i++ )
p[i] = fnc(opaque);
#else
for(i=BYTES_PER_MPI_LIMB-1; i>=0; i-- )
p[i] = fnc(opaque);
#endif
}
if( xbytes ) {
p = (byte*)(a->d+n);
#ifdef LITTLE_ENDIAN_HOST
for(i=0; i < xbytes; i++ )
p[i] = fnc(opaque);
#else
for(i=xbytes-1; i>=0; i-- )
p[i] = fnc(opaque);
#endif
}
#if 0 /* fixme: set complete random byte and clear out the unwanted ones*/
if( xbits ) {
p = (byte*)(a->d+n);
#ifdef LITTLE_ENDIAN_HOST
for(i=0; i < xbytes; i++ )
p[i] = fnc(opaque);
#else
for(i=xbytes-1; i>=0; i-- )
p[i] = fnc(opaque);
#endif
}
#endif
}
/****************
* Shift A by N bits to the right
* FIXME: should use alloc_limb if X and A are same.

View file

@ -397,7 +397,6 @@ mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign )
alimb |= *p-- << 16 ;
alimb |= *p-- << 24 ;
#elif BYTES_PER_MPI_LIMB == 8
/* cast due to egc's "left shift count >= width of type" warning*/
alimb = (mpi_limb_t)*p-- ;
alimb |= (mpi_limb_t)*p-- << 8 ;
alimb |= (mpi_limb_t)*p-- << 16 ;