summaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common: New function to validate domain names.Werner Koch2018-07-273-2/+93
| | | | | | | * common/mbox-util.c (is_valid_domain_name): New. * common/t-mbox-util.c (run_dns_test): New test. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: New function percent_data_escape.Werner Koch2018-07-023-1/+95
| | | | | | | * common/percent.c (percent_data_escape): New. * common/t-percent.c (test_percent_data_escape): New. Signed-off-by: Werner Koch <wk@gnupg.org>
* build: Remove duplicates from AC_CHECK_FUNCSWerner Koch2018-06-211-1/+1
| | | | | | | | | | | * configure.ac (AC_CHECK_FUNCS): Fold most calls into one. -- A few functions were tested two times which slightly increases the size of the configure script. Also put the functions in sorted order into the macro. Signed-off-by: Werner Koch <wk@gnupg.org>
* Some preparations to eventuallt use gpgrt_argparse.Werner Koch2018-06-121-1/+5
| | | | | | | | | * configure.ac (GNUPG_DEF_COPYRIGHT_LINE: New. * tools/watchgnupg.c (print_version): USe this macro. * common/init.c (_init_common_subsystems): Register argparse functions. Signed-off-by: Werner Koch <wk@gnupg.org>
* Require libgpg-error 1.29 and remove internal logging functions.Werner Koch2018-06-124-1227/+5
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Set to 1.29 * common/util.h: Remove replacement error codes. * common/logging.h: Remove fallback to internal logging functions. * common/logging.c: Remove. * common/Makefile.am (common_sources): Remove logging.c Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Remove PGP6 compliance mode.Werner Koch2018-05-292-3/+1
| | | | | | | | * g10/gpg.c: Make --pgp6 an alias for --pgp7. * common/compliance.h (gnupg_compliance_mode): Remove CO_PGP6. * g10/options.h (PGP6): Remove. Adjust all users. Signed-off-by: Werner Koch <wk@gnupg.org>
* Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2018-05-132-1/+2
|\ | | | | | | | | | | | | | | | | | | -- Resolved Conflicts: NEWS - removed configure.ac - removed Signed-off-by: Werner Koch <wk@gnupg.org>
| * gpg: Fix "Too many open files" when using --multifile.Werner Koch2018-05-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | * common/miscellaneous.c (is_file_compressed): Don't cache the file. -- This seems to be a pretty old bug. The fix is easy and also reveals that -z0 can be used as a workaround. GnuPG-bug-id: 3951 Signed-off-by: Werner Koch <wk@gnupg.org>
| * common,w32: Hide spawned processes by defaultAndre Heinecke2018-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/exechelp-w32.c (gnupg_spawn_process): Use SW_HIDE instead of SW_MINIMIZE. -- Spawning minimized shows icons in the task bar so users see that background processes are started, which is unusual. I'm pretty sure that the intention of the code was to hide the window if not in spawn debug mode. This is also what GPGME does. This fixes dirmngr_ldap process windows and other spurious reports about e.g. a gpgv console window from loadswdb. GnuPG-Bug-Id: T3937 Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
* | Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2018-04-101-32/+63
|\| | | | | | | | | | | | | | | | | -- Fixed conflicts: NEWS - keep master configure.ac - merge g10/card-util.c - mostly 2.2 g10/sig-check.c - 2.2
| * gpg,w32: Fix empty homedir when only a drive letter is used.Werner Koch2018-04-091-32/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (copy_dir_with_fixup): New. (default_homedir): Use here. (gnupg_set_homedir): And here . -- This actually fixes a couple of cases for Windows. Both --home-dir and GNUPGHOME. The interpretation of "c:" -> "c:/" might not be the correct one but because we need an absolute dir anyway it is the less surprising one. Note that this does not include a full syntax check and fixup and thus it is very well possible that the result is not an absolute directory. GnuPG-bug-id: 3720 Signed-off-by: Werner Koch <wk@gnupg.org>
* | Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2018-03-272-0/+48
|\|
| * agent: New OPTION pretend-request-originWerner Koch2018-03-232-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/shareddefs.h (request_origin_t): New. * common/agent-opt.c (parse_request_origin): New. (str_request_origin): New. * agent/command.c (option_handler): Implement new option. -- This allows to pretend that a request originated from the extra or browser socket. Signed-off-by: Werner Koch <wk@gnupg.org>
* | Change license of argparse.c back to LGPLv2.1Werner Koch2018-03-212-45/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/argparse.c, common/argparse.h: Change license -- On 2011-09-30 the license of these two files were changed from LGPLv2.1 to LGPLv3+/GPLv2+. This was part of a general change from files with either GPLv3+ or LGPv2.1+ to this combination so to allow the use of these files with GPLv2only code. Since then the code was only modified by employees of g10 Code GmbH under my direction and myself. The following changes commit 7249ab0f95d1f6cb8ee61eefedc79801bb56398f Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net> AuthorDate: Tue Jan 10 15:59:36 2017 -0500 commit eed16ccebf8fd1fdf9709affbd5c831f6957b8ae Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net> AuthorDate: Fri Nov 21 17:04:42 2014 -0500 and a few typo fixes are minor and thus not copyright-able. Signed-off-by: Werner Koch <wk@gnupg.org>
* | Merge branch 'STABLE-BRANCH-2-2'Werner Koch2018-02-224-2/+72
|\|
| * Release 2.2.5gnupg-2.2.5Werner Koch2018-02-222-2/+2
| | | | | | | | Signed-off-by: Werner Koch <wk@gnupg.org>
| * common: Use new function to print status strings.Werner Koch2018-02-142-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2018-01-252-1/+28
|\| | | | | | | Signed-off-by: Werner Koch <wk@gnupg.org>
| * kbx: Simplify by removing custom memory functions.Werner Koch2017-12-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kbx/keybox-util.c (keybox_set_malloc_hooks): Remove. (_keybox_malloc, _keybox_calloc, keybox_realloc) (_keybox_free): Remove. (keybox_file_rename): Remove. Was not used. * sm/gpgsm.c (main): Remove call to keybox_set_malloc_hooks. * kbx/kbxutil.c (main): Ditto. * kbx/keybox-defs.h: Remove all separate includes. Include util.h. remove convenience macros. * common/logging.h (return_if_fail): New. Originally from keybox-defs.h but now using log_debug. (return_null_if_fail): Ditto. (return_val_if_fail): Ditto. (never_reached): Ditto. -- Originally the KBX code was written to allow standalone use. However this required lot of ugliness like separate memory allocators and such. It also precludes the use of some standard functions from common due to their use of the common gnupg malloc functions. Dropping all that makes things easier. Minor disadvantages: the kbx call done for gpg will now use gcry malloc fucntions and not the standard malloc functions. This might be a bit slower but removing them even fixes a possible bug in keybox_tmp_names which is used in gpg and uses gpg's xfree which is actually gcry_free. Signed-off-by: Werner Koch <wk@gnupg.org>
| * common: Use larger buffer for homedir in case of 64 bit UIDs.Werner Koch2017-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Enlarge PREFIX by 6 bytes for "/gnupg". -- The temporary buffer was to short for the extra "/gnupg". However the 20 bytes for the UID is large enough for all 32 bit UIDs and would only fail (detected) if a 64 bit UID is used. Fixes-commit: 17efcd2a2acdc3b7f00711272aa51e5be2476921 Reported-by: Rainer Perske. Signed-off-by: Werner Koch <wk@gnupg.org>
* | gpg: New maintainer option --debug-set-iobuf-size.Werner Koch2018-01-241-3/+1
| | | | | | | | | | | | | | | | | | | | * g10/gpg.c (opts): Add new option. (opt_set_iobuf_size): New var. (set_debug): Set the option. * tests/openpgp/armor.scm: Use this option to revert the buffer size to the one which used to exhibit the tested bugs. Signed-off-by: Werner Koch <wk@gnupg.org>
* | iobuf: Increase the size of the buffer. Add iobuf_set_buffer_size.Werner Koch2018-01-242-35/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/iobuf.c (IOBUF_BUFFER_SIZE): Rename to DEFAULT_IOBUF_BUFFER_SIZE and increase to 64k. (iobuf_buffer_size): New var. Always use this instead of the macro. (iobuf_set_buffer_size): New. (struct file_filter_ctx_t): Add field delayed_rc. (file_filter) [!W32]: Try to fill the supplied buffer. -- I did some test to see whether this has an effect. A test program piped 100 million random bytes to gpg to symmetric encryption only w/0 compression. Single read means the old behaviour, multi read the new behaviour which fills up the buffer when the read(2) returned only 4k in once call. 8k buffer single read User time (seconds): 0.09 System time (seconds): 0.04 Percent of CPU this job got: 6% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.04 8k buffer multi read User time (seconds): 0.08 System time (seconds): 0.05 Percent of CPU this job got: 6% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.04 64k buffer single read User time (seconds): 0.09 System time (seconds): 0.06 Percent of CPU this job got: 6% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.20 64k buffer multi read User time (seconds): 0.11 System time (seconds): 0.06 Percent of CPU this job got: 8% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.01 128k buffer single read User time (seconds): 0.09 System time (seconds): 0.05 Percent of CPU this job got: 7% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.05 128k buffer multi read User time (seconds): 0.11 System time (seconds): 0.05 Percent of CPU this job got: 8% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.01 512k buffer single read: User time (seconds): 0.08 System time (seconds): 0.08 Percent of CPU this job got: 7% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.21 512k buffer multi read: User time (seconds): 0.10 System time (seconds): 0.06 Percent of CPU this job got: 7% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.05 Does not make much of a difference :-(. Maybe it changes depending on the type of used filters. Signed-off-by: Werner Koch <wk@gnupg.org>
* | gpg: First take on PKT_ENCRYPTED_AEAD.Werner Koch2018-01-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (PKT_ENCRYPTED_AEAD): New const. * g10/dek.h (DEK): Increase size of use_aead to 4 bits. * g10/filter.h (cipher_filter_context_t): Add new fields for AEAD. * g10/packet.h (PKT_encrypted): Add fields aead_algo, cipher_algo, and chunkbyte. * g10/build-packet.c (do_encrypted_aead): New. (build_packet): Call it. * g10/parse-packet.c (dump_sig_subpkt): Handle SIGSUBPKT_PREF_AEAD. (parse_one_sig_subpkt, can_handle_critical): Ditto. (parse_encrypted): Clear new PKT_ENCRYPTED fields. (parse_encrypted_aead): New. (parse): Call it. * g10/gpg.c (main): Take care of --rfc4880bis option when checking compliance. * g10/cipher-aead.c: Replace the stub by real code. * g10/decrypt-data.c (decode_filter_ctx_t): Add fields for use with AEAD. (aead_set_nonce): New. (aead_set_ad): New. (decrypt_data): Support AEAD. (aead_underflow): New. (aead_decode_filter): New. * g10/encrypt.c (use_aead): Make that new fucntion work. (encrypt_simple): Use default_aead_algo() instead of EAX. * g10/mainproc.c (proc_encrypted): Support AEAD. (do_proc_packets): Support PKT_ENCRYPTED_AEAD. -- This code has seen only a very few manual tests. Encrypting always uses a 64k chunks and decryption has not been tested with larger chunks. Those small chunks make debugging much faster. Tests can be done using: gpg --rfc4880bis --pinentry-mode=loopback --passphrase abc \ --force-aead --aead-algo ocb --s2k-mode 0 --cipher AES \ -v -z 0 --status-fd 2 -c <INFILE >OUTFILE and gpg --rfc4880bis --pinentry-mode=loopback --passphrase=abc \ --status-fd 2 -v -d <INFILE >OUTFILE Signed-off-by: Werner Koch <wk@gnupg.org>
* | gpg: Add option and preference framework for AEAD.Werner Koch2018-01-101-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (aead_algo_t): New. (SIGSUBPKT_PREF_AEAD): New. * g10/gpg.c (oAEADAlgo, oPersonalAEADPreferences): New. (opts): New options --aead-algo and --personal-aead-preferences. (set_compliance_option): Clar aead algo. (main): Parse and check the new options * g10/options.h (struct opt): Add fields def_aead_algo and personal_aead_prefs. * g10/packet.h (PREFTYPE_AEAD): New enum value. (PKT_user_id): Add field flags.aead. (PKT_public_key): Add field flags.aead. * g10/pkclist.c (select_algo_from_prefs): Support PREFTYPE_AEAD. * g10/getkey.c (fixup_uidnode): Set AEAD flag. (merge_selfsigs): Ditto. * g10/kbnode.c (dump_kbnode): Show aead flag. * g10/keyedit.c (show_prefs): Ditto. (show_key_with_all_names_colon): Ditto. * g10/keygen.c (aead_presf, n_aead_prefs): New vars. (set_one_pref): Suppport PREFTYPE_AEAD. (keygen_set_std_prefs): Parse AEAD preferences. (keygen_get_std_prefs): Ditto. (add_feature_aead): New. (keygen_upd_std_prefs): Call that and build AEAD pref packet. * g10/main.h (DEFAULT_AEAD_ALGO): New const. * g10/misc.c (openpgp_aead_test_algo): New. (openpgp_aead_algo_name): New. (string_to_aead_algo): New. (default_aead_algo): New. -- This is only used in --rfc4880bis mode and not really tested. Signed-off-by: Werner Koch <wk@gnupg.org>
* | Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2017-12-181-2/+12
|\| | | | | | | | | | | -- Signed-off-by: Werner Koch <wk@gnupg.org>
| * build: New configure option --enable-run-gnupg-user-socket.Werner Koch2017-12-121-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: (USE_RUN_GNUPG_USER_SOCKET): New ac_define. * common/homedir.c (_gnupg_socketdir_internal): Add extra directories. -- This allows to build GnuPG with an extra socketdir below /run. See https://lists.gnupg.org/pipermail/gnupg-devel/2017-November/033250.html for a longer explanation why this is sometimes useful. Suggested-by: Rainer Perske Signed-off-by: Werner Koch <wk@gnupg.org>
| * Revert: build: Do not define logging.h constants for ...Werner Koch2017-12-081-17/+9
| | | | | | | | | | | | | | | | | | | | --- This reverts commit 2fedf8583bcc493f587c90bc9632d25dfd10bd10. We better solve this on the libgpg-error side. Signed-off-by: Werner Koch <wk@gnupg.org>
| * build: Do not define logging.h constants for libgpg-error dev versions.Werner Koch2017-12-071-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.h [GPGRT_LOG_WITH_PREFIX]: Do not define the log constants. -- logging.h uses constants we plan to use for future versions of libgpg-error. My dev version already has the logging functions and thus I run into a conflict. This patch protects against this and make the GnuPG work with later libgpg-error versions. It was not the best idea to use constants from a planned libgpg-error in the first place. The actual problem are the enums, the macros won't harm. Signed-off-by: Werner Koch <wk@gnupg.org>
| * common: Accept the Z-suffix for yymmddThhmmssZ format.NIIBE Yutaka2017-11-011-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | * common/gettime.c (isotime_p): Accept the Z suffix. -- The intention is use for human interface. GnuPG-bug-id: 3278 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org> (cherry picked from commit ba8afc4966cca1f6aaf9b2a9bfc3220782306c2b)
* | Adjust for changed macro names in libgpg-error master.Werner Koch2017-12-113-11/+21
| | | | | | | | | | | | | | | | | | | | * common/logging.h (GPGRT_LOGLVL_): New replacement macros for older libgpg-error versions. -- Updates-commit: b56dfdfc1865ceb7c3c025d79996e049faee7fdf Signed-off-by: Werner Koch <wk@gnupg.org>
* | doc: Update copyright notices for common/exechelp*.Werner Koch2017-11-294-6/+11
| | | | | | | | | | | | | | | | | | -- Verified that all authors are either g10 Code employees or (in one case) a work for hire. Signed-off-by: Werner Koch <wk@gnupg.org>
* | Use the gpgrt log functions if possible.Werner Koch2017-11-272-9/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | assuan: Fix exponential decay for first second.Werner Koch2017-11-152-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp.c (wait_for_sock): Round SECSLEFT. * dirmngr/dirmngr.c (main): Take care of --debug-wait also in dameon mode. * common/sysutils.c (gnupg_usleep) [HAVE_NANOSLEEP]: Fix nanosleep use. -- Without the rounding we saw in verbose mose [...]to come up ... (5s) [...]to come up ... (4s) immediately without the expected one second delay. Waiting for the next seconds did not work if nanosleep was used due to improper passed parameters in gnupg_usleep. Adding --debug-wait for dirmngr in daemon mode is required to test this change. GnuPG-bug-id: 3490 Fixes-commit: 149041b0b917f4298239fe18b5ebd5ead71584a6 Signed-off-by: Werner Koch <wk@gnupg.org>
* | common: Change log_clock to printf style.Werner Koch2017-11-152-5/+17
| | | | | | | | | | | | * common/logging.c (log_clock): Use do_logv. Signed-off-by: Werner Koch <wk@gnupg.org>
* | i18n: Add an article to "agent" and lowercase "dirmngr" in one file.Werner Koch2017-11-151-4/+4
| | | | | | | | | | | | -- Signed-off-by: Werner Koch <wk@gnupg.org>
* | common: Tweak new code to keep already translated strings.Werner Koch2017-11-151-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp.c (wait_for_sock): Replace NAME by WHICH and adjust caller. Revert to use the former strings. -- Note that the second of these strings "waiting for the agent to come up ... (%ds)\n" "connection to agent established\n" does not use a proper article. This should be fixed but would introduce a string change so that it is better done in a separate commit. Fixes-commit: 0471ff9d3bf8d6b9a359f3c426d70d0935066907 Signed-off-by: Werner Koch <wk@gnupg.org>
* | assuan: Use exponential decay for first 1s of spinlock.Daniel Kahn Gillmor2017-11-081-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp.c (wait_for_sock): instead of checking the socket every second, we check 10 times in the first second (with exponential decay). -- This cuts the wall clock time for the standard test suite roughly by half. GnuPG-bug-id: 3490 Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* | assuan: Reorganize waiting for socket.Daniel Kahn Gillmor2017-11-081-42/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp.c (wait_for_sock): New function, collecting codepaths from... (start_new_gpg_agent) here and... (start_new_dirmngr) here. -- This has no functional change, but makes it easier to make this function more efficient. GnuPG-bug-id: 3490 Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* | gpg,sm: New option --with-key-screening.Werner Koch2017-10-173-1/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/pkscreening.c: New. * common/pkscreening.h: New. * common/Makefile.am (common_sources): Add them. * g10/gpg.c (opts): New option --with-key-screening. * g10/options.h (struct opt): New field with_key_screening. * g10/keylist.c: Include pkscreening.h. (print_pk_screening): New. (list_keyblock_print): Call it. (print_compliance_flags): Call it. * sm/gpgsm.c (opts): New option --with-key-screening. * sm/gpgsm.h (scruct opt): New field with_key_screening. * sm/keylist.c: Include pkscreening.h. (print_pk_screening): New. (print_compliance_flags): Call it. Add new arg cert. (list_cert_colon): Pass arg cert (list_cert_std): Call print_pk_screening. * sm/fingerprint.c (gpgsm_get_rsa_modulus): New. -- This new option can be used to detect ROCA affected keys. To scan an entire keyring and print the affected fingerprints use this: gpg -k --with-key-screening --with-colons | gawk -F: \ '$1~/pub|sub|sec|ssb|crt/ && $18~/\<6001\>/ {found=1;next}; $1=="fpr" && found {print $10}; {found=0}' The same works for gpgsm. Note that we need gawk due to the "\<" in the r.e. Signed-off-by: Werner Koch <wk@gnupg.org>
* | common: Add constant KEYGRIP_LEN.Werner Koch2017-09-271-0/+5
| | | | | | | | | | | | | | | | * common/util.h (KEYGRIP_LEN): New. * g10/call-agent.c (agent_probe_any_secret_key): Use that constant. * g10/keyid.c (keygrip_from_pk): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
* | gpg: Let --debug clock time sign and verify.Werner Koch2017-09-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (ENABLE_LOG_CLOCK): New ac_define and option. * common/logging.c (log_clock): Use ENABLE_LOG_CLOCK to enable timestamp printing. * g10/call-agent.c (agent_pksign): Time signing. * g10/sig-check.c (check_signature_end_simple): Time verification. -- Timing for verification is limited to data signatures because this is the most common thing to evaluate. We should consider to change log_clock to printf style so that we could print the signature class and other info. Signed-off-by: Werner Koch <wk@gnupg.org>
* | common: Accept the Z-suffix for yymmddThhmmssZ format.NIIBE Yutaka2017-09-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | * common/gettime.c (isotime_p): Accept the Z suffix. -- The intention is use for human interface. GnuPG-bug-id: 3278 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | common: Fix gnupg_wait_processes.NIIBE Yutaka2017-09-191-24/+26
|/ | | | | | | | | | | | | | | * common/exechelp-posix.c (gnupg_wait_processes): Loop for r_exitcodes even if we already see an error. -- The value stored by waitpid for exit code is encoded; It requires decoded by WEXITSTATUS macro, regardless of an error. For example, when one of processes is already exited and another is still running, it resulted wrong value of in r_exitcodes[n]. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* indent: Wrap overlong lines in argparse.cWerner Koch2017-08-011-5/+10
| | | | --
* gpg: Tweak compliance checking for verificationWerner Koch2017-07-271-44/+39
| | | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_allowed): Rework to always allow verification. * g10/mainproc.c (check_sig_and_print): Print a con-compliant warning. * g10/sig-check.c (check_signature2): Use log_error instead of log_info. -- We should be able to verify all signatures. So we only print a warning. That is the same beheavour as for untrusted keys etc. GnuPG-bug-id: 3311 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg,sm: Fix compliance checking for decryption.Werner Koch2017-07-271-14/+32
| | | | | | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_compliant): Remove the Elgamal signing check. We don't support Elgamal signing at all. (gnupg_pk_is_allowed) <de-vs>: Revert encryption/decryption for RSA. Check the curvenames for ECDH. * g10/pubkey-enc.c (get_session_key): Print only a warning if the key is not compliant. * sm/decrypt.c (gpgsm_decrypt): Ditto. Use the same string as in gpg so that we have only one translation. -- We always allow decryption and print only a note if the key was not complaint at the encryption site. GnuPG-bug-id: 3308 Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Strip trailing slashes from the homedir.Werner Koch2017-07-251-6/+57
| | | | | | | | | | | | | | | | | | * common/homedir.c (default_homedir): Strip trailing slashes. (gnupg_set_homedir): Ditto. -- is_gnupg_default_homedir() does not ignore trailing slashes when comparing directory names. This can lead to multiple agents started on the same directory if the homedir was specified with --homedir or GNUPGHOME without or with a number of slashes. We now make sure that the home directory name never ends in a slash (except for the roo of course). GnuPG-bug-id: 3295 Signed-off-by: Werner Koch <wk@gnupg.org>
* common: New functions gnupg_daemon_rootdir and gnupg_chdir.Werner Koch2017-07-254-1/+40
| | | | | | | | | | | * common/sysutils.c (gnupg_chdir): New. * common/homedir.c (gnupg_daemon_rootdir): New. * agent/gpg-agent.c (main): Use these functions instead chdir("/"). * dirmngr/dirmngr.c (main): Ditto. * scd/scdaemon.c (main): Ditto. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* common: New function print_utf9_string.Werner Koch2017-07-202-0/+11
| | | | | | | | | * common/miscellaneous.c (print_utf8_string): New. -- This is a simple convenience function. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: logstream fix.NIIBE Yutaka2017-07-201-1/+2
| | | | | | * common/logging.c (set_file_fd): Don't close es_stderr. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>