mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix SOS handling with libgcrypt version <= 1.8.
* g10/misc.c (checksum_mpi): Don't depend new feature of gcry_mpi_print which supports opaque MPI. -- GnuPG-bug-id: 5116 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
dd4fb1c8f6
commit
813e24108a
19
g10/misc.c
19
g10/misc.c
@ -257,6 +257,25 @@ checksum_mpi (gcry_mpi_t a)
|
||||
byte *buffer;
|
||||
size_t nbytes;
|
||||
|
||||
/*
|
||||
* This code can be skipped when gcry_mpi_print
|
||||
* supports opaque MPI.
|
||||
*/
|
||||
if (gcry_mpi_get_flag (a, GCRYMPI_FLAG_OPAQUE))
|
||||
{
|
||||
const byte *p;
|
||||
unsigned int nbits;
|
||||
|
||||
p = gcry_mpi_get_opaque (a, &nbits);
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
csum = nbits >> 8;
|
||||
csum += (nbits & 0xff);
|
||||
csum += checksum (p, (nbits+7)/8);
|
||||
return csum;
|
||||
}
|
||||
|
||||
if ( gcry_mpi_print (GCRYMPI_FMT_PGP, NULL, 0, &nbytes, a) )
|
||||
BUG ();
|
||||
/* Fixme: For numbers not in secure memory we should use a stack
|
||||
|
Loading…
x
Reference in New Issue
Block a user