mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Tue May 4 15:49:29 CEST 1999 Werner Koch
This commit is contained in:
parent
88374b2ab3
commit
e5a79b2da8
9 changed files with 90 additions and 54 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue May 4 15:47:53 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* mpiutil.c (mpi_alloc_like): New.
|
||||
|
||||
Mon Apr 26 17:48:15 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* mpih-add.c, mpih-sub.c: Removed
|
||||
|
|
|
@ -323,6 +323,36 @@ mpi_copy( MPI a )
|
|||
}
|
||||
|
||||
|
||||
/****************
|
||||
* This function allocates an MPI which is optimized to hold
|
||||
* a value as large as the one given in the arhgument and allocates it
|
||||
* with the same flags as A.
|
||||
*/
|
||||
MPI
|
||||
mpi_alloc_like( MPI a )
|
||||
{
|
||||
MPI b;
|
||||
|
||||
if( a && (a->flags & 4) ) {
|
||||
void *p = m_is_secure(a->d)? m_alloc_secure( a->nbits )
|
||||
: m_alloc( a->nbits );
|
||||
memcpy( p, a->d, a->nbits );
|
||||
b = mpi_set_opaque( NULL, p, a->nbits );
|
||||
}
|
||||
else if( a ) {
|
||||
b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs )
|
||||
: mpi_alloc( a->nlimbs );
|
||||
b->nlimbs = 0;
|
||||
b->sign = 0;
|
||||
b->flags = a->flags;
|
||||
b->nbits = 0;
|
||||
}
|
||||
else
|
||||
b = NULL;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mpi_set( MPI w, MPI u)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue