mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-02 16:43:03 +01:00
sos: Fix fingerprint computation.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
f031b0fb6c
commit
638328a33d
@ -309,15 +309,7 @@ gpg_mpi_write (iobuf_t out, gcry_mpi_t a, unsigned int *r_nwritten)
|
|||||||
/* Strip leading zero bits. */
|
/* Strip leading zero bits. */
|
||||||
for (; nbits >= 8 && !*p; p++, nbits -= 8)
|
for (; nbits >= 8 && !*p; p++, nbits -= 8)
|
||||||
;
|
;
|
||||||
if (nbits >= 8 && !(*p & 0x80))
|
CALC_NBITS (nbits, p);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
/* gcry_log_debug (" [%u bit]\n", nbits); */
|
/* gcry_log_debug (" [%u bit]\n", nbits); */
|
||||||
/* gcry_log_debughex (" ", p, (nbits+7)/8); */
|
/* gcry_log_debughex (" ", p, (nbits+7)/8); */
|
||||||
|
@ -1336,6 +1336,7 @@ ecckey_from_sexp (gcry_mpi_t *array, gcry_sexp_t sexp, int algo)
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_OPAQUE);
|
array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_OPAQUE);
|
||||||
|
gcry_mpi_set_flag (array[1], GCRYMPI_FLAG_USER2);
|
||||||
gcry_sexp_release (l2);
|
gcry_sexp_release (l2);
|
||||||
if (!array[1])
|
if (!array[1])
|
||||||
{
|
{
|
||||||
|
@ -194,6 +194,8 @@ hash_public_key (gcry_md_hd_t md, PKT_public_key *pk)
|
|||||||
pp[i] = NULL;
|
pp[i] = NULL;
|
||||||
if (is_sos)
|
if (is_sos)
|
||||||
{
|
{
|
||||||
|
const unsigned char *p0 = p;
|
||||||
|
CALC_NBITS (nbits, p0);
|
||||||
pp[i][0] = (nbits >> 8);
|
pp[i][0] = (nbits >> 8);
|
||||||
pp[i][1] = nbits;
|
pp[i][1] = nbits;
|
||||||
}
|
}
|
||||||
|
10
g10/packet.h
10
g10/packet.h
@ -63,6 +63,16 @@
|
|||||||
#define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E)
|
#define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E)
|
||||||
#define is_DSA(a) ((a)==PUBKEY_ALGO_DSA)
|
#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. */
|
/* A pointer to the packet object. */
|
||||||
typedef struct packet_struct PACKET;
|
typedef struct packet_struct PACKET;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user