mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +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>
============ 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.