mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-08 21:18:51 +01:00
62a7854816
* tpm2d: New directory. * Makefile.am (SUBDIRS): Add directory. * configure.ac: Detect libtss and decide whether to build tpm2d. * am/cmacros.am: Add a define. * util.h (GNUPG_MODULE_NAME_TPM2DAEMON): New. * common/homedir.c (gnupg_module_name): Add tpm2d. * common/mapstrings.c (macros): Add "TPM2DAEMON". * tools/gpgconf.h (GC_COMPONENT_TPM2DAEMON): New. * tools/gpgconf-comp.c (known_options_tpm2daemon): New. (gc_component): Add TPM2. (tpm2daemon_runtime_change): New. * tpm2d/Makefile.am: New. * tpm2d/command.c: New. * tpm2d/ibm-tss.h: New. * tpm2d/tpm2.c: New. * tpm2d/tpm2.h: New. * tpm2d/tpm2daemon.c: New. * tpm2d/tpm2daemon.h: New. --- This commit adds and plumbs in a tpm2daemon to the build to mirror the operation of scdaemon. The architecture of the code is that tpm2daemon.c itself is pretty much a clone of scd/scdaemon.c just with updated function prefixes (this argues there could be some further consolidation of the daemon handling code). Note that although this commit causes the daemon to be built and installed, nothing actually starts it or uses it yet. Command handling ---------------- command.c is copied from the command handler in scd.c except that the command implementation is now done in terms of tpm2 commands and the wire protocol is far simpler. The tpm2daemon only responds to 4 commands IMPORT: import a standard s-expression private key and export it to TPM2 format. This conversion cannot be undone and the private key now can *only* be used by the TPM2. To anyone who gets hold of the private key now, it's just an encrypted binary blob. PKSIGN: create a signature from the tpm2 key. The TPM2 form private key is retrieved by KEYDATA and the hash to be signed by EXTRA. Note there is no hash specifier because the tpm2 tss deduces the hash type from the length of the EXTRA data. This is actually a limitation of the tpm2 command API and it will be interesting to see how this fares if the tpm2 ever supports say sha3-256 hashes. PKDECRYPT: decrypt (RSA case) or derive (ECC case) a symmetric key. The tpm2 for private key is retrieved by KEYDATA and the information used to create the symmetric key by EXTRA. KILLTPM2D: stop the daemon All the tpm2 primitives used by command.c are in tpm2.h and all the tpm2 specific gunk is confined to tpm2.c, which is the only piece of this that actually does calls into the tss library. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Changes from James' patch: - gpgconf: The displayed name is "TPM" and not "TPM2". That string is used by GUIs and should be something the user understands. For example we also use "network" instead of "Dirmngr". - Removed some commented includes. - Use 16 as emulation of GPG_ERR_SOURCE_TPM2. - Silenced a C90 compiler warning and flags unused parameters. - Removed "if HAVE_LIBS" from tpm2/Makefile.am and add missing files so that make distcheck works. Signed-off-by: Werner Koch <wk@gnupg.org>
85 lines
2.8 KiB
Plaintext
85 lines
2.8 KiB
Plaintext
# cmacros.am - C macro definitions
|
|
# Copyright (C) 2004 Free Software Foundation, Inc.
|
|
#
|
|
# This file is part of GnuPG.
|
|
#
|
|
# GnuPG is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# GnuPG is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
|
|
localedir = $(datadir)/locale
|
|
|
|
# NB: AM_CFLAGS may also be used by tools running on the build
|
|
# platform to create source files.
|
|
AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"
|
|
|
|
if ! HAVE_DOSISH_SYSTEM
|
|
AM_CPPFLAGS += -DGNUPG_BINDIR="\"$(bindir)\"" \
|
|
-DGNUPG_LIBEXECDIR="\"$(libexecdir)\"" \
|
|
-DGNUPG_LIBDIR="\"$(libdir)/@PACKAGE@\"" \
|
|
-DGNUPG_DATADIR="\"$(datadir)/@PACKAGE@\"" \
|
|
-DGNUPG_SYSCONFDIR="\"$(sysconfdir)/@PACKAGE@\"" \
|
|
-DGNUPG_LOCALSTATEDIR="\"$(localstatedir)\""
|
|
endif
|
|
|
|
|
|
# If a specific protect tool program has been defined, pass its name
|
|
# to cc. Note that these macros should not be used directly but via
|
|
# the gnupg_module_name function.
|
|
if GNUPG_AGENT_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_AGENT="\"@GNUPG_AGENT_PGM@\""
|
|
endif
|
|
if GNUPG_PINENTRY_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_PINENTRY="\"@GNUPG_PINENTRY_PGM@\""
|
|
endif
|
|
if GNUPG_SCDAEMON_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_SCDAEMON="\"@GNUPG_SCDAEMON_PGM@\""
|
|
endif
|
|
if GNUPG_TPM2DAEMON_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_TPM2DAEMON="\"@GNUPG_TPM2DAEMON_PGM@\""
|
|
endif
|
|
if GNUPG_DIRMNGR_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_DIRMNGR="\"@GNUPG_DIRMNGR_PGM@\""
|
|
endif
|
|
if GNUPG_PROTECT_TOOL_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_PROTECT_TOOL="\"@GNUPG_PROTECT_TOOL_PGM@\""
|
|
endif
|
|
if GNUPG_DIRMNGR_LDAP_PGM
|
|
AM_CPPFLAGS += -DGNUPG_DEFAULT_DIRMNGR_LDAP="\"@GNUPG_DIRMNGR_LDAP_PGM@\""
|
|
endif
|
|
|
|
# Under Windows we use LockFileEx. WindowsCE provides this only on
|
|
# the WindowsMobile 6 platform and thus we need to use the coredll6
|
|
# import library. We also want to use a stacksize of 256k instead of
|
|
# the 2MB which is the default with cegcc. 256k is the largest stack
|
|
# we use with pth.
|
|
if HAVE_W32CE_SYSTEM
|
|
extra_sys_libs = -lcoredll6
|
|
extra_bin_ldflags = -Wl,--stack=0x40000
|
|
else
|
|
extra_sys_libs =
|
|
extra_bin_ldflags =
|
|
endif
|
|
|
|
if HAVE_W32_SYSTEM
|
|
.rc.o:
|
|
$(WINDRES) $(DEFAULT_INCLUDES) $(INCLUDES) "$<" "$@"
|
|
|
|
endif
|
|
resource_objs =
|
|
|
|
# Convenience macros
|
|
libcommon = ../common/libcommon.a
|
|
libcommonpth = ../common/libcommonpth.a
|
|
libcommontls = ../common/libcommontls.a
|
|
libcommontlsnpth = ../common/libcommontlsnpth.a
|