mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
kbx: Fix searching for FPR20 in version 2 blob.
* kbx/keybox-search.c (blob_cmp_fpr_part): Don't change FPROFF, since it's caller which tweaks the offset. (has_short_kid, has_long_kid): Examine the key flags to determine if fingerprint 32 or 20. -- GnuPG-bug-id: 5888 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
ed53d41b4c
commit
01329da8a7
@ -304,8 +304,6 @@ blob_cmp_fpr_part (KEYBOXBLOB blob, const unsigned char *fpr,
|
|||||||
if (pos + (uint64_t)keyinfolen*nkeys > (uint64_t)length)
|
if (pos + (uint64_t)keyinfolen*nkeys > (uint64_t)length)
|
||||||
return 0; /* out of bounds */
|
return 0; /* out of bounds */
|
||||||
|
|
||||||
if (fpr32)
|
|
||||||
fproff = 0; /* keyid are the high-order bits. */
|
|
||||||
for (idx=0; idx < nkeys; idx++)
|
for (idx=0; idx < nkeys; idx++)
|
||||||
{
|
{
|
||||||
off = pos + idx*keyinfolen;
|
off = pos + idx*keyinfolen;
|
||||||
@ -702,7 +700,7 @@ has_short_kid (KEYBOXBLOB blob, u32 lkid)
|
|||||||
buf[2] = lkid >> 8;
|
buf[2] = lkid >> 8;
|
||||||
buf[3] = lkid;
|
buf[3] = lkid;
|
||||||
|
|
||||||
if (fpr32)
|
if (fpr32 && (get16 (buffer + 20 + 32) & 0x80))
|
||||||
return blob_cmp_fpr_part (blob, buf, 0, 4);
|
return blob_cmp_fpr_part (blob, buf, 0, 4);
|
||||||
else
|
else
|
||||||
return blob_cmp_fpr_part (blob, buf, 16, 4);
|
return blob_cmp_fpr_part (blob, buf, 16, 4);
|
||||||
@ -732,7 +730,7 @@ has_long_kid (KEYBOXBLOB blob, u32 mkid, u32 lkid)
|
|||||||
buf[6] = lkid >> 8;
|
buf[6] = lkid >> 8;
|
||||||
buf[7] = lkid;
|
buf[7] = lkid;
|
||||||
|
|
||||||
if (fpr32)
|
if (fpr32 && (get16 (buffer + 20 + 32) & 0x80))
|
||||||
return blob_cmp_fpr_part (blob, buf, 0, 8);
|
return blob_cmp_fpr_part (blob, buf, 0, 8);
|
||||||
else
|
else
|
||||||
return blob_cmp_fpr_part (blob, buf, 12, 8);
|
return blob_cmp_fpr_part (blob, buf, 12, 8);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user