diff options
author | NIIBE Yutaka <[email protected]> | 2020-05-08 02:42:20 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2020-05-08 02:42:20 +0000 |
commit | e6c975280ac0d01ad02669478465acc49a4dcfbb (patch) | |
tree | d177d3ea368a96f0d1ed11752a6e2b7c3b165d1f | |
parent | ecc-sos: Fix gpg_mpi_write for opaque bit string. (diff) | |
download | gnupg-e6c975280ac0d01ad02669478465acc49a4dcfbb.tar.gz gnupg-e6c975280ac0d01ad02669478465acc49a4dcfbb.zip |
ecc-sos: Remove zero-octet removal on write.
* g10/build-packet.c (gpg_mpi_write): Don't remove zero bits.
* g10/packet.h (CALC_NBITS): Remove.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | g10/build-packet.c | 8 | ||||
-rw-r--r-- | g10/packet.h | 10 |
2 files changed, 0 insertions, 18 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c index 2e100f179..e0570806e 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -304,14 +304,6 @@ gpg_mpi_write (iobuf_t out, gcry_mpi_t a, unsigned int *r_nwritten) /* gcry_log_debugmpi ("a", a); */ p = gcry_mpi_get_opaque (a, &nbits); - if (p) - { - nbits = ((nbits + 7)/8)*8; - /* Strip leading zero bits. */ - for (; nbits >= 8 && !*p; p++, nbits -= 8) - ; - CALC_NBITS (nbits, p); - } /* gcry_log_debug (" [%u bit]\n", nbits); */ /* gcry_log_debughex (" ", p, (nbits+7)/8); */ lenhdr[0] = nbits >> 8; diff --git a/g10/packet.h b/g10/packet.h index 7bf379af5..ed0749cb8 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -63,16 +63,6 @@ #define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E) #define is_DSA(a) ((a)==PUBKEY_ALGO_DSA) -#define CALC_NBITS(nbits,p) if (nbits >= 8 && !(*p & 0x80)) \ - if (--nbits >= 7 && !(*p & 0x40)) \ - if (--nbits >= 6 && !(*p & 0x20)) \ - if (--nbits >= 5 && !(*p & 0x10)) \ - if (--nbits >= 4 && !(*p & 0x08)) \ - if (--nbits >= 3 && !(*p & 0x04)) \ - if (--nbits >= 2 && !(*p & 0x02)) \ - if (--nbits >= 1 && !(*p & 0x01)) \ - --nbits - /* A pointer to the packet object. */ typedef struct packet_struct PACKET; |