mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: Fix gpg_mpi_write for the unused opaque case.
* g10/build-packet.c (gpg_mpi_write): Take care of the fact that get_opaque already returns a bit-exact value. -- Fixes-commit: ab17f7b6c392782718f57eaea94fc18a0ff49389 Reported-by: Falko Strenzke <falko.strenzke@mtg.de>
This commit is contained in:
parent
a09157ccb2
commit
2372f6a403
@ -306,7 +306,9 @@ gpg_mpi_write (iobuf_t out, gcry_mpi_t a, unsigned int *r_nwritten)
|
|||||||
p = gcry_mpi_get_opaque (a, &nbits);
|
p = gcry_mpi_get_opaque (a, &nbits);
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
/* Strip leading zero bits. */
|
/* First get nbits back to full bytes. */
|
||||||
|
nbits = ((nbits + 7) / 8) * 8;
|
||||||
|
/* Then strip leading zero bits. */
|
||||||
for (; nbits >= 8 && !*p; p++, nbits -= 8)
|
for (; nbits >= 8 && !*p; p++, nbits -= 8)
|
||||||
;
|
;
|
||||||
if (nbits >= 8 && !(*p & 0x80))
|
if (nbits >= 8 && !(*p & 0x80))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user