gnupg/tools
James Bottomley 62a7854816
tpm2d: Add tpm2daemon code
* 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>
2021-03-10 12:33:08 +01:00
..
ChangeLog-2011 Generate the ChangeLog from commit logs. 2011-12-01 11:09:02 +01:00
Makefile.am tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
Manifest * Manifest: New. 2004-01-05 09:28:27 +00:00
README.gpgconf Remove what is now in the texi docs. 2004-09-29 23:06:58 +00:00
addgnupghome tools: Use POSIX compatible arguments for find 2018-12-11 08:42:33 +01:00
applygnupgdefaults conf: New option --status-fd. 2017-12-18 17:46:05 +01:00
call-dirmngr.c Change license of some files to LGPLv2.1. 2017-06-19 12:42:13 +02:00
call-dirmngr.h Change license of some files to LGPLv2.1. 2017-06-19 12:42:13 +02:00
card-call-scd.c gpg,card: Allow no version information of Yubikey. 2020-12-07 10:02:17 +09:00
card-keys.c card: Improve openpgp key writing in "writecert". 2020-06-03 16:25:59 +02:00
card-misc.c card: Run factory-reset in locked stated also in gpg-card. 2020-11-09 14:46:35 +01:00
card-yubikey.c common,agent,dirmngr,g10,tools: Fix split_fields API. 2020-09-18 10:20:23 +09:00
ccidmon.c tools: Some changes to the ccidmon.c debug helper. 2019-04-30 08:28:54 +02:00
clean-sat.c Nuked almost all trailing white space. 2011-02-04 12:57:53 +01:00
convert-from-106 Changed to GPLv3. 2007-07-04 19:49:40 +00:00
crlf.c Migrated more stuff to doc/ 2006-08-21 20:20:23 +00:00
der-to-pem Added a very simple tool. 2003-12-01 10:54:59 +00:00
gpg-card-w32info.rc tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-card.c kbx: Log debug fixes 2021-02-25 17:02:49 +01:00
gpg-card.h card: Let the APDU command prints a description of the status word. 2020-11-27 11:28:16 +01:00
gpg-card.w32-manifest.in tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-check-pattern-w32info.rc tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-check-pattern.c Replace most of the remaining stdio calls by estream calls. 2020-10-20 12:15:56 +02:00
gpg-check-pattern.w32-manifest.in tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-connect-agent-w32info.rc tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-connect-agent.c Replace most of the remaining stdio calls by estream calls. 2020-10-20 12:15:56 +02:00
gpg-connect-agent.w32-manifest.in tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-pair-tool.c common: New functions gnupg_opendir et al. 2020-10-21 17:00:32 +02:00
gpg-wks-client-w32info.rc tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-wks-client.c wks-client: Improve an error message 2020-12-09 10:59:51 +01:00
gpg-wks-client.w32-manifest.in tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpg-wks-server.c common: New functions gnupg_opendir et al. 2020-10-21 17:00:32 +02:00
gpg-wks.h build: Always use EXTERN_UNLESS_MAIN_MODULE pattern. 2020-02-10 16:50:47 +01:00
gpgconf-comp.c tpm2d: Add tpm2daemon code 2021-03-10 12:33:08 +01:00
gpgconf-w32info.rc tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpgconf.c w32: Always use Unicode for console input and output. 2021-03-05 15:33:40 +01:00
gpgconf.h tpm2d: Add tpm2daemon code 2021-03-10 12:33:08 +01:00
gpgconf.w32-manifest.in tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpgparsemail.c gpgparsemail: Die on parse error, printing errno thing. 2019-06-07 13:28:07 +09:00
gpgsplit.c Use gpgrt's new option parser for the tools. 2020-02-21 20:28:47 +01:00
gpgtar-create.c common: New functions gnupg_opendir et al. 2020-10-21 17:00:32 +02:00
gpgtar-extract.c gpgtar: Improve error messages. 2019-03-06 17:46:40 +01:00
gpgtar-list.c gpgtar: Improve error messages. 2019-03-06 17:46:40 +01:00
gpgtar-w32info.rc tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
gpgtar.c gpgtar,w32: Handle Unicode file names. 2020-08-21 21:28:28 +02:00
gpgtar.h gpgtar,w32: Handle Unicode file names. 2020-08-21 21:28:28 +02:00
gpgtar.w32-manifest.in tools,w32: Add resource and manifest files to all binaries. 2021-02-21 12:38:55 +01:00
lspgpot Migrated more stuff to doc/ 2006-08-21 20:20:23 +00:00
mail-signed-keys Spelling fixes in docs and comments. 2017-04-28 10:06:33 +09:00
make-dns-cert.c Change all http://www.gnu.org in license notices to https:// 2016-11-05 12:02:19 +01:00
mime-maker.c tools: Replace duplicated code in mime-maker. 2018-10-15 11:45:14 +02:00
mime-maker.h tools: New function mime_maker_add_body_data. 2017-09-12 14:35:06 +02:00
mime-parser.c Spelling cleanup. 2020-02-18 18:07:46 -05:00
mime-parser.h Change license of some files to LGPLv2.1. 2017-06-19 12:42:13 +02:00
no-libgcrypt.c all: fix spelling and typos 2018-10-24 15:56:18 -04:00
pgpgroup-to-gpggroup Changed to GPLv3. 2007-07-04 19:49:40 +00:00
rfc822parse.c gpgparsemail: Die on parse error, printing errno thing. 2019-06-07 13:28:07 +09:00
rfc822parse.h tools: Replace duplicated code in mime-maker. 2018-10-15 11:45:14 +02:00
send-mail.c wks: Take name of sendmail from configure. 2018-06-19 08:07:59 +02:00
send-mail.h Change license of some files to LGPLv2.1. 2017-06-19 12:42:13 +02:00
sockprox.c Change all http://www.gnu.org in license notices to https:// 2016-11-05 12:02:19 +01:00
watchgnupg.c tools: Add option --clock to watchgnupg 2021-01-12 09:31:20 +01:00
wks-receive.c wkd: Change client/server limit back to 64 KiB 2019-07-05 10:33:13 +02:00
wks-util.c wkd: Minor permission fix for created files. 2020-12-30 15:03:46 +01:00

