From fb0470a9f5834b77fba2bf5e1b41f56d063e556f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 9 Mar 2018 10:36:14 +0100 Subject: agent: Minor cleanup of the TPM patches. * configure.ac (AC_CHECK_HEADERS): Add tss2/tss.h. * agent/divert-tpm2.c: Print an error if that file is not available. * agent/Makefile.am (gpg_agent_SOURCES): Add tpm.h * agent/command.c (do_one_keyinfo): Replace xstrdup by xtrystrdup. * agent/protect.c (agent_get_shadow_info_type): Check error of xtrystrdup. Signed-off-by: Werner Koch --- agent/command.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'agent/command.c') diff --git a/agent/command.c b/agent/command.c index c439aa5f7..a46e2888e 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1104,7 +1104,8 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx, char hexgrip[40+1]; char *fpr = NULL; int keytype; - unsigned char *shadow_info = NULL, *shadow_info_type = NULL; + unsigned char *shadow_info = NULL; + unsigned char *shadow_info_type = NULL; char *serialno = NULL; char *idstr = NULL; const char *keytypestr; @@ -1194,7 +1195,12 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx, } else if (strcmp (shadow_info_type, "tpm2-v1") == 0) { - serialno = xstrdup("TPM-Protected"); + serialno = xtrystrdup("TPM-Protected"); + if (!serialno) + { + err = gpg_error_from_syserror (); + goto leave; + } idstr = NULL; } else -- cgit v1.2.3