summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/gcrypt.texi6
-rw-r--r--mpi/ChangeLog3
-rw-r--r--mpi/mpicoder.c10
-rw-r--r--src/gcrypt.h7
4 files changed, 15 insertions, 11 deletions
diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index 64ca4478..d6bc9987 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -3311,7 +3311,7 @@ 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{buflen}}, @w{size_t *@var{nscanned}})
+@deftypefun int gcry_mpi_scan (@w{gcry_mpi_t *@var{r_mpi}}, @w{enum gcry_mpi_format @var{format}}, @w{const unsigned 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 of @var{buflen} into a newly created MPI returned which
@@ -3348,7 +3348,7 @@ 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{buflen}}, @w{size_t *@var{nwritten}}, @w{const gcry_mpi_t @var{a}})
+@deftypefun int gcry_mpi_print (@w{enum gcry_mpi_format @var{format}}, @w{unsigned 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
@@ -3357,7 +3357,7 @@ which has a usable length of at least the @var{buflen} bytes. If
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}})
+@deftypefun int gcry_mpi_aprint (@w{enum gcry_mpi_format @var{format}}, @w{unsigned char **@var{buffer}}, @w{size_t *@var{nbytes}}, @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 a newly allocated buffer which
diff --git a/mpi/ChangeLog b/mpi/ChangeLog
index 87161f9e..b2701607 100644
--- a/mpi/ChangeLog
+++ b/mpi/ChangeLog
@@ -1,12 +1,13 @@
2003-07-27 Werner Koch <wk@gnupg.org>
* mpicoder.c (gcry_mpi_scan): New argument BUFLEN to replace the
- use of the intial value of NBYTES.
+ use of the intial value of NBYTES. Changed BUFFER to unsigned.
(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.
+ (gcry_mpi_aprint): Changed BUFFER to unsigned char*.
2003-07-14 Moritz Schulte <moritz@g10code.com>
diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c
index fa390920..d501fe4b 100644
--- a/mpi/mpicoder.c
+++ b/mpi/mpicoder.c
@@ -333,7 +333,7 @@ _gcry_mpi_set_buffer( gcry_mpi_t a, const byte *buffer, unsigned nbytes, int sig
bytes actually scanned after a successful operation. */
gcry_error_t
gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
- const char *buffer, size_t buflen, size_t *nscanned )
+ const unsigned char *buffer, size_t buflen, size_t *nscanned )
{
struct gcry_mpi *a = NULL;
unsigned int len;
@@ -458,7 +458,8 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
has been passed as NULL. BUFFER may be NULL to query the required
length.*/
gcry_error_t
-gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t buflen,
+gcry_mpi_print( enum gcry_mpi_format format,
+ unsigned char *buffer, size_t buflen,
size_t *nwritten, struct gcry_mpi *a)
{
unsigned int nbits = mpi_get_nbits(a);
@@ -600,7 +601,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t buflen,
*s++ = c < 10? '0'+c : 'A'+c-10 ;
}
*s++ = 0;
- *nwritten = (char*)s - buffer;
+ *nwritten = s - buffer;
}
else {
*nwritten = 2*n + extra + !!a->sign + 1;
@@ -618,7 +619,8 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t buflen,
* NULL.
*/
gcry_error_t
-gcry_mpi_aprint( enum gcry_mpi_format format, void **buffer, size_t *nwritten,
+gcry_mpi_aprint( enum gcry_mpi_format format,
+ unsigned char **buffer, size_t *nwritten,
struct gcry_mpi *a )
{
size_t n;
diff --git a/src/gcrypt.h b/src/gcrypt.h
index 7bb12f93..95aee42a 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -379,7 +379,7 @@ int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v);
RET_MPI. If NSCANNED is not NULL, it will receive the number of
bytes actually scanned after a successful operation. */
gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
- const char *buffer, size_t buflen,
+ const unsigned char *buffer, size_t buflen,
size_t *nscanned);
/* Convert the big integer A into the external representation
@@ -388,7 +388,8 @@ gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
receives the actual length of the external representation unless it
has been passed as NULL. */
gcry_error_t gcry_mpi_print (enum gcry_mpi_format format,
- char *buffer, size_t buflen, size_t *nwritten,
+ unsigned char *buffer, size_t buflen,
+ size_t *nwritten,
const gcry_mpi_t a);
/* Convert the big integer A int the external representation described
@@ -396,7 +397,7 @@ gcry_error_t gcry_mpi_print (enum gcry_mpi_format format,
will be put into BUFFER. NWRITTEN receives the actual lengths of the
external representation. */
gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format,
- void **buffer, size_t *nwritten,
+ unsigned char **buffer, size_t *nwritten,
const gcry_mpi_t a);
/* Dump the value of A in a format suitable for debugging to