1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: Rename the struct card_key_info_s.

* g10/call-agent.h (struct card_key_info_s): Rename to ...
(struct keypair_info_s): this.
(keypair_info_t): New.  Use this everywhere instead of
card_key_info_s.
* g10/call-agent.c (agent_scd_free_keyinfo): Rename to ..
(free_keypair_info): this.  Change all callers.
--

The struct is also useful to store the data from KEYPAIRINFO status
lines.  Thus renaming it makes sense.  A future patch will extend the
struct.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-02-12 17:29:51 +01:00
parent 125c959677
commit 8c63430d1a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 22 additions and 17 deletions

View File

@ -1530,10 +1530,12 @@ agent_scd_cardlist (strlist_t *result)
return 0; return 0;
} }
struct card_keyinfo_parm_s { struct card_keyinfo_parm_s {
int error; int error;
struct card_key_info_s *list; keypair_info_t list;
}; };
/* Callback function for agent_card_keylist. */ /* Callback function for agent_card_keylist. */
@ -1554,8 +1556,8 @@ card_keyinfo_cb (void *opaque, const char *line)
{ {
const char *s; const char *s;
int n; int n;
struct card_key_info_s *keyinfo; keypair_info_t keyinfo;
struct card_key_info_s **l_p = &parm->list; keypair_info_t *l_p = &parm->list;
while ((*l_p)) while ((*l_p))
l_p = &(*l_p)->next; l_p = &(*l_p)->next;
@ -1636,9 +1638,9 @@ card_keyinfo_cb (void *opaque, const char *line)
void void
agent_scd_free_keyinfo (struct card_key_info_s *l) free_keypair_info (keypair_info_t l)
{ {
struct card_key_info_s *l_next; keypair_info_t l_next;
for (; l; l = l_next) for (; l; l = l_next)
{ {
@ -1656,7 +1658,7 @@ agent_scd_free_keyinfo (struct card_key_info_s *l)
and NULL is stored at RESULT. */ and NULL is stored at RESULT. */
gpg_error_t gpg_error_t
agent_scd_keyinfo (const char *keygrip, int cap, agent_scd_keyinfo (const char *keygrip, int cap,
struct card_key_info_s **result) keypair_info_t *result)
{ {
int err; int err;
struct card_keyinfo_parm_s parm; struct card_keyinfo_parm_s parm;
@ -1691,7 +1693,7 @@ agent_scd_keyinfo (const char *keygrip, int cap,
if (!err) if (!err)
*result = parm.list; *result = parm.list;
else else
agent_scd_free_keyinfo (parm.list); free_keypair_info (parm.list);
return err; return err;
} }

View File

@ -76,14 +76,17 @@ struct agent_card_info_s
int uif[3]; /* True if User Interaction Flag is on. */ int uif[3]; /* True if User Interaction Flag is on. */
}; };
/* Information from scdaemon for card keys. */
struct card_key_info_s /* Object to store information from the KEYPAIRINFO or the KEYINFO
* status lines. */
struct keypair_info_s
{ {
struct card_key_info_s *next; struct keypair_info_s *next;
char keygrip[41]; char keygrip[41];
char *serialno; char *serialno;
char *idstr; char *idstr; /* (aka keyref) */
}; };
typedef struct keypair_info_s *keypair_info_t;
/* Release the card info structure. */ /* Release the card info structure. */
void agent_release_card_info (struct agent_card_info_s *info); void agent_release_card_info (struct agent_card_info_s *info);
@ -98,12 +101,12 @@ gpg_error_t agent_scd_keypairinfo (ctrl_t ctrl, const char *keyref,
/* Return list of cards. */ /* Return list of cards. */
int agent_scd_cardlist (strlist_t *result); int agent_scd_cardlist (strlist_t *result);
/* Free card key information. */ /* Free a keypair info list. */
void agent_scd_free_keyinfo (struct card_key_info_s *l); void free_keypair_info (keypair_info_t l);
/* Return card key information. */ /* Return card key information. */
gpg_error_t agent_scd_keyinfo (const char *keygrip, int cap, gpg_error_t agent_scd_keyinfo (const char *keygrip, int cap,
struct card_key_info_s **result); keypair_info_t *result);
/* Return the serial number, possibly select by DEMAND. */ /* Return the serial number, possibly select by DEMAND. */
int agent_scd_serialno (char **r_serialno, const char *demand); int agent_scd_serialno (char **r_serialno, const char *demand);

View File

@ -330,8 +330,8 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
int eof; int eof;
int state; int state;
strlist_t sl; strlist_t sl;
struct card_key_info_s *card_keyinfo; keypair_info_t card_keyinfo;
struct card_key_info_s *card_keyinfo_list; keypair_info_t card_keyinfo_list;
char fpr2[2 * MAX_FINGERPRINT_LEN + 2 ]; char fpr2[2 * MAX_FINGERPRINT_LEN + 2 ];
kbnode_t keyblock; kbnode_t keyblock;
kbnode_t node; kbnode_t node;
@ -359,7 +359,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
if (!sk) if (!sk)
{ {
/* Free the context. */ /* Free the context. */
agent_scd_free_keyinfo (c->card_keyinfo_list); free_keypair_info (c->card_keyinfo_list);
release_sk_list (c->results); release_sk_list (c->results);
release_kbnode (c->keyblock); release_kbnode (c->keyblock);
getkey_end (ctrl, c->ctx); getkey_end (ctrl, c->ctx);