From f63f0298ebbb00c082343b953a6c69131d129f2e Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sun, 27 Jul 2003 11:41:12 +0000 Subject: * gcrypt.h (gcry_mpi_scan, gcry_mpi_print): API change. (gcry_mpi_dump): New. * mpicoder.c (gcry_mpi_scan): New argument BUFLEN to replace the use of the intial value of NBYTES. (gcry_mpi_print): Likewise. (gcry_mpi_dump): New. (_gcry_log_mpidump): Make use of gcry_mpi_dump. (mpi_print): Removed. (gcry_mpi_scan): Allocated mpi in secure memory when required. * gcrypt.texi: Adjusted description of gcry_mpi_scan and gcry_mpi_dump. Add gcry_mpi_dump. --- doc/ChangeLog | 5 +++++ doc/gcrypt.texi | 32 +++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'doc') diff --git a/doc/ChangeLog b/doc/ChangeLog index 5750ba9e..a03fa063 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2003-07-27 Werner Koch + + * gcrypt.texi: Adjusted description of gcry_mpi_scan and + gcry_mpi_dump. Add gcry_mpi_dump. + 2003-07-22 Moritz Schulte * gcrypt.texi: Added more documentation for the register diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi index 693a1c1d..36489559 100644 --- a/doc/gcrypt.texi +++ b/doc/gcrypt.texi @@ -3314,15 +3314,16 @@ Swap the values of @var{a} and @var{b}. The following functions are used to convert between an external representation of an MPI and the internal one of @acronym{Libgcrypt}. -@deftypefun int gcry_mpi_scan (@w{gcry_mpi_t *@var{r_mpi}}, @w{enum gcry_mpi_format @var{format}}, @w{const char *@var{buffer}}, @w{size_t *@var{nbytes}}) +@deftypefun int gcry_mpi_scan (@w{gcry_mpi_t *@var{r_mpi}}, @w{enum gcry_mpi_format @var{format}}, @w{const char *@var{buffer}}, @w{size_t @var{buflen}}, @w{size_t *@var{nscanned}}) Convert the external representation of an integer stored in @var{buffer} -with a length stored at the address of @var{nbytes} into a newly created -MPI returned which will be stored at the address of @var{r_mpi}. For -certain formats the length argument is not required and may be passed as -@code{NULL}. After a successful operation the variable @var{nbytes} -points to, receives the number of bytes actually scanned. @var{format} -describes the format of the MPI as stored in @var{buffer}: +with a length of @var{buflen} into a newly created MPI returned which +will be stored at the address of @var{r_mpi}. For certain formats the +length argument is not required and may be passed as @code{0}. After a +successful operation the variable @var{nscanned} receives the number of +bytes actually scanned unless @var{nscanned} was given as +@code{NULL}. @var{format} describes the format of the MPI as stored in +@var{buffer}: @table @code @item GCRYMPI_FMT_STD @@ -3350,13 +3351,13 @@ format (MSB first). @end deftypefun -@deftypefun int gcry_mpi_print (@w{enum gcry_mpi_format @var{format}}, @w{char *@var{buffer}}, @w{size_t *@var{nbytes}}, @w{const gcry_mpi_t @var{a}}) +@deftypefun int gcry_mpi_print (@w{enum gcry_mpi_format @var{format}}, @w{char *@var{buffer}}, @w{size_t @var{buflen}}, @w{size_t *@var{nwritten}}, @w{const gcry_mpi_t @var{a}}) Convert the MPI @var{a} into an external representation described by @var{format} (see above) and store it in the provided @var{buffer} which -which has a usable length of at least the number of bytes stored in the -variable @var{nbytes} points to; this variable will receive the actual -number of bytes stored after a successful operation. +which has a usable length of at least the @var{buflen} bytes. If +@var{nwritten} is not NULL, it wilol receive the number of bytes +actually stored in @var{buffer} after a successful operation. @end deftypefun @deftypefun int gcry_mpi_aprint (@w{enum gcry_mpi_format @var{format}}, @w{void **@var{buffer}}, @w{size_t *@var{nbytes}}, @w{const gcry_mpi_t @var{a}}) @@ -3368,6 +3369,15 @@ number of bytes stored in this buffer will be stored in the variable @var{nbytes} points to, unless @var{nbytes} is @code{NULL}. @end deftypefun +@deftypefun void gcry_mpi_dump (@w{const gcry_mpi_t @var{a}}) + +Dump the value of @var{a} in a format suitable for debugging to +Libgcrypt's logging stream. Note that one leading space but no trailing +space or linefeed will be printed. It is okay to pass @code{NULL} for +@var{a}. +@end deftypefun + + @node Calculations @section Calculations -- cgit v1.2.1