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
|
@ -129,7 +129,7 @@ import_ownertrust (ctrl_t ctrl, const char *fname )
|
|||
char *p;
|
||||
size_t n, fprlen;
|
||||
unsigned int otrust;
|
||||
byte fpr[20];
|
||||
byte fpr[MAX_FINGERPRINT_LEN];
|
||||
int any = 0;
|
||||
int rc;
|
||||
|
||||
|
@ -171,7 +171,7 @@ import_ownertrust (ctrl_t ctrl, const char *fname )
|
|||
continue;
|
||||
}
|
||||
fprlen = p - line;
|
||||
if( fprlen != 32 && fprlen != 40 ) {
|
||||
if( fprlen != 32 && fprlen != 40 && fprlen != 64) {
|
||||
log_error (_("error in '%s': %s\n"),
|
||||
fname, _("invalid fingerprint") );
|
||||
continue;
|
||||
|
@ -183,10 +183,12 @@ import_ownertrust (ctrl_t ctrl, const char *fname )
|
|||
}
|
||||
if( !otrust )
|
||||
continue; /* no otrust defined - no need to update or insert */
|
||||
/* convert the ascii fingerprint to binary */
|
||||
for(p=line, fprlen=0; fprlen < 20 && *p != ':'; p += 2 )
|
||||
fpr[fprlen++] = HEXTOBIN(p[0]) * 16 + HEXTOBIN(p[1]);
|
||||
while (fprlen < 20)
|
||||
/* Convert the ascii fingerprint to binary */
|
||||
for(p=line, fprlen=0;
|
||||
fprlen < MAX_FINGERPRINT_LEN && *p != ':';
|
||||
p += 2 )
|
||||
fpr[fprlen++] = HEXTOBIN(p[0]) * 16 + HEXTOBIN(p[1]);
|
||||
while (fprlen < MAX_FINGERPRINT_LEN)
|
||||
fpr[fprlen++] = 0;
|
||||
|
||||
rc = tdbio_search_trust_byfpr (fpr, &rec);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue