aboutsummaryrefslogtreecommitdiffstats
path: root/mpi/mpicoder.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-08-13 05:55:16 +0000
committerWerner Koch <[email protected]>2002-08-13 05:55:16 +0000
commita4750ea3de7f523353bb88f4497803e20c52d456 (patch)
tree388a347f21a1e7d187484e08977577f2f33e95ad /mpi/mpicoder.c
parent* cipher.c: Include the DUMMY cipher only when the new ALLOW_DUMMY (diff)
downloadgnupg-a4750ea3de7f523353bb88f4497803e20c52d456.tar.gz
gnupg-a4750ea3de7f523353bb88f4497803e20c52d456.zip
* mpicoder.c (do_get_buffer): Don't remove leading zeros if the
MPI is marked as protected.
Diffstat (limited to 'mpi/mpicoder.c')
-rw-r--r--mpi/mpicoder.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c
index e0434c15f..559facd89 100644
--- a/mpi/mpicoder.c
+++ b/mpi/mpicoder.c
@@ -363,12 +363,15 @@ do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure )
#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);
+ if (!mpi_is_protected (a))
+ {
+ /* this is sub-optimal but we need to do the shift operation
+ * 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;
}