mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-02 12:01:32 +01:00
gpg,tools: Add handling of supported algorithms by a card.
* g10/call-agent.h (struct agent_card_info_s): Add supported_keyalgo. * g10/call-agent.c (learn_status_cb): Parse KEY-ATTR-INFO. (agent_release_card_info): Release supported_keyalgo. * tools/gpg-card.h (struct card_info_s): Add supported_keyalgo. * tools/card-call-scd.c (learn_status_cb): Parse KEY-ATTR-INFO. (release_card_info): Release supported_keyalgo. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
0db9c83555
commit
2bc1ec2944
@ -499,6 +499,11 @@ agent_release_card_info (struct agent_card_info_s *info)
|
||||
xfree (info->private_do[i]);
|
||||
info->private_do[i] = NULL;
|
||||
}
|
||||
for (i=0; i < DIM(info->supported_keyalgo); i++)
|
||||
{
|
||||
free_strlist (info->supported_keyalgo[i]);
|
||||
info->supported_keyalgo[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -744,6 +749,25 @@ learn_status_cb (void *opaque, const char *line)
|
||||
parm->uif[no] = (data[0] != 0xff);
|
||||
xfree (data);
|
||||
}
|
||||
else if (keywordlen == 13 && !memcmp (keyword, "KEY-ATTR-INFO", 13))
|
||||
{
|
||||
if (!strncmp (line, "OPENPGP.", 8))
|
||||
{
|
||||
int no;
|
||||
|
||||
line += 8;
|
||||
no = atoi (line);
|
||||
if (no >= 1 && no <= 3)
|
||||
{
|
||||
no--;
|
||||
line++;
|
||||
while (spacep (line))
|
||||
line++;
|
||||
append_to_strlist (&parm->supported_keyalgo[no], xstrdup (line));
|
||||
}
|
||||
}
|
||||
/* Skip when it's not "OPENPGP.[123]". */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ struct agent_card_info_s
|
||||
unsigned int status_indicator;
|
||||
int kdf_do_enabled; /* Non-zero if card has a KDF object, 0 if not. */
|
||||
int uif[3]; /* True if User Interaction Flag is on. */
|
||||
strlist_t supported_keyalgo[3];
|
||||
};
|
||||
|
||||
|
||||
|
@ -161,6 +161,11 @@ release_card_info (card_info_t info)
|
||||
info->kinfo = kinfo;
|
||||
}
|
||||
info->chvusage[0] = info->chvusage[1] = 0;
|
||||
for (i=0; i < DIM(info->supported_keyalgo); i++)
|
||||
{
|
||||
free_strlist (info->supported_keyalgo[i]);
|
||||
info->supported_keyalgo[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1042,6 +1047,26 @@ learn_status_cb (void *opaque, const char *line)
|
||||
xfree (parm->dispserialno);
|
||||
parm->dispserialno = unescape_status_string (line);
|
||||
}
|
||||
else if (!memcmp (keyword, "KEY-ATTR-INFO", keywordlen))
|
||||
{
|
||||
if (!strncmp (line, "OPENPGP.", 8))
|
||||
{
|
||||
int no;
|
||||
|
||||
line += 8;
|
||||
no = atoi (line);
|
||||
if (no >= 1 && no <= 3)
|
||||
{
|
||||
no--;
|
||||
line++;
|
||||
while (spacep (line))
|
||||
line++;
|
||||
append_to_strlist (&parm->supported_keyalgo[no],
|
||||
xstrdup (line));
|
||||
}
|
||||
}
|
||||
/* Skip when it's not "OPENPGP.[123]". */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define GNUPG_GPG_CARD_H
|
||||
|
||||
#include "../common/session-env.h"
|
||||
#include "../common/strlist.h"
|
||||
|
||||
|
||||
/* We keep all global options in the structure OPT. */
|
||||
@ -188,6 +189,7 @@ struct card_info_s
|
||||
int kdf_do_enabled; /* True if card has a KDF object. */
|
||||
int uif[3]; /* True if User Interaction Flag is on. */
|
||||
/* 1 = on, 2 = permanent on. */
|
||||
strlist_t supported_keyalgo[3];
|
||||
};
|
||||
typedef struct card_info_s *card_info_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user