mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
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 <wk@gnupg.org>
This commit is contained in:
parent
72ece35fb7
commit
fb0470a9f5
@ -52,7 +52,7 @@ gpg_agent_SOURCES = \
|
||||
trustlist.c \
|
||||
divert-scd.c \
|
||||
divert-tpm2.c \
|
||||
tpm2.c \
|
||||
tpm2.c tpm2.h \
|
||||
cvt-openpgp.c cvt-openpgp.h \
|
||||
call-scd.c \
|
||||
learncard.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
|
||||
|
@ -8,6 +8,12 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* FIXME: Until we have a proper checking in configure we give a hint
|
||||
* on what to do */
|
||||
#ifndef HAVE_TSS2_TSS_H
|
||||
# error Please install the libtss2 dev package first
|
||||
#endif
|
||||
|
||||
#include "agent.h"
|
||||
#include "../common/i18n.h"
|
||||
#include "../common/sexp-parse.h"
|
||||
|
@ -1559,6 +1559,7 @@ agent_shadow_key_type (const unsigned char *pubkey,
|
||||
|
||||
/* Calculate required length by taking in account: the "shadowed-"
|
||||
prefix, the "shadowed", shadow type as well as some parenthesis */
|
||||
/* FIXME: We should use membuf functions here. */
|
||||
n = 12 + pubkey_len + 1 + 3+8 + 2+5 + shadow_info_len + 1;
|
||||
*result = xtrymalloc (n);
|
||||
p = (char*)*result;
|
||||
@ -1643,9 +1644,12 @@ agent_get_shadow_info_type (const unsigned char *shadowkey,
|
||||
n = snext (&s);
|
||||
if (!n)
|
||||
return gpg_error (GPG_ERR_INV_SEXP);
|
||||
if (shadow_type) {
|
||||
if (shadow_type)
|
||||
{
|
||||
char *buf = xtrymalloc(n+1);
|
||||
memcpy(buf, s, n);
|
||||
if (!buf)
|
||||
return gpg_error_from_syserror ();
|
||||
memcpy (buf, s, n);
|
||||
buf[n] = '\0';
|
||||
*shadow_type = buf;
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
|
||||
pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h \
|
||||
stdint.h signal.h util.h libutil.h termios.h \
|
||||
ucred.h sys/ucred.h sys/sysmacros.h sys/mkdev.h])
|
||||
ucred.h sys/ucred.h sys/sysmacros.h sys/mkdev.h tss2/tss.h])
|
||||
|
||||
AC_HEADER_TIME
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user