summaryrefslogtreecommitdiffstats
path: root/g13 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use gpgrt's new option parser for the remaining daemons.Werner Koch2020-02-212-160/+133
| | | | | | | | | | | | | | | | | | | | * scd/scdaemon.c: Switch to the new option parser and enable a global conf file. * dirmngr/dirmngr.c: Ditto. * g13/g13.c: Ditto. * g13/g13-syshelp.c: Ditto. Do not force verbose mode. * dirmngr/dirmngr_ldap.c: Switch to the new option parser. * dirmngr/dirmngr-client.c: Switch to the new option parser. -- This finalizes the switch to the new option parser. What's left is to remove the old argparser code from common. g13-syshelp does not anymore default to --verbose because that can now be enabled in /etc/gnupg/g13-syshelp.conf. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Use gpgrt's new option parser to provide a global conf file.Werner Koch2020-02-202-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | * common/util.h: Remove argparse.h. * common/argparse.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS. * configure.ac (GPGRT_ENABLE_ARGPARSE_MACROS): Define. * agent/gpg-agent.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS and include argparse.h. Do this also for all main modules which use our option parser except for gpg. Replace calls to strusage by calls to gpgrt_strusage everywhere. * g10/gpg.c (opts): Change type to gpgrt_opt_t. Flag oOptions and oNoOptions with ARGPARSE_conffile and ARGPARSE_no_conffile. (main): Change type of pargs to gpgrt_argparse_t. Rework the option parser to make use of the new gpgrt_argparser. -- This is not yet finished but a make check works. gpg has the most complex and oldest option handling and thus this is the first migration target. SE-Linux checks and version-ed config files are missing and will be added later. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <wk@gnupg.org>
* Spelling cleanup.Daniel Kahn Gillmor2020-02-192-2/+2
| | | | | | | | | | | | | | | | No functional changes, just fixing minor spelling issues. --- Most of these were identified from the command line by running: codespell \ --ignore-words-list fpr,stati,keyserver,keyservers,asign,cas,iff,ifset \ --skip '*.po,ChangeLog*,help.*.txt,*.jpg,*.eps,*.pdf,*.png,*.gpg,*.asc' \ doc g13 g10 kbx agent artwork scd tests tools am common dirmngr sm \ NEWS README README.maint TODO Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* build: Always use EXTERN_UNLESS_MAIN_MODULE pattern.Werner Koch2020-02-103-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * common/util.h (EXTERN_UNLESS_MAIN_MODULE): Add the definion only here but now without the Norcroft-C. Change all other places where it gets defined. * common/iobuf.h (iobuf_debug_mode): Declare unconditionally as extern. * common/iobuf.c (iobuf_debug_mode): Define it here. * agent/gpg-agent.c (INCLUDED_BY_MAIN_MODULE): Define here and also in all main modules of all other programs. * g10/main.h: Put util.h before the local header files. -- This change is required for use with gcc/ld's LTO feature which does not allow common blocks. Further gcc 10 will make -fno-common the default and thus this chnage is always needed. What a pitty. Co-authored-by: Tomáš Mráz GnuPG-bug-id: 4831 Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 21d9bd8b87a9f793a106095e3838eb71825189d7) - Applied respective chnages also to gpg-card and keyboxd. Signed-off-by: Werner Koch <wk@gnupg.org>
* Return better error code for some getinfo IPC commands.Werner Koch2019-06-031-1/+1
| | | | | | | | | | | | | * agent/command.c (cmd_getinfo): Return GPG_ERR_FALSE as boolean False. * g13/server.c (cmd_getinfo): Ditto. * sm/server.c (cmd_getinfo): Ditto. -- GPG_ERR_FALSE was introduced with libgpg-error 1.21 and we now require a later version for gnupg 2. Thus we can switch to this more descriptive code. Signed-off-by: Werner Koch <wk@gnupg.org>
* all: fix spelling and typosDaniel Kahn Gillmor2018-10-243-3/+3
| | | | Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* Merge branch 'STABLE-BRANCH-2-2'Werner Koch2018-02-222-42/+7
|\
| * common: Use new function to print status strings.Werner Koch2018-02-142-42/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp2.c (vprint_assuan_status_strings): New. (print_assuan_status_strings): New. * agent/command.c (agent_write_status): Replace by call to new function. * dirmngr/server.c (dirmngr_status): Ditto. * g13/server.c (g13_status): Ditto. * g13/sh-cmd.c (g13_status): Ditto. * sm/server.c (gpgsm_status2): Ditto. * scd/command.c (send_status_info): Bump up N. -- This fixes a potential overflow if LFs are passed to the status string functions. This is actually not the case and would be wrong because neither the truncating in libassuan or our escaping is not the Right Thing. In any case the functions need to be more robust and comply to the promised interface. Thus the code has been factored out to a helper function and N has been bumped up correctly and checked in all cases. For some uses this changes the behaviour in the error case (i.e. CR or LF passed): It will now always be C-escaped and not passed to libassuan which would truncate the line at the first LF. Reported-by: private_pers
* | Use the gpgrt log functions if possible.Werner Koch2017-11-272-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.c: Do not build any code if we can use the gpgrt_log functions. (log_logv_with_prefix): Rename to log_logv_prefix and change order of args so that this function matches its printf like counterpart gpgrt_logv_prefix. Change all callers. (log_debug_with_string): Rename to log_debug_string. Change all callers. (log_printhex): Move first arg to end so that this function matches its printf like counterpart gpgrt_log_printhex. Change all callers. * common/logging.h: Divert to gpgrt/libgpg-error if we can use the gpgrt_log functions. (bug_at): Add inline versions if we can use the gpgrt_log functions. * configure.ac (GPGRT_ENABLE_LOG_MACROS): Add to AH_BOTTOM. (mycflags): Add -Wno-format-zero-length. -- This patch enables the use of the log function from libgpgrt (aka libgpg-error). Instead of checking a version number, we enable them depending on macros set by recent gpg-error versions. Eventually the whole divert stuff can be removed. The -Wno-format-zero-length is required because log_printhex can be called with an empty format string. Note that this is fully specified standard C behaviour. Signed-off-by: Werner Koch <wk@gnupg.org>
* tests: Make it possible to run all tests using our infrastructure.Justus Winter2017-05-112-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (TESTS_ENVIRONMENT): New variable. (check-all): New phony target to run all tests. * tests/gpgme/gpgme-defs.scm (have-gpgme?): New function that tests whether the GPGME test suite is available instead of exiting the process. * tests/gpgscm/init.scm (export): New macro. * tests/gpgscm/tests.scm (run-tests): New function. (load-tests): Likewise. * tests/gpgme/run-tests.scm: Simplify and move the parsing of the list of tests to 'all-tests.scm'. * tests/gpgsm/run-tests.scm: Likewise. * tests/migrations/run-tests.scm: Likewise. * tests/openpgp/run-tests.scm: Likewise. * tests/gpgme/Makefile.am: To select the tests to run, use the variable 'TESTS'. This harmonizes the interface with the automake test suite. * tests/gpgsm/Makefile.am: Likewise. * tests/migrations/Makefile.am: Likewise. * tests/openpgp/Makefile.am: Likewise. * tests/openpgp/README: Likewise. * agent/all-tests.scm: New file. * common/all-tests.scm: Likewise. * g10/all-tests.scm: Likewise. * g13/all-tests.scm: Likewise. * tests/gpgme/all-tests.scm: Likewise. * tests/gpgsm/all-tests.scm: Likewise. * tests/migrations/all-tests.scm: Likewise. * tests/openpgp/all-tests.scm: Likewise. * tests/run-tests.scm: Likewise. -- This change allows us to run all tests in parallel and write one XML report capturing the results of every test. It also lays the foundation to parametrize test suites. Signed-off-by: Justus Winter <justus@g10code.com>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-283-3/+3
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g13: Fix for Solaris.NIIBE Yutaka2017-04-201-0/+3
| | | | | | | | | | * configure.ac: Check sys/mkdev.h. * g13/sh-dmcrypt.c: Include sys/mkdev.h. -- GnuPG-bug-id: 3098 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g13: Include sys/sysmacros.h if available.NIIBE Yutaka2017-04-111-0/+3
| | | | | | | * configure.ac: Add test for sys/sysmacros.h. * g13/sh-dmcrypt.c: Include sys/sysmacros.h. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Remove -I option to common.NIIBE Yutaka2017-03-0720-30/+30
| | | | | | | | | | | | | * dirmngr/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * g10/Makefile.am (AM_CPPFLAGS): Ditto. * g13/Makefile.am (AM_CPPFLAGS): Ditto. * kbx/Makefile.am (AM_CPPFLAGS): Ditto. * scd/Makefile.am (AM_CPPFLAGS): Ditto. * sm/Makefile.am (AM_CPPFLAGS): Ditto. * tools/Makefile.am (AM_CPPFLAGS): Ditto. * Throughout: Follow the change. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix spelling.Daniel Kahn Gillmor2017-02-212-2/+2
| | | | | | | | | -- Clean up several other misspellings noticed while reviewing Yuri's de-duplication patch. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* Clean up word replication.Yuri Chornoivan2017-02-211-1/+1
| | | | | | | | | -- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* g13: Fix build on macOS.Justus Winter2017-02-131-1/+1
| | | | | | * g13/Makefile.am (t_common_ldadd): Add iconv. Signed-off-by: Justus Winter <justus@g10code.com>
* g13: Improve printing of debug infos.Werner Koch2017-01-021-1/+1
| | | | | | * g13/g13tuple.c (all_printable): Make it work. Signed-off-by: Werner Koch <wk@gnupg.org>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-0537-37/+37
| | | | --
* Fix typos.Justus Winter2016-10-271-1/+1
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* Fix more spellingDaniel Kahn Gillmor2016-09-172-2/+2
| | | | | | | | | | | | | | | | | | | * NEWS, acinclude.m4, agent/command-ssh.c, agent/command.c, agent/gpg-agent.c, agent/keyformat.txt, agent/protect-tool.c, common/asshelp.c, common/b64enc.c, common/recsel.c, doc/DETAILS, doc/HACKING, doc/Notes, doc/TRANSLATE, doc/dirmngr.texi, doc/faq.org, doc/gpg-agent.texi, doc/gpg.texi, doc/gpgsm.texi, doc/instguide.texi, g10/armor.c, g10/gpg.c, g10/keyedit.c, g10/mainproc.c, g10/pkclist.c, g10/tofu.c, g13/sh-cmd.c, g13/sh-dmcrypt.c, kbx/keybox-init.c, m4/pkg.m4, sm/call-dirmngr.c, sm/gpgsm.c, tests/Makefile.am, tests/gpgscm/Manual.txt, tests/gpgscm/scheme.c, tests/openpgp/gpgv-forged-keyring.scm, tests/openpgp/multisig.test, tests/openpgp/verify.scm, tests/pkits/README, tools/applygnupgdefaults, tools/gpg-connect-agent.c, tools/mime-maker.c, tools/mime-parser.c: minor spelling cleanup. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* common: Add an assuan logging monitor.Werner Koch2016-09-052-2/+2
| | | | | | | | | * common/asshelp.c (my_log_monitor): New var. (my_libassuan_log_handler): Run that monitor. (setup_libassuan_logging): Add arg to set a log monitor and change all callers. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Allow the use of a g13tab label for --mount.Werner Koch2016-08-141-4/+6
| | | | | | | * g13/mount.c (g13_mount_container): Do not run the first access check if syshelp is required. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Implement --umount for dm-crypt.Werner Koch2016-08-1411-22/+244
| | | | | | | | | | | | | * g13/g13.c (main): Implement command --umount. * g13/mount.c (g13_umount_container): use the syshelper if needed. * g13/backend.c (be_umount_container): New. * g13/be-dmcrypt.c (be_dmcrypt_umount_container): New. * g13/call-syshelp.c (call_syshelp_run_umount): New. * g13/sh-cmd.c (cmd_umount): New. (register_commands): Register UMOUNT. * g13/sh-dmcrypt.c (sh_dmcrypt_umount_container): New. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Fix double free bug.Werner Koch2016-08-131-2/+0
| | | | | | * g13/sh-cmd.c (cmd_mount, cmd_resume): Do not xfree TIUPLES. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Consider g13tab for a mount command.Werner Koch2016-08-134-14/+132
| | | | | | | | | | | | * g13/sh-cmd.c (cmd_getkeyblob): New. (register_commands): Register it. * g13/call-syshelp.c (getkeyblob_data_cb): New. (call_syshelp_get_keyblob): New. * g13/mount.c: Include callsyshelp.h. (g13_mount_container): Ask syshelp whether the filename is managed by g13tab. Call syshelp to get the encrypted keyblob in this case. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Move some function around.Werner Koch2016-08-137-26/+34
| | | | | | | | | | | | | * g13/keyblob.c (g13_keyblob_decrypt): Move to ... * g13/server.c: to here. * g13/suspend.c, g13/mount.c: Include server.h. * g13/Makefile.am (g13_syshelp_SOURCES): Add keyblob.c -- This is done to be able to use keyblob read code in syshelp w/o requiring linking to call-gpg.c Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: New command --find-device.Werner Koch2016-08-134-0/+161
| | | | | | | | | | | | | | | | * common/status.h (STATUS_BLOCKDEV: New. * g13/call-syshelp.c: Include "call-syshelp.h". (finddevice_status_cb, call_syshelp_find_device): New. * g13/g13.c (aFindDevice): New. (opts): Add "--find-device". (main): Implement --find-device. * g13/sh-cmd.c (cmd_finddevice): New. (register_commands): Register new command. -- This might be useful for scripting. Signed-off-by: Werner Koch <wk@gnupg.org>
* Call log_set_prefix() with human-readable labels.Daniel Kahn Gillmor2016-08-122-4/+4
| | | | | | | | | | | | | | | | | | * agent/preset-passphrase.c, agent/protect-tool.c, dirmngr/dirmngr.c * dirmngr/t-http.c, g10/gpg.c, g10/gpgv.c, g13/g13-syshelp.c * g13/g13.c, kbx/kbxutil.c, scd/scdaemon.c, sm/gpgsm.c * tests/gpgscm/main.c, tools/gpg-check-pattern.c * tools/gpg-connect-agent.c, tools/gpgconf.c, tools/gpgtar.c * tools/symcryptrun.c: Invoke log_set_prefix() with human-readable labels. -- Some invocations of log_set_prefix() were done with raw numeric values instead of values that humans can understand. Use symbolic representations instead of numeric for better readability. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* Cleanup initialization of libgcrypt.Ben Kibbey2016-08-092-10/+0
| | | | | | | | | | | | * common/init.c (init_common_subsystems): Initialize libgcrypt. * dirmngr/Makefile.am (dirmngr_ldap): Link with libgcrypt. -- Most other modules already call gcry_check_version() after init_common_subsystems() so may as well move initialization of libgcrypt to here. Also fixes a warning in the system log from gpgconf --homedir. Signed-off-by: Ben Kibbey <bjk@luxsci.net>
* g13: Fix memleak.Werner Koch2016-07-121-1/+1
| | | | | | | | | * g13/g13tuple.c (create_tupledesc): Init refcount to 1. -- The old code somehow assumed that calloc was used. Signed-off-by: Werner Koch <wk@gnupg.org>
* Replace use of opt.homedir by accessor functions.Werner Koch2016-06-074-16/+14
| | | | | | | | | | | | | | | | | | | * common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Extend gnupg_create_inbound_pipe et al.Werner Koch2016-05-271-2/+2
| | | | | | | | | | | | | | * common/exechelp-posix.c (gnupg_create_inbound_pipe): Add args 'r_fp' and 'nonblock'. (gnupg_create_outbound_pipe): Ditto. * common/exechelp-w32.c (gnupg_create_inbound_pipe): Add non yet functional args 'r_fp' and 'nonblock'. (gnupg_create_outbound_pipe): Ditto. * common/exechelp-w32ce.c (gnupg_create_inbound_pipe): Ditto. (gnupg_create_outbound_pipe): Ditto. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Consolidate Assuan server argument handling.Justus Winter2016-03-021-32/+1
| | | | | | | | | | | | | | | * common/Makefile.am (common_sources): Add new files. * common/server-help.c: New file. * common/server-help.h: Likewise. * agent/command.c: Drop argument handling primitives in favor of using the consolidated ones. * dirmngr/server.c: Likewise. * g10/server.c: Likewise. * g13/server.c: Likewise. * scd/command.c: Likewise. * sm/server.c: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* g13: Add commands --suspend and --remove.Werner Koch2016-02-2318-210/+1029
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g13/g13.c (aSuspend, aResume): New. (opts): Add commands --suspend and --resume. (main): Implement dummy command aUmount. Implement commands aResume and aSuspend. * g13/sh-cmd.c (cmd_suspend): New. (cmd_resume): New. (register_commands): Add commands RESUME and SUSPEND. * g13/server.c (cmd_suspend): New. (cmd_resume): New. (register_commands): Add commands RESUME and SUSPEND. * g13/be-dmcrypt.c (be_dmcrypt_suspend_container): New. (be_dmcrypt_resume_container): New. * g13/backend.c (be_suspend_container): New. (be_resume_container): New. * g13/suspend.c, g13/suspend.h: New. * g13/mount.c (parse_header, read_keyblob_prefix, read_keyblob) (decrypt_keyblob, g13_is_container): Move to ... * g13/keyblob.c: new file. (keyblob_read): Rename to g13_keyblob_read and make global. (keyblob_decrypt): Rename to g13_keyblob_decrypt and make global. * g13/sh-dmcrypt.c (check_blockdev): Add arg expect_busy. (sh_dmcrypt_suspend_container): New. (sh_dmcrypt_resume_container): New. * g13/call-syshelp.c (call_syshelp_run_suspend): New. (call_syshelp_run_resume): New. -- The --suspend command can be used before a hibernate operation to make the encrypted partition inaccessible and wipe the key from the memory. Before --suspend is called a sync(1) should be run to make sure that their are no dirty buffers (dmsetup, as called by g13, actually does this for you but it does not harm to do it anyway. After the partition has been suspended a echo 3 >proc/sys/vm/drop_caches required to flush all caches which may still have content from the encrypted partition. The --resume command reverses the effect of the suspend but to do this it needs to decrypt again. Now, if the .gnupg directory lives on the encrypted partition this will be problematic because due to the suspend all processes accessing data on the encrypted partition will be put into an uninterruptible sleep (ps(1) shows a state of 'D'). This needs to be avoided. A workaround is to have a separate GnuPG home directory (say, "~/.gnupg-fallback") with only the public keys required to decrypt the partition along with a properly setup conf files. A GNUPGHOME=$(pwd)/.gnupg-fallback g13 --resume should then be able to resume the encrypted partition using the private key stored on a smartcard. The implementation is pretty basic right now but useful to me. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Run mount after dmsetup.Werner Koch2016-02-232-15/+51
| | | | | | | | * g13/g13-syshelp.c (main): Reject userids with a slash. * g13/sh-dmcrypt.c (sh_dmcrypt_mount_container): Run mount if a mountpoint is known. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Require a confirmation before g13 is used for DM-Crypt.Werner Koch2016-02-133-1/+27
| | | | | | | | * g13/g13-syshelp.c (g13_syshelp_i_know_what_i_am_doing): * g13/sh-dmcrypt.c (sh_dmcrypt_create_container): Call it. (sh_dmcrypt_mount_container): Call it. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Second chunk of code to support dm-crypt.Werner Koch2016-02-1318-121/+951
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g13/be-dmcrypt.c, g13/be-dmcrypt.h: New. * g13/Makefile.am (g13_SOURCES): Add them. * g13/backend.c: Include be-dmcrypt.h and call-syshelp.h. (no_such_backend): Rename to _no_such_backend and provide replacement macro. (be_is_supported_conttype): Support DM-Crypt. (be_take_lock_for_create): Call set_segvice for DM-Crypt. (be_create_new_keys): Make it a dummy for DM-Crypt. (be_create_container): Call be_dmcrypt_create_container. (be_mount_container): call be_dmcrypt_mount_container. * g13/g13-syshelp.c (main): Enable verbose mode. * g13/g13tuple.c (get_tupledesc_data): New. * g13/g13tuple.h (unref_tupledesc): New. * g13/g13.h (server_control_): Add field "recipients". * g13/g13.c (main): Fix setting of recipients via cmdline. (g13_deinit_default_ctrl): Release recipients list. (g13_request_shutdown): New. Replace all direct update of shutdown_pending by calls this function. * g13/server.c (server_local_s): Remove field recipients which is now part of CTRL. (reset_notify, cmd_recipient, cmd_create): Adjust for this change. * g13/create.c (encrypt_keyblob): Rename to g13_encrypt_keyblob. (g13_create_container): Support DM-Crypt. * g13/mount.c (parse_header): Allow for meta data copies. (g13_mount_container): Support DM-Crypt. * g13/sh-cmd.c (cmd_create): Make it work. (cmd_mount): New. * g13/sh-dmcrypt.c (sh_dmcrypt_create_container): Make it work. (sh_dmcrypt_mount_container): New. -- With this patch we can now create an encrypted partition and partly mount it (i.e. setup keys and create the mapped device). We do not yet create a file system or mount that file system Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Improve dump_keyblob.Werner Koch2016-02-133-38/+88
| | | | | | | | | | | | * g13/g13tuple.c: Include keyblob.h. (find_tuple_uint): Factor code out to ... (convert_uint): new. (all_printable): New. * g13/mount.c (dump_keyblob: Move and rename to ... * g13/g13tuple.c (dump_tupledesc): here. Revamp and pretyy print uint values. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Define 3 new tags.Werner Koch2016-02-131-1/+11
| | | | | | | | * g13/keyblob.h (KEYBLOB_TAG_CONT_NSEC): New. (KEYBLOB_TAG_ENC_NSEC): New. (KEYBLOB_TAG_ENC_OFF): New. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Rename utils.c to g13tuple.cWerner Koch2016-02-1310-20/+24
| | | | | | | | | * g13/utils.c: Rename to g13tuple.c. * g13/utils.h: Rename to g13tuple.h. Change all users. * g13/Makefile.am: Adjust accordingly -- Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Add functions to handle uint in a keyblob.Werner Koch2016-02-134-4/+318
| | | | | | | | | | | * g13/utils.c (append_tuple_uint): New. (find_tuple_uint): New. * g13/t-utils.c: New. * g13/Makefile.am (noinst_PROGRAMS, TESTS): New. (module_tests, t_common_ldadd): New. (t_utils_SOURCES, t_utils_LDADD): New. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Re-factor high level create code.Werner Koch2016-02-133-28/+64
| | | | | | | * g13/create.c (g13_create_container): Factor some code out to ... * g13/backend.c (be_take_lock_for_create): new. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Return an error for non-existing device.Werner Koch2016-02-131-3/+7
| | | | | | * g13/sh-cmd.c (cmd_device): Set ERR. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Fix releasing of a syshelp context.Werner Koch2016-02-131-2/+7
| | | | | | * g13/call-syshelp.c (call_syshelp_release): Allow a NULL arg. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Switch over to common/exectool.c.Werner Koch2016-02-135-313/+6
| | | | | | | | | | | | | | | | * g13/sh-exectool.c: Remove. It has been replaced by common/exectool.c. * g13/Makefile.am (g13_syshelp_SOURCES): Remove sh-exectool.c * g13/sh-blockdev.c: Include exectool.h. Change sh_exec_tool to gnupg_exec-tool. * g13/sh-dmcrypt.c: Ditto. -- With commit 2ae07f826aa551db8adf714158fce962790a6b54 the exectool code was moved from a g13 feature branch to common/ so that it could be used by gpgtar. With this patch we finally remove the original code and use the one in common/. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: First chunk of code to support dm-crypt.Werner Koch2016-02-1314-9/+2489
| | | | | | | | | | | | | | | | | | | | | | | | | * g13/call-syshelp.c, g13/call-syshelp.h: New. * g13/g13-syshelp.c, g13/g13-syshelp.h: New. * g13/sh-cmd.c: New. * g13/sh-blockdev.c: New. * g13/sh-exectool.c: New. * g13/sh-dmcrypt.c: New. * g13/Makefile.am (sbin_PROGRAMS): Add g13-syshelp.c (g13_syshelp_SOURCES): New. (g13_syshelp_LDADD): New. * g13/g13.c (opts): Add option --type. (g13_deinit_default_ctrl): New. (main): Implement that option. Call g13_deinit_default_ctrl. * g13/g13.h (struct call_syshelp_s): New declaration. (server_control_s): Add field syshelp_local. * g13/keyblob.h (KEYBLOB_TAG_CREATED): New. (KEYBLOB_TAG_ALGOSTR): New. (KEYBLOB_TAG_HDRCOPY): New. * g13/backend.c (be_parse_conttype_name): New. (be_get_detached_name): Add CONTTYPE_DM_CRYPT. Signed-off-by: Werner Koch <wk@gnupg.org>
* g13: Fix commit 1a045b13.Werner Koch2015-11-261-4/+4
| | | | | | * g13/g13.c (main): Use existsing function. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Make the GPG arguments configurable in call-gpg.Justus Winter2015-11-264-2/+19
| | | | | | | | | | | | | | | | * common/call-gpg.c (start_gpg): Add parameter 'gpg_arguments'. (_gpg_encrypt, gpg_encrypt_blob, gpg_encrypt_stream): Likewise. (_gpg_decrypt, gpg_decrypt_blob, gpg_decrypt_stream): Likewise. * common/call-gpg.h: Adapt prototypes. * g13/create.c (encrypt_keyblob): Adapt callsite. * g13/g13-common.h (opt): Add field 'gpg_arguments'. * g13/g13.c (main): Construct default arguments. * g13/mount.c (decrypt_keyblob): Adapt callsite. * tools/gpgtar-create.c (gpgtar_create): Likewise. * tools/gpgtar-extract.c (gpgtar_extract): Likewise. * tools/gpgtar-list.c (gpgtar_list): Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* g13: Move 'call-gpg.c' to common.Justus Winter2015-11-255-629/+4
| | | | | | | | | | | | * common/Makefile.am (common_sources): Add files. * g13/call-gpg.c: Move to 'common' and adapt slightly. Add a parameter to let callees override the gpg program to execute. * g13/call-gpg.h: Likewise. * g13/Makefile.am (g13_SOURCES): Drop files. * g13/create.c (encrypt_keyblob): Hand in the gpg program to execute. * g13/mount.c (decrypt_keyblob): Likewise. Signed-off-by: Justus Winter <justus@g10code.com>