README.gpgconf

============
  GPG Conf
============

Main documentation for this tool can be found in doc/tools.texi.

BACKENDS
========

Backends should support the following commands:

Command --gpgconf-list
----------------------

List the location of the configuration file, and all default values of
all options.  The location of the configuration file must be an
absolute pathname.

The format of each line is:

NAME:FLAGS:DEFAULT:ARGDEF

NAME

This field contains a name tag for the group or option.  The name tag
is used to specify the group or option in all communication with
GPGConf.  The name tag is to be used verbatim.  It is not in any
escaped format.

FLAGS

The flags field contains an unsigned number.  Its value is the
OR-wise combination of the following flag values:

	16 default	If this flag is set, a default value is available.
	32 default desc If this flag is set, a (runtime) default is available.
			This and the "default" flag are mutually exclusive.
	64 no arg desc	If this flag is set, and the "optional arg" flag
			is set, then the option has a special meaning if no
			argument is given.

DEFAULT

This field is defined only for options.  Its format is that of an
option argument (see section Format Conventions for details).  If the
default value is empty, then no default is known.  Otherwise, the
value specifies the default value for this option.  Note that this
field is also meaningful if the option itself does not take a real
argument.

ARGDEF

This field is defined only for options for which the "optional arg"
flag is set.  If the "no arg desc" flag is not set, its format is that
of an option argument (see section Format Conventions for details).
If the default value is empty, then no default is known.  Otherwise,
the value specifies the default value for this option.  If the "no arg
desc" flag is set, the field is either empty or contains a description
of the effect of this option if no argument is given.  Note that this
field is also meaningful if the option itself does not take a real
argument.


Example:
$ dirmngr --gpgconf-list
gpgconf-config-file:/mnt/marcus/.gnupg/dirmngr.conf
ldapservers-file:/mnt/marcus/.gnupg/dirmngr_ldapservers.conf
add-servers:0
max-replies:10


TODO
----

* Implement --dry-run and --quiet.

* Extend the backend interface to include gettext domain and
description, if available, to avoid repeating this information in
gpgconf.