mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-30 16:17:02 +01:00
g10: Break out of the loop earlier.
* g10/getkey.c (have_secret_key_with_kid): Once we find the relevent key or subkey, stop searching. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>. Only a single key or subkey will ever be selected per keyblock.
This commit is contained in:
parent
50affffe93
commit
3940f10af7
11
g10/getkey.c
11
g10/getkey.c
@ -2942,19 +2942,22 @@ have_secret_key_with_kid (u32 *keyid)
|
|||||||
for (node = keyblock; node; node = node->next)
|
for (node = keyblock; node; node = node->next)
|
||||||
{
|
{
|
||||||
/* Bit 0 of the flags is set if the search found the key
|
/* Bit 0 of the flags is set if the search found the key
|
||||||
using that key or subkey. */
|
using that key or subkey. Note: a search will only ever
|
||||||
|
match a single key or subkey. */
|
||||||
if ((node->flag & 1))
|
if ((node->flag & 1))
|
||||||
{
|
{
|
||||||
assert (node->pkt->pkttype == PKT_PUBLIC_KEY
|
assert (node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
|
|
||||||
if (!agent_probe_secret_key (NULL, node->pkt->pkt.public_key))
|
if (agent_probe_secret_key (NULL, node->pkt->pkt.public_key) == 0)
|
||||||
{
|
/* Not available. */
|
||||||
result = 1;
|
result = 1;
|
||||||
|
else
|
||||||
|
result = 0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
release_kbnode (keyblock);
|
release_kbnode (keyblock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user