mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Rename functions with an "fprint" part to "fpr"
-- The fprint is too uncommon in our code base and to similar to fprintf.
This commit is contained in:
parent
8624482160
commit
04ce6765f4
@ -699,7 +699,7 @@ current_card_status (ctrl_t ctrl, estream_t fp,
|
|||||||
/* If the fingerprint is all 0xff, the key has no associated
|
/* If the fingerprint is all 0xff, the key has no associated
|
||||||
OpenPGP certificate. */
|
OpenPGP certificate. */
|
||||||
if ( thefpr && !fpr_is_ff (thefpr, thefprlen)
|
if ( thefpr && !fpr_is_ff (thefpr, thefprlen)
|
||||||
&& !get_pubkey_byfprint (ctrl, pk, &keyblock, thefpr, thefprlen))
|
&& !get_pubkey_byfpr (ctrl, pk, &keyblock, thefpr, thefprlen))
|
||||||
{
|
{
|
||||||
print_key_info (ctrl, fp, 0, pk, 0);
|
print_key_info (ctrl, fp, 0, pk, 0);
|
||||||
print_card_key_info (fp, keyblock);
|
print_card_key_info (fp, keyblock);
|
||||||
@ -917,8 +917,8 @@ fetch_url (ctrl_t ctrl)
|
|||||||
}
|
}
|
||||||
else if (info.fpr1len)
|
else if (info.fpr1len)
|
||||||
{
|
{
|
||||||
rc = keyserver_import_fprint (ctrl, info.fpr1, info.fpr1len,
|
rc = keyserver_import_fpr (ctrl, info.fpr1, info.fpr1len,
|
||||||
opt.keyserver, 0);
|
opt.keyserver, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
75
g10/getkey.c
75
g10/getkey.c
@ -326,7 +326,7 @@ get_pubkey_for_sig (ctrl_t ctrl, PKT_public_key *pk, PKT_signature *sig,
|
|||||||
|
|
||||||
/* First try the ISSUER_FPR info. */
|
/* First try the ISSUER_FPR info. */
|
||||||
fpr = issuer_fpr_raw (sig, &fprlen);
|
fpr = issuer_fpr_raw (sig, &fprlen);
|
||||||
if (fpr && !get_pubkey_byfprint (ctrl, pk, NULL, fpr, fprlen))
|
if (fpr && !get_pubkey_byfpr (ctrl, pk, NULL, fpr, fprlen))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Fallback to use the ISSUER_KEYID. */
|
/* Fallback to use the ISSUER_KEYID. */
|
||||||
@ -571,7 +571,7 @@ get_pubkeyblock_for_sig (ctrl_t ctrl, PKT_signature *sig)
|
|||||||
|
|
||||||
/* First try the ISSUER_FPR info. */
|
/* First try the ISSUER_FPR info. */
|
||||||
fpr = issuer_fpr_raw (sig, &fprlen);
|
fpr = issuer_fpr_raw (sig, &fprlen);
|
||||||
if (fpr && !get_pubkey_byfprint (ctrl, NULL, &keyblock, fpr, fprlen))
|
if (fpr && !get_pubkey_byfpr (ctrl, NULL, &keyblock, fpr, fprlen))
|
||||||
return keyblock;
|
return keyblock;
|
||||||
|
|
||||||
/* Fallback to use the ISSUER_KEYID. */
|
/* Fallback to use the ISSUER_KEYID. */
|
||||||
@ -1194,8 +1194,8 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
|
|||||||
mechanism_string = "NTDS";
|
mechanism_string = "NTDS";
|
||||||
glo_ctrl.in_auto_key_retrieve++;
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
if (is_fpr)
|
if (is_fpr)
|
||||||
rc = keyserver_import_fprint_ntds (ctrl,
|
rc = keyserver_import_fpr_ntds (ctrl,
|
||||||
fprbuf.u.fpr, fprbuf.fprlen);
|
fprbuf.u.fpr, fprbuf.fprlen);
|
||||||
else
|
else
|
||||||
rc = keyserver_import_ntds (ctrl, name, &fpr, &fpr_len);
|
rc = keyserver_import_ntds (ctrl, name, &fpr, &fpr_len);
|
||||||
glo_ctrl.in_auto_key_retrieve--;
|
glo_ctrl.in_auto_key_retrieve--;
|
||||||
@ -1212,10 +1212,10 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
|
|||||||
glo_ctrl.in_auto_key_retrieve++;
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
if (is_fpr)
|
if (is_fpr)
|
||||||
{
|
{
|
||||||
rc = keyserver_import_fprint (ctrl,
|
rc = keyserver_import_fpr (ctrl,
|
||||||
fprbuf.u.fpr, fprbuf.fprlen,
|
fprbuf.u.fpr, fprbuf.fprlen,
|
||||||
opt.keyserver,
|
opt.keyserver,
|
||||||
KEYSERVER_IMPORT_FLAG_LDAP);
|
KEYSERVER_IMPORT_FLAG_LDAP);
|
||||||
/* Map error codes because Dirmngr returns NO
|
/* Map error codes because Dirmngr returns NO
|
||||||
* DATA if the keyserver does not have the
|
* DATA if the keyserver does not have the
|
||||||
* requested key. It returns NO KEYSERVER if no
|
* requested key. It returns NO KEYSERVER if no
|
||||||
@ -1247,10 +1247,10 @@ get_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
|
|||||||
glo_ctrl.in_auto_key_retrieve++;
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
if (is_fpr)
|
if (is_fpr)
|
||||||
{
|
{
|
||||||
rc = keyserver_import_fprint (ctrl,
|
rc = keyserver_import_fpr (ctrl,
|
||||||
fprbuf.u.fpr, fprbuf.fprlen,
|
fprbuf.u.fpr, fprbuf.fprlen,
|
||||||
opt.keyserver,
|
opt.keyserver,
|
||||||
KEYSERVER_IMPORT_FLAG_LDAP);
|
KEYSERVER_IMPORT_FLAG_LDAP);
|
||||||
if (gpg_err_code (rc) == GPG_ERR_NO_DATA
|
if (gpg_err_code (rc) == GPG_ERR_NO_DATA
|
||||||
|| gpg_err_code (rc) == GPG_ERR_NO_KEYSERVER)
|
|| gpg_err_code (rc) == GPG_ERR_NO_KEYSERVER)
|
||||||
rc = gpg_error (GPG_ERR_NO_PUBKEY);
|
rc = gpg_error (GPG_ERR_NO_PUBKEY);
|
||||||
@ -1831,8 +1831,8 @@ get_pubkey_from_buffer (ctrl_t ctrl, PKT_public_key *pkbuf,
|
|||||||
* returned in *R_KEYBLOCK. This should be freed using
|
* returned in *R_KEYBLOCK. This should be freed using
|
||||||
* release_kbnode().
|
* release_kbnode().
|
||||||
*
|
*
|
||||||
* FPRINT is a byte array whose contents is the fingerprint to use as
|
* FPR is a byte array whose contents is the fingerprint to use as
|
||||||
* the search term. FPRINT_LEN specifies the length of the
|
* the search term. FPRLEN specifies the length of the
|
||||||
* fingerprint (in bytes). Currently, only 16, 20, and 32-byte
|
* fingerprint (in bytes). Currently, only 16, 20, and 32-byte
|
||||||
* fingerprints are supported.
|
* fingerprints are supported.
|
||||||
*
|
*
|
||||||
@ -1840,15 +1840,15 @@ get_pubkey_from_buffer (ctrl_t ctrl, PKT_public_key *pkbuf,
|
|||||||
* be done by creating a userID conforming to the unified fingerprint
|
* be done by creating a userID conforming to the unified fingerprint
|
||||||
* style. */
|
* style. */
|
||||||
int
|
int
|
||||||
get_pubkey_byfprint (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
get_pubkey_byfpr (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
||||||
const byte * fprint, size_t fprint_len)
|
const byte *fpr, size_t fprlen)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (r_keyblock)
|
if (r_keyblock)
|
||||||
*r_keyblock = NULL;
|
*r_keyblock = NULL;
|
||||||
|
|
||||||
if (fprint_len == 32 || fprint_len == 20 || fprint_len == 16)
|
if (fprlen == 32 || fprlen == 20 || fprlen == 16)
|
||||||
{
|
{
|
||||||
struct getkey_ctx_s ctx;
|
struct getkey_ctx_s ctx;
|
||||||
KBNODE kb = NULL;
|
KBNODE kb = NULL;
|
||||||
@ -1865,8 +1865,8 @@ get_pubkey_byfprint (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
|||||||
|
|
||||||
ctx.nitems = 1;
|
ctx.nitems = 1;
|
||||||
ctx.items[0].mode = KEYDB_SEARCH_MODE_FPR;
|
ctx.items[0].mode = KEYDB_SEARCH_MODE_FPR;
|
||||||
memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
|
memcpy (ctx.items[0].u.fpr, fpr, fprlen);
|
||||||
ctx.items[0].fprlen = fprint_len;
|
ctx.items[0].fprlen = fprlen;
|
||||||
if (pk)
|
if (pk)
|
||||||
ctx.req_usage = pk->req_usage;
|
ctx.req_usage = pk->req_usage;
|
||||||
rc = lookup (ctrl, &ctx, 0, &kb, &found_key);
|
rc = lookup (ctrl, &ctx, 0, &kb, &found_key);
|
||||||
@ -1886,7 +1886,7 @@ get_pubkey_byfprint (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function is similar to get_pubkey_byfprint, but it doesn't
|
/* This function is similar to get_pubkey_byfpr, but it doesn't
|
||||||
* merge the self-signed data into the public key and subkeys or into
|
* merge the self-signed data into the public key and subkeys or into
|
||||||
* the user ids. It also doesn't add the key to the user id cache.
|
* the user ids. It also doesn't add the key to the user id cache.
|
||||||
* Further, this function ignores PK->REQ_USAGE.
|
* Further, this function ignores PK->REQ_USAGE.
|
||||||
@ -1894,17 +1894,16 @@ get_pubkey_byfprint (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
|||||||
* This function is intended to avoid recursion and, as such, should
|
* This function is intended to avoid recursion and, as such, should
|
||||||
* only be used in very specific situations.
|
* only be used in very specific situations.
|
||||||
*
|
*
|
||||||
* Like get_pubkey_byfprint, PK may be NULL. In that case, this
|
* Like get_pubkey_byfpr, PK may be NULL. In that case, this
|
||||||
* function effectively just checks for the existence of the key. */
|
* function effectively just checks for the existence of the key. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
get_pubkey_byfprint_fast (ctrl_t ctrl, PKT_public_key * pk,
|
get_pubkey_byfpr_fast (ctrl_t ctrl, PKT_public_key * pk,
|
||||||
const byte * fprint, size_t fprint_len)
|
const byte *fpr, size_t fprlen)
|
||||||
{
|
{
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
KBNODE keyblock;
|
KBNODE keyblock;
|
||||||
|
|
||||||
err = get_keyblock_byfprint_fast (ctrl,
|
err = get_keyblock_byfpr_fast (ctrl, &keyblock, NULL, fpr, fprlen, 0);
|
||||||
&keyblock, NULL, fprint, fprint_len, 0);
|
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
if (pk)
|
if (pk)
|
||||||
@ -1916,7 +1915,7 @@ get_pubkey_byfprint_fast (ctrl_t ctrl, PKT_public_key * pk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function is similar to get_pubkey_byfprint_fast but returns a
|
/* This function is similar to get_pubkey_byfpr_fast but returns a
|
||||||
* keydb handle at R_HD and the keyblock at R_KEYBLOCK. R_KEYBLOCK or
|
* keydb handle at R_HD and the keyblock at R_KEYBLOCK. R_KEYBLOCK or
|
||||||
* R_HD may be NULL. If LOCK is set the handle has been opend in
|
* R_HD may be NULL. If LOCK is set the handle has been opend in
|
||||||
* locked mode and keydb_disable_caching () has been called. On error
|
* locked mode and keydb_disable_caching () has been called. On error
|
||||||
@ -1924,9 +1923,9 @@ get_pubkey_byfprint_fast (ctrl_t ctrl, PKT_public_key * pk,
|
|||||||
* it may have a value of NULL, though. This allows one to do an insert
|
* it may have a value of NULL, though. This allows one to do an insert
|
||||||
* operation on a locked keydb handle. */
|
* operation on a locked keydb handle. */
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
get_keyblock_byfprint_fast (ctrl_t ctrl,
|
get_keyblock_byfpr_fast (ctrl_t ctrl,
|
||||||
kbnode_t *r_keyblock, KEYDB_HANDLE *r_hd,
|
kbnode_t *r_keyblock, KEYDB_HANDLE *r_hd,
|
||||||
const byte *fprint, size_t fprint_len, int lock)
|
const byte *fpr, size_t fprlen, int lock)
|
||||||
{
|
{
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
KEYDB_HANDLE hd;
|
KEYDB_HANDLE hd;
|
||||||
@ -1939,8 +1938,8 @@ get_keyblock_byfprint_fast (ctrl_t ctrl,
|
|||||||
if (r_hd)
|
if (r_hd)
|
||||||
*r_hd = NULL;
|
*r_hd = NULL;
|
||||||
|
|
||||||
for (i = 0; i < MAX_FINGERPRINT_LEN && i < fprint_len; i++)
|
for (i = 0; i < MAX_FINGERPRINT_LEN && i < fprlen; i++)
|
||||||
fprbuf[i] = fprint[i];
|
fprbuf[i] = fpr[i];
|
||||||
|
|
||||||
hd = keydb_new (ctrl);
|
hd = keydb_new (ctrl);
|
||||||
if (!hd)
|
if (!hd)
|
||||||
@ -1964,7 +1963,7 @@ get_keyblock_byfprint_fast (ctrl_t ctrl,
|
|||||||
if (r_hd)
|
if (r_hd)
|
||||||
*r_hd = hd;
|
*r_hd = hd;
|
||||||
|
|
||||||
err = keydb_search_fpr (hd, fprbuf, fprint_len);
|
err = keydb_search_fpr (hd, fprbuf, fprlen);
|
||||||
if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
||||||
{
|
{
|
||||||
if (!r_hd)
|
if (!r_hd)
|
||||||
@ -4081,16 +4080,16 @@ get_seckey_default_or_card (ctrl_t ctrl, PKT_public_key *pk,
|
|||||||
add_to_strlist (&namelist, def_secret_key);
|
add_to_strlist (&namelist, def_secret_key);
|
||||||
else if (fpr_card)
|
else if (fpr_card)
|
||||||
{
|
{
|
||||||
err = get_pubkey_byfprint (ctrl, pk, NULL, fpr_card, fpr_len);
|
err = get_pubkey_byfpr (ctrl, pk, NULL, fpr_card, fpr_len);
|
||||||
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY)
|
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY)
|
||||||
{
|
{
|
||||||
if (opt.debug)
|
if (opt.debug)
|
||||||
log_debug ("using LDAP to find public key for current card\n");
|
log_debug ("using LDAP to find public key for current card\n");
|
||||||
err = keyserver_import_fprint (ctrl, fpr_card, fpr_len,
|
err = keyserver_import_fpr (ctrl, fpr_card, fpr_len,
|
||||||
opt.keyserver,
|
opt.keyserver,
|
||||||
KEYSERVER_IMPORT_FLAG_LDAP);
|
KEYSERVER_IMPORT_FLAG_LDAP);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = get_pubkey_byfprint (ctrl, pk, NULL, fpr_card, fpr_len);
|
err = get_pubkey_byfpr (ctrl, pk, NULL, fpr_card, fpr_len);
|
||||||
else if (gpg_err_code (err) == GPG_ERR_NO_DATA
|
else if (gpg_err_code (err) == GPG_ERR_NO_DATA
|
||||||
|| gpg_err_code (err) == GPG_ERR_NO_KEYSERVER)
|
|| gpg_err_code (err) == GPG_ERR_NO_KEYSERVER)
|
||||||
{
|
{
|
||||||
@ -4273,7 +4272,7 @@ get_user_id_byfpr (ctrl_t ctrl, const byte *fpr, size_t fprlen, size_t *rn)
|
|||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
/* Get it so that the cache will be filled. */
|
/* Get it so that the cache will be filled. */
|
||||||
if (!get_pubkey_byfprint (ctrl, NULL, NULL, fpr, fprlen))
|
if (!get_pubkey_byfpr (ctrl, NULL, NULL, fpr, fprlen))
|
||||||
name = cache_get_uid_byfpr (fpr, fprlen, rn);
|
name = cache_get_uid_byfpr (fpr, fprlen, rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,8 +464,8 @@ keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
keyserver_import_fpr (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
||||||
struct keyserver_spec *keyserver, unsigned int flags)
|
struct keyserver_spec *keyserver, unsigned int flags)
|
||||||
{
|
{
|
||||||
(void)ctrl;
|
(void)ctrl;
|
||||||
(void)fprint;
|
(void)fprint;
|
||||||
@ -476,8 +476,8 @@ keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
keyserver_import_fprint_ntds (ctrl_t ctrl,
|
keyserver_import_fpr_ntds (ctrl_t ctrl,
|
||||||
const byte *fprint, size_t fprint_len)
|
const byte *fprint, size_t fprint_len)
|
||||||
{
|
{
|
||||||
(void)ctrl;
|
(void)ctrl;
|
||||||
(void)fprint;
|
(void)fprint;
|
||||||
|
24
g10/import.c
24
g10/import.c
@ -2199,8 +2199,8 @@ import_one_real (ctrl_t ctrl,
|
|||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
/* Do we have this key already in one of our pubrings ? */
|
/* Do we have this key already in one of our pubrings ? */
|
||||||
err = get_keyblock_byfprint_fast (ctrl, &keyblock_orig, &hd,
|
err = get_keyblock_byfpr_fast (ctrl, &keyblock_orig, &hd,
|
||||||
fpr2, fpr2len, 1/*locked*/);
|
fpr2, fpr2len, 1/*locked*/);
|
||||||
if ((err
|
if ((err
|
||||||
&& gpg_err_code (err) != GPG_ERR_NO_PUBKEY
|
&& gpg_err_code (err) != GPG_ERR_NO_PUBKEY
|
||||||
&& gpg_err_code (err) != GPG_ERR_UNUSABLE_PUBKEY)
|
&& gpg_err_code (err) != GPG_ERR_UNUSABLE_PUBKEY)
|
||||||
@ -3071,7 +3071,7 @@ import_matching_seckeys (ctrl_t ctrl, kbnode_t seckeys,
|
|||||||
|
|
||||||
/* Get the entire public key block from our keystore and put all its
|
/* Get the entire public key block from our keystore and put all its
|
||||||
* fingerprints into an array. */
|
* fingerprints into an array. */
|
||||||
err = get_pubkey_byfprint (ctrl, NULL, &pub_keyblock, mainfpr, mainfprlen);
|
err = get_pubkey_byfpr (ctrl, NULL, &pub_keyblock, mainfpr, mainfprlen);
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
log_assert (pub_keyblock && pub_keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (pub_keyblock && pub_keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
@ -3309,7 +3309,7 @@ import_secret_one (ctrl_t ctrl, kbnode_t keyblock,
|
|||||||
{
|
{
|
||||||
/* Read the keyblock again to get the effects of a merge for
|
/* Read the keyblock again to get the effects of a merge for
|
||||||
* the public key. */
|
* the public key. */
|
||||||
err = get_pubkey_byfprint (ctrl, NULL, &node, fpr, fprlen);
|
err = get_pubkey_byfpr (ctrl, NULL, &node, fpr, fprlen);
|
||||||
if (err || !node)
|
if (err || !node)
|
||||||
log_error ("key %s: failed to re-lookup public key: %s\n",
|
log_error ("key %s: failed to re-lookup public key: %s\n",
|
||||||
keystr_from_pk (pk), gpg_strerror (err));
|
keystr_from_pk (pk), gpg_strerror (err));
|
||||||
@ -4403,9 +4403,9 @@ revocation_present (ctrl_t ctrl, kbnode_t keyblock)
|
|||||||
* itself? */
|
* itself? */
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
|
|
||||||
err = get_pubkey_byfprint_fast (ctrl, NULL,
|
err = get_pubkey_byfpr_fast (ctrl, NULL,
|
||||||
sig->revkey[idx].fpr,
|
sig->revkey[idx].fpr,
|
||||||
sig->revkey[idx].fprlen);
|
sig->revkey[idx].fprlen);
|
||||||
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY
|
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY
|
||||||
|| gpg_err_code (err) == GPG_ERR_UNUSABLE_PUBKEY)
|
|| gpg_err_code (err) == GPG_ERR_UNUSABLE_PUBKEY)
|
||||||
{
|
{
|
||||||
@ -4419,13 +4419,13 @@ revocation_present (ctrl_t ctrl, kbnode_t keyblock)
|
|||||||
log_info(_("WARNING: key %s may be revoked:"
|
log_info(_("WARNING: key %s may be revoked:"
|
||||||
" fetching revocation key %s\n"),
|
" fetching revocation key %s\n"),
|
||||||
tempkeystr,keystr(keyid));
|
tempkeystr,keystr(keyid));
|
||||||
keyserver_import_fprint (ctrl,
|
keyserver_import_fpr (ctrl,
|
||||||
sig->revkey[idx].fpr,
|
sig->revkey[idx].fpr,
|
||||||
sig->revkey[idx].fprlen,
|
sig->revkey[idx].fprlen,
|
||||||
opt.keyserver, 0);
|
opt.keyserver, 0);
|
||||||
|
|
||||||
/* Do we have it now? */
|
/* Do we have it now? */
|
||||||
err = get_pubkey_byfprint_fast (ctrl, NULL,
|
err = get_pubkey_byfpr_fast (ctrl, NULL,
|
||||||
sig->revkey[idx].fpr,
|
sig->revkey[idx].fpr,
|
||||||
sig->revkey[idx].fprlen);
|
sig->revkey[idx].fprlen);
|
||||||
}
|
}
|
||||||
|
26
g10/keydb.h
26
g10/keydb.h
@ -404,23 +404,23 @@ gpg_error_t get_pubkey_from_buffer (ctrl_t ctrl, PKT_public_key *pkbuf,
|
|||||||
gpg_error_t get_seckey (ctrl_t ctrl, PKT_public_key *pk, u32 *keyid);
|
gpg_error_t get_seckey (ctrl_t ctrl, PKT_public_key *pk, u32 *keyid);
|
||||||
|
|
||||||
/* Lookup a key with the specified fingerprint. */
|
/* Lookup a key with the specified fingerprint. */
|
||||||
int get_pubkey_byfprint (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
int get_pubkey_byfpr (ctrl_t ctrl, PKT_public_key *pk, kbnode_t *r_keyblock,
|
||||||
const byte *fprint, size_t fprint_len);
|
const byte *fpr, size_t fprlen);
|
||||||
|
|
||||||
|
/* This function is similar to get_pubkey_byfpr, but it doesn't
|
||||||
|
merge the self-signed data into the public key and subkeys or into
|
||||||
|
the user ids. */
|
||||||
|
gpg_error_t get_pubkey_byfpr_fast (ctrl_t ctrl, PKT_public_key *pk,
|
||||||
|
const byte *fpr, size_t fprlen);
|
||||||
|
|
||||||
/* This function is similar to get_pubkey_byfprint, but it doesn't
|
/* This function is similar to get_pubkey_byfprint, but it doesn't
|
||||||
merge the self-signed data into the public key and subkeys or into
|
merge the self-signed data into the public key and subkeys or into
|
||||||
the user ids. */
|
the user ids. */
|
||||||
gpg_error_t get_pubkey_byfprint_fast (ctrl_t ctrl, PKT_public_key *pk,
|
gpg_error_t get_keyblock_byfpr_fast (ctrl_t ctrl,
|
||||||
const byte *fprint, size_t fprint_len);
|
kbnode_t *r_keyblock,
|
||||||
|
KEYDB_HANDLE *r_hd,
|
||||||
/* This function is similar to get_pubkey_byfprint, but it doesn't
|
const byte *fpr, size_t fprlen,
|
||||||
merge the self-signed data into the public key and subkeys or into
|
int lock);
|
||||||
the user ids. */
|
|
||||||
gpg_error_t get_keyblock_byfprint_fast (ctrl_t ctrl,
|
|
||||||
kbnode_t *r_keyblock,
|
|
||||||
KEYDB_HANDLE *r_hd,
|
|
||||||
const byte *fprint, size_t fprint_len,
|
|
||||||
int lock);
|
|
||||||
|
|
||||||
|
|
||||||
/* Returns true if a secret key is available for the public key with
|
/* Returns true if a secret key is available for the public key with
|
||||||
|
13
g10/keyid.c
13
g10/keyid.c
@ -778,25 +778,24 @@ keyid_from_pk (PKT_public_key *pk, u32 *keyid)
|
|||||||
* keyid is not part of the fingerprint.
|
* keyid is not part of the fingerprint.
|
||||||
*/
|
*/
|
||||||
u32
|
u32
|
||||||
keyid_from_fingerprint (ctrl_t ctrl, const byte *fprint,
|
keyid_from_fingerprint (ctrl_t ctrl, const byte *fpr, size_t fprlen, u32 *keyid)
|
||||||
size_t fprint_len, u32 *keyid)
|
|
||||||
{
|
{
|
||||||
u32 dummy_keyid[2];
|
u32 dummy_keyid[2];
|
||||||
|
|
||||||
if( !keyid )
|
if( !keyid )
|
||||||
keyid = dummy_keyid;
|
keyid = dummy_keyid;
|
||||||
|
|
||||||
if (fprint_len != 20 && fprint_len != 32)
|
if (fprlen != 20 && fprlen != 32)
|
||||||
{
|
{
|
||||||
/* This is special as we have to lookup the key first. */
|
/* This is special as we have to lookup the key first. */
|
||||||
PKT_public_key pk;
|
PKT_public_key pk;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
memset (&pk, 0, sizeof pk);
|
memset (&pk, 0, sizeof pk);
|
||||||
rc = get_pubkey_byfprint (ctrl, &pk, NULL, fprint, fprint_len);
|
rc = get_pubkey_byfpr (ctrl, &pk, NULL, fpr, fprlen);
|
||||||
if( rc )
|
if( rc )
|
||||||
{
|
{
|
||||||
log_printhex (fprint, fprint_len,
|
log_printhex (fpr, fprlen,
|
||||||
"Oops: keyid_from_fingerprint: no pubkey; fpr:");
|
"Oops: keyid_from_fingerprint: no pubkey; fpr:");
|
||||||
keyid[0] = 0;
|
keyid[0] = 0;
|
||||||
keyid[1] = 0;
|
keyid[1] = 0;
|
||||||
@ -806,8 +805,8 @@ keyid_from_fingerprint (ctrl_t ctrl, const byte *fprint,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const byte *dp = fprint;
|
const byte *dp = fpr;
|
||||||
if (fprint_len == 20) /* v4 key */
|
if (fprlen == 20) /* v4 key */
|
||||||
{
|
{
|
||||||
keyid[0] = buf32_to_u32 (dp+12);
|
keyid[0] = buf32_to_u32 (dp+12);
|
||||||
keyid[1] = buf32_to_u32 (dp+16);
|
keyid[1] = buf32_to_u32 (dp+16);
|
||||||
|
@ -37,11 +37,11 @@ struct keyserver_spec *parse_preferred_keyserver(PKT_signature *sig);
|
|||||||
int keyserver_any_configured (ctrl_t ctrl);
|
int keyserver_any_configured (ctrl_t ctrl);
|
||||||
int keyserver_export (ctrl_t ctrl, strlist_t users);
|
int keyserver_export (ctrl_t ctrl, strlist_t users);
|
||||||
int keyserver_import (ctrl_t ctrl, strlist_t users);
|
int keyserver_import (ctrl_t ctrl, strlist_t users);
|
||||||
int keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
int keyserver_import_fpr (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
||||||
struct keyserver_spec *keyserver,
|
struct keyserver_spec *keyserver,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int keyserver_import_fprint_ntds (ctrl_t ctrl,
|
int keyserver_import_fpr_ntds (ctrl_t ctrl,
|
||||||
const byte *fprint, size_t fprint_len);
|
const byte *fprint, size_t fprint_len);
|
||||||
int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
|
int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
|
||||||
struct keyserver_spec *keyserver,
|
struct keyserver_spec *keyserver,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
@ -976,34 +976,32 @@ keyserver_import_ntds (ctrl_t ctrl, const char *mbox,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
keyserver_import_fprint (ctrl_t ctrl, const byte *fprint, size_t fprint_len,
|
keyserver_import_fpr (ctrl_t ctrl, const byte *fpr, size_t fprlen,
|
||||||
struct keyserver_spec *keyserver,
|
struct keyserver_spec *keyserver, unsigned int flags)
|
||||||
unsigned int flags)
|
|
||||||
{
|
{
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
|
|
||||||
memset (&desc, 0, sizeof(desc));
|
memset (&desc, 0, sizeof(desc));
|
||||||
|
|
||||||
if (fprint_len == 16 || fprint_len == 20 || fprint_len == 32)
|
if (fprlen == 16 || fprlen == 20 || fprlen == 32)
|
||||||
desc.mode = KEYDB_SEARCH_MODE_FPR;
|
desc.mode = KEYDB_SEARCH_MODE_FPR;
|
||||||
else
|
else
|
||||||
return gpg_error (GPG_ERR_INV_ARG);
|
return gpg_error (GPG_ERR_INV_ARG);
|
||||||
|
|
||||||
memcpy (desc.u.fpr, fprint, fprint_len);
|
memcpy (desc.u.fpr, fpr, fprlen);
|
||||||
desc.fprlen = fprint_len;
|
desc.fprlen = fprlen;
|
||||||
|
|
||||||
return keyserver_get (ctrl, &desc, 1, keyserver, flags, NULL, NULL);
|
return keyserver_get (ctrl, &desc, 1, keyserver, flags, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
keyserver_import_fprint_ntds (ctrl_t ctrl,
|
keyserver_import_fpr_ntds (ctrl_t ctrl, const byte *fpr, size_t fprlen)
|
||||||
const byte *fprint, size_t fprint_len)
|
|
||||||
{
|
{
|
||||||
struct keyserver_spec keyserver = { NULL, "ldap:///" };
|
struct keyserver_spec keyserver = { NULL, "ldap:///" };
|
||||||
|
|
||||||
return keyserver_import_fprint (ctrl, fprint, fprint_len,
|
return keyserver_import_fpr (ctrl, fpr, fprlen,
|
||||||
&keyserver, KEYSERVER_IMPORT_FLAG_LDAP);
|
&keyserver, KEYSERVER_IMPORT_FLAG_LDAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1779,7 +1777,7 @@ keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
|
|||||||
spec = parse_keyserver_uri (url, 1);
|
spec = parse_keyserver_uri (url, 1);
|
||||||
if(spec)
|
if(spec)
|
||||||
{
|
{
|
||||||
err = keyserver_import_fprint (ctrl, *fpr, *fpr_len, spec, 0);
|
err = keyserver_import_fpr (ctrl, *fpr, *fpr_len, spec, 0);
|
||||||
free_keyserver_spec(spec);
|
free_keyserver_spec(spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1788,8 +1786,7 @@ keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
|
|||||||
/* If only a fingerprint is provided, try and fetch it from
|
/* If only a fingerprint is provided, try and fetch it from
|
||||||
the configured keyserver. */
|
the configured keyserver. */
|
||||||
|
|
||||||
err = keyserver_import_fprint (ctrl,
|
err = keyserver_import_fpr (ctrl, *fpr, *fpr_len, opt.keyserver, 0);
|
||||||
*fpr, *fpr_len, opt.keyserver, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_info(_("no keyserver known\n"));
|
log_info(_("no keyserver known\n"));
|
||||||
|
@ -2192,8 +2192,8 @@ check_sig_and_print (CTX c, kbnode_t node)
|
|||||||
free_public_key (pk);
|
free_public_key (pk);
|
||||||
pk = NULL;
|
pk = NULL;
|
||||||
glo_ctrl.in_auto_key_retrieve++;
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
res = keyserver_import_fprint (c->ctrl, p, n, opt.keyserver,
|
res = keyserver_import_fpr (c->ctrl, p, n, opt.keyserver,
|
||||||
KEYSERVER_IMPORT_FLAG_QUICK);
|
KEYSERVER_IMPORT_FLAG_QUICK);
|
||||||
glo_ctrl.in_auto_key_retrieve--;
|
glo_ctrl.in_auto_key_retrieve--;
|
||||||
if (!res)
|
if (!res)
|
||||||
rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
|
rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
|
||||||
|
@ -129,8 +129,8 @@ show_revocation_reason (ctrl_t ctrl, PKT_public_key *pk, int mode)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* get the keyblock */
|
/* get the keyblock */
|
||||||
fingerprint_from_pk( pk, fingerprint, &fingerlen );
|
fingerprint_from_pk (pk, fingerprint, &fingerlen);
|
||||||
rc = get_pubkey_byfprint (ctrl, NULL, &keyblock, fingerprint, fingerlen);
|
rc = get_pubkey_byfpr (ctrl, NULL, &keyblock, fingerprint, fingerlen);
|
||||||
if( rc ) { /* that should never happen */
|
if( rc ) { /* that should never happen */
|
||||||
log_debug( "failed to get the keyblock\n");
|
log_debug( "failed to get the keyblock\n");
|
||||||
return;
|
return;
|
||||||
|
@ -294,8 +294,8 @@ gen_desig_revoke (ctrl_t ctrl, const char *uname, strlist_t locusr)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
pk2 = xmalloc_clear (sizeof *pk2);
|
pk2 = xmalloc_clear (sizeof *pk2);
|
||||||
rc = get_pubkey_byfprint (ctrl, pk2, NULL,
|
rc = get_pubkey_byfpr (ctrl, pk2, NULL,
|
||||||
pk->revkey[i].fpr, pk->revkey[i].fprlen);
|
pk->revkey[i].fpr, pk->revkey[i].fprlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have the revocation key. */
|
/* We have the revocation key. */
|
||||||
|
@ -510,7 +510,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
|
|||||||
if (opt.debug)
|
if (opt.debug)
|
||||||
log_debug ("using LDAP to find public key"
|
log_debug ("using LDAP to find public key"
|
||||||
" for current card\n");
|
" for current card\n");
|
||||||
if (!keyserver_import_fprint
|
if (!keyserver_import_fpr
|
||||||
(ctrl, cinfo.fpr2, cinfo.fpr2len, opt.keyserver,
|
(ctrl, cinfo.fpr2, cinfo.fpr2len, opt.keyserver,
|
||||||
KEYSERVER_IMPORT_FLAG_LDAP))
|
KEYSERVER_IMPORT_FLAG_LDAP))
|
||||||
{
|
{
|
||||||
|
@ -202,8 +202,8 @@ keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
keyserver_import_fpr (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
||||||
struct keyserver_spec *keyserver, unsigned int flags)
|
struct keyserver_spec *keyserver, unsigned int flags)
|
||||||
{
|
{
|
||||||
(void)ctrl;
|
(void)ctrl;
|
||||||
(void)fprint;
|
(void)fprint;
|
||||||
@ -214,8 +214,8 @@ keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
keyserver_import_fprint_ntds (ctrl_t ctrl,
|
keyserver_import_fpr_ntds (ctrl_t ctrl,
|
||||||
const byte *fprint, size_t fprint_len)
|
const byte *fprint, size_t fprint_len)
|
||||||
{
|
{
|
||||||
(void)ctrl;
|
(void)ctrl;
|
||||||
(void)fprint;
|
(void)fprint;
|
||||||
|
@ -2493,9 +2493,8 @@ get_policy (ctrl_t ctrl, tofu_dbs_t dbs, PKT_public_key *pk,
|
|||||||
int lookup_err;
|
int lookup_err;
|
||||||
kbnode_t kb;
|
kbnode_t kb;
|
||||||
|
|
||||||
lookup_err = get_pubkey_byfprint (ctrl, NULL, &kb,
|
lookup_err = get_pubkey_byfpr (ctrl, NULL, &kb,
|
||||||
fingerprint_raw,
|
fingerprint_raw, fingerprint_raw_len);
|
||||||
fingerprint_raw_len);
|
|
||||||
if (lookup_err)
|
if (lookup_err)
|
||||||
{
|
{
|
||||||
if (DBG_TRUST)
|
if (DBG_TRUST)
|
||||||
|
@ -112,7 +112,7 @@ keyid_from_fpr20 (ctrl_t ctrl, const byte *fpr, u32 *keyid)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
memset (&pk, 0, sizeof pk);
|
memset (&pk, 0, sizeof pk);
|
||||||
rc = get_pubkey_byfprint (ctrl, &pk, NULL, fpr, fprlen);
|
rc = get_pubkey_byfpr (ctrl, &pk, NULL, fpr, fprlen);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_printhex (fpr, fprlen,
|
log_printhex (fpr, fprlen,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user