mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix compute_fingerprint for ECC with SOS.
* g10/keyid.c (hash_public_key): Tweak NBITS just as sos_write does. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
8cad11d13b
commit
cfc1497efa
17
g10/keyid.c
17
g10/keyid.c
@ -180,7 +180,7 @@ hash_public_key (gcry_md_hd_t md, PKT_public_key *pk)
|
||||
}
|
||||
else if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_OPAQUE))
|
||||
{
|
||||
const void *p;
|
||||
const char *p;
|
||||
int is_sos = 0;
|
||||
|
||||
if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_USER2))
|
||||
@ -194,6 +194,21 @@ hash_public_key (gcry_md_hd_t md, PKT_public_key *pk)
|
||||
pp[i] = NULL;
|
||||
if (is_sos)
|
||||
{
|
||||
if (*p)
|
||||
{
|
||||
nbits = ((nbits + 7) / 8) * 8;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
pp[i][0] = (nbits >> 8);
|
||||
pp[i][1] = nbits;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user