summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-03-14 14:55:06 +0100
committerWerner Koch <wk@gnupg.org>2019-03-14 14:55:06 +0100
commitbdda31a26bc69b6ee72e964510db113645de76ef (patch)
treee4e9f9b71a4b3a6cf64821f33f851bd2fcc559a4 /common
parentgpg: Make rfc4880bis the default. (diff)
downloadgnupg2-bdda31a26bc69b6ee72e964510db113645de76ef.tar.xz
gnupg2-bdda31a26bc69b6ee72e964510db113645de76ef.zip
kbx: Unify the fingerprint search modes.
* kbx/keybox-search-desc.h (KEYDB_SEARCH_MODE_FPR16) (KEYDB_SEARCH_MODE_FPR20, KEYDB_SEARCH_MODE_FPR32): Remove. Switch all users to KEYDB_SEARCH_MODE_FPR along with the fprlen value. -- These search modes were added over time and there has until recently be no incentive to remove the cruft. With the change for v5 keys I finally went over all places and allowed the generic fingerprint mode along with a given length of the fingerprint at all places. Consequently the other modes can now be removed. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'common')
-rw-r--r--common/userids.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/common/userids.c b/common/userids.c
index 41cf2876c..181b48866 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -327,9 +327,10 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
}
desc->u.fpr[i] = c;
}
+ desc->fprlen = 16;
for (; i < 32; i++)
desc->u.fpr[i]= 0;
- mode = KEYDB_SEARCH_MODE_FPR16;
+ mode = KEYDB_SEARCH_MODE_FPR;
}
else if ((hexlength == 40
&& (s[hexlength] == 0
@@ -350,9 +351,10 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
}
desc->u.fpr[i] = c;
}
+ desc->fprlen = 20;
for (; i < 32; i++)
desc->u.fpr[i]= 0;
- mode = KEYDB_SEARCH_MODE_FPR20;
+ mode = KEYDB_SEARCH_MODE_FPR;
}
else if ((hexlength == 64
&& (s[hexlength] == 0
@@ -373,7 +375,8 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
}
desc->u.fpr[i] = c;
}
- mode = KEYDB_SEARCH_MODE_FPR32;
+ desc->fprlen = 32;
+ mode = KEYDB_SEARCH_MODE_FPR;
}
else if (!hexprefix)
{
@@ -393,7 +396,10 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
desc->u.fpr[i] = c;
}
if (i == 20)
- mode = KEYDB_SEARCH_MODE_FPR20;
+ {
+ desc->fprlen = 20;
+ mode = KEYDB_SEARCH_MODE_FPR;
+ }
for (; i < 32; i++)
desc->u.fpr[i]= 0;
}
@@ -438,7 +444,10 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
s += 2;
}
if (i == 20)
- mode = KEYDB_SEARCH_MODE_FPR20;
+ {
+ desc->fprlen = 20;
+ mode = KEYDB_SEARCH_MODE_FPR;
+ }
for (; i < 32; i++)
desc->u.fpr[i]= 0;
}