mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
agent: expose shadow key type
-- For TPM support it is necessary to indroduce another type of shadow key, so allow other agent functions to extract the type so they can make the right decisions based on it. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Minor editorial changes by wk
This commit is contained in:
parent
a763bb2580
commit
0e3b2955ae
4 changed files with 90 additions and 17 deletions
|
@ -1198,6 +1198,7 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
|
|||
char *fpr = NULL;
|
||||
int keytype;
|
||||
unsigned char *shadow_info = NULL;
|
||||
unsigned char *shadow_info_type = NULL;
|
||||
char *serialno = NULL;
|
||||
char *idstr = NULL;
|
||||
const char *keytypestr;
|
||||
|
@ -1208,7 +1209,8 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
|
|||
char ttlbuf[20];
|
||||
char flagsbuf[5];
|
||||
|
||||
err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info);
|
||||
err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info,
|
||||
&shadow_info_type);
|
||||
if (err)
|
||||
{
|
||||
if (in_ssh && gpg_err_code (err) == GPG_ERR_NOT_FOUND)
|
||||
|
@ -1280,9 +1282,18 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
|
|||
|
||||
if (shadow_info)
|
||||
{
|
||||
err = parse_shadow_info (shadow_info, &serialno, &idstr, NULL);
|
||||
if (err)
|
||||
goto leave;
|
||||
if (strcmp (shadow_info_type, "t1-v1") == 0)
|
||||
{
|
||||
err = parse_shadow_info (shadow_info, &serialno, &idstr, NULL);
|
||||
if (err)
|
||||
goto leave;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error ("unrecognised shadow key type %s\n", shadow_info_type);
|
||||
err = GPG_ERR_BAD_KEY;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
|
||||
if (!data)
|
||||
|
@ -1317,6 +1328,7 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx,
|
|||
|
||||
leave:
|
||||
xfree (fpr);
|
||||
xfree (shadow_info_type);
|
||||
xfree (shadow_info);
|
||||
xfree (serialno);
|
||||
xfree (idstr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue