diff options
author | James Bottomley via Gnupg-devel <[email protected]> | 2020-06-14 17:26:45 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-06-24 08:11:47 +0000 |
commit | 0e3b2955aee2b9b62707d138caa4329eb31d4f93 (patch) | |
tree | b87e44c6513af97b7abedd070e364ef199004aa5 /agent/command.c | |
parent | gpg,agent: Support Ed448 signing. (diff) | |
download | gnupg-0e3b2955aee2b9b62707d138caa4329eb31d4f93.tar.gz gnupg-0e3b2955aee2b9b62707d138caa4329eb31d4f93.zip |
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 <[email protected]>
Minor editorial changes by wk
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/agent/command.c b/agent/command.c index d374fd06f..0430745e4 100644 --- a/agent/command.c +++ b/agent/command.c @@ -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); |