mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Prepare for a longer fingerprint
* g10/card-util.c (change_cafpr): Use MAX_FINGERPRINT_LEN. * g10/cipher.c (write_header): Use snprintf. * g10/gpg.h (MAX_FINGERPRINT_LEN): Change to 32. (MAX_FORMATTED_FINGERPRINT_LEN): Change to 59 * g10/keyid.c (format_hexfingerprint): Add v5 fingerprint format. * g10/tofu.c (get_policy): Use MAX_FINGERPRINT_LEN for the buffer but keep the raw length for now. -- Note that this patch only increases the size of the buffer and adds a new formatting for v5 fingerprints. Moe work is required to fix internal data structures like those in trustdb.gpg and the tofu tables. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
76c80021d4
commit
ecbbafb88d
8 changed files with 65 additions and 22 deletions
|
@ -1121,7 +1121,8 @@ change_cafpr (int fprno)
|
|||
char *data;
|
||||
const char *s;
|
||||
int i, c, rc;
|
||||
unsigned char fpr[20];
|
||||
unsigned char fpr[MAX_FINGERPRINT_LEN];
|
||||
int fprlen;
|
||||
|
||||
data = cpr_get ("cardedit.change_cafpr", _("CA fingerprint: "));
|
||||
if (!data)
|
||||
|
@ -1129,7 +1130,7 @@ change_cafpr (int fprno)
|
|||
trim_spaces (data);
|
||||
cpr_kill_prompt ();
|
||||
|
||||
for (i=0, s=data; i < 20 && *s; )
|
||||
for (i=0, s=data; i < MAX_FINGERPRINT_LEN && *s; )
|
||||
{
|
||||
while (spacep(s))
|
||||
s++;
|
||||
|
@ -1143,8 +1144,9 @@ change_cafpr (int fprno)
|
|||
fpr[i++] = c;
|
||||
s += 2;
|
||||
}
|
||||
fprlen = i;
|
||||
xfree (data);
|
||||
if (i != 20 || *s)
|
||||
if ((fprlen != 20 && fprlen != 32) || *s)
|
||||
{
|
||||
tty_printf (_("Error: invalid formatted fingerprint.\n"));
|
||||
return -1;
|
||||
|
@ -1152,7 +1154,7 @@ change_cafpr (int fprno)
|
|||
|
||||
rc = agent_scd_setattr (fprno==1?"CA-FPR-1":
|
||||
fprno==2?"CA-FPR-2":
|
||||
fprno==3?"CA-FPR-3":"x", fpr, 20, NULL );
|
||||
fprno==3?"CA-FPR-3":"x", fpr, fprlen, NULL );
|
||||
if (rc)
|
||||
log_error ("error setting cafpr: %s\n", gpg_strerror (rc));
|
||||
write_sc_op_status (rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue