mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-08 21:18:51 +01:00
gpg: Support MPI(0) by sos_read and mpi_print.
* g10/misc.c (mpi_print): Handle the case for MPI(0). * g10/parse-packet.c (sos_read): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
c450eb1ccb
commit
7b0a7c7148
@ -1846,7 +1846,7 @@ mpi_print (estream_t fp, gcry_mpi_t a, int mode)
|
|||||||
unsigned int nbits;
|
unsigned int nbits;
|
||||||
unsigned char *p = gcry_mpi_get_opaque (a, &nbits);
|
unsigned char *p = gcry_mpi_get_opaque (a, &nbits);
|
||||||
if (!p)
|
if (!p)
|
||||||
n += es_fprintf (fp, "[invalid opaque value]");
|
n += es_fprintf (fp, "[NONE]");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!es_write_hexstring (fp, p, (nbits + 7)/8, 0, &nwritten))
|
if (!es_write_hexstring (fp, p, (nbits + 7)/8, 0, &nwritten))
|
||||||
|
@ -229,7 +229,10 @@ sos_read (iobuf_t inp, unsigned int *ret_nread, int secure)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nbytes = (nbits + 7) / 8;
|
nbytes = (nbits + 7) / 8;
|
||||||
|
if (nbytes)
|
||||||
buf = secure ? gcry_xmalloc_secure (nbytes) : gcry_xmalloc (nbytes);
|
buf = secure ? gcry_xmalloc_secure (nbytes) : gcry_xmalloc (nbytes);
|
||||||
|
else
|
||||||
|
buf = NULL;
|
||||||
p = buf;
|
p = buf;
|
||||||
for (i = 0; i < nbytes; i++)
|
for (i = 0; i < nbytes; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user