aboutsummaryrefslogtreecommitdiffstats
path: root/mpi/mpicoder.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-04-07 18:16:10 +0000
committerWerner Koch <[email protected]>1998-04-07 18:16:10 +0000
commit86f261dbc50544d73e4b9ae71fcbc2c6df5b9612 (patch)
treed3ba75484a73e1fe891f7ff862ab1f3722cb126c /mpi/mpicoder.c
parentcast5 does now work (diff)
downloadgnupg-86f261dbc50544d73e4b9ae71fcbc2c6df5b9612.tar.gz
gnupg-86f261dbc50544d73e4b9ae71fcbc2c6df5b9612.zip
cipher reorganisiert
Diffstat (limited to 'mpi/mpicoder.c')
-rw-r--r--mpi/mpicoder.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c
index 4d3f454ac..9362aff65 100644
--- a/mpi/mpicoder.c
+++ b/mpi/mpicoder.c
@@ -54,8 +54,6 @@ mpi_write( IOBUF out, MPI a )
iobuf_put(out, (nbits) );
p = buf = mpi_get_buffer( a, &n, NULL );
- for( ; !*p && n; p++, n-- )
- ;
rc = iobuf_write( out, p, n );
m_free(buf);
return rc;
@@ -302,6 +300,13 @@ mpi_get_buffer( MPI a, unsigned *nbytes, int *sign )
#error please implement for this limb size.
#endif
}
+
+ /* this is sub-optimal but we need to do the shift oepration because
+ * the caller has to free the returned buffer */
+ for(p=buffer; !*p && *nbytes; p++, --*nbytes )
+ ;
+ if( p != buffer )
+ memmove(buffer,p, *nbytes);
return buffer;
}