Commit Graph

8727 Commits

Author SHA1 Message Date
NIIBE Yutaka 0c7dffe99d sm: Fix parsing encrypted data.
* sm/minip12.c (cram_octet_string): Finish when N==0.
(parse_bag_encrypted_data): Support constructed data with multiple
octet strings.

--

Backport master commit of:
	6c50834c09

GnuPG-bug-id: 5793
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-03-09 10:57:22 +09:00
Werner Koch 847d618454
gpgsm: New option --require-compliance
* sm/gpgsm.c (oRequireCompliance): New.
(opts): Add --require-compliance.
(main): Set option.
* sm/gpgsm.h (opt): Add field require_compliance.
(gpgsm_errors_seen): Declare.
* sm/verify.c (gpgsm_verify): Emit error if non de-vs compliant.
* sm/encrypt.c (gpgsm_encrypt): Ditto.
* sm/decrypt.c (gpgsm_decrypt): Ditto.
2022-03-08 19:06:30 +01:00
Werner Koch 17890d4318
gpg: New option --require-compliance.
* g10/options.h (opt): Add field flags.require_compliance.
* g10/gpg.c (oRequireCompliance): New.
(opts): Add --require-compliance.
(main): Set option.
* g10/mainproc.c (proc_encrypted): Emit error if non de-vs compliant.
(check_sig_and_print): Ditto.
* g10/encrypt.c (encrypt_crypt): Ditto.
--

Note that in the --encrypt and --verify cased other checks may kick in
earlier than this new --require-compliance controlled one.
2022-03-08 18:19:38 +01:00
Werner Koch c11292fe73
gpg: Give Libgcrypt CFLAGS a higher priority than SQlite.
* g10/Makefile.am (AM_CFLAGS): Reorder.
--

The more specific CLFAGS should come first so these are picked up
first.  We really should improve the build system to enforce this
rule.  In particular /usr/local/include should come after any more
specific location.
2022-03-08 10:13:06 +01:00
Werner Koch 5492079def
gpgtar,w32: Support file names longer than MAX_PATH.
* tools/gpgtar.c: Replace assert by log_assert.
* tools/gpgtar-extract.c: Ditto.
(extract_regular): Create files with sysopen flag.
* tools/gpgtar-create.c (scan_directory): Use gpgrt_fname_to_wchar.
--

Note that for this change libgpg-error 1.45 is required for Windows.
2022-03-04 15:00:16 +01:00
Werner Koch 4122896a39
common,w32: Support file names longer than MAX_PATH in iobuf.
* common/iobuf.c (direct_open): Use gpgrt_fname_to_wchar.
(any8bitchar): Remove.
2022-03-04 14:54:26 +01:00
Jussi Kivilinna 9116fd1e9a
g10: Avoid extra hash contexts when decrypting MDC input
* g10/mainproc.c (mainproc_context): New member
'seen_pkt_encrypted_mdc'.
(release_list): Clear 'seen_pkt_encrypted_mdc'.
(proc_encrypted): Set 'seen_pkt_encrypted_mdc'.
(have_seen_pkt_encrypted_aead): Rename to...
(have_seen_pkt_encrypted_aead_or_mdc): ...this and add check for
'seen_pkt_encrypted_mdc'.
(proc_plaintext): Do not enable extra hash contexts when decrypting
MDC input.
--

Avoiding extra hash contexts speeds up CFB/MDC decryption quite
a lot. For example, decrypting symmetric-key AES-256 encrypted
4 GiB file from RAM to /dev/null sees ~3.4x speed increase on
AMD Ryzen 5800X:

 AES256.CFB encryption: 783 MB/s
 AES256.CFB decryption: 386 MB/s (before)
 AES256.CFB encryption: 1.3 GB/s (after patch)

Note, AEAD is still significantly faster:

 AES256.OCB encryption: 2.2 GB/s
 AES256.OCB decryption: 3.0 GB/s

GnuPG-bug-id: T5820
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
(cherry picked from commit ab177eed51)

Even 2.2 with the older Libgcrypt 1.8 gets a threefold speedup; see
https://dev.gnupg.org/T5820#155447 (AES-128 vs. AES-256 does not make
a substanial difference)

Signed-off-by: Werner Koch <wk@gnupg.org>
2022-02-24 14:14:48 +01:00
Werner Koch a2db490de5
scd:p15: Used extended mode already for RSA 2048
* scd/app-p15.c (do_sign, do_decipher): Replace GT by GE.
--
2022-02-21 12:23:04 +01:00
Werner Koch f7e13adb96
po: Fix typo in German translation
--
2022-02-21 12:22:50 +01:00
NIIBE Yutaka f064d972e3 tests: Remove a test case with "quiet" option with gpgconf.
* tests/openpgp/gpgconf.scm: Remove "quiet" test.

--

Fixes-commit: 2f2130ff24
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-02-17 14:17:27 +09:00
NIIBE Yutaka 3c3765405d scd: Use lock_slot for apdu_send_direct.
* scd/apdu.c (apdu_send_direct): Use lock_slot.

--

Cherry-pick the master commit of:
	f808012ac2

With trylock_slot, it may return SW_HOST_BUSY.  This may occur when
apdu_get_status is called by scd_update_reader_status_file.

Simply using lock_slot is much easier for user of apdu_send_direct.

GnuPG-bug-id: 5831
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-02-17 14:05:01 +09:00
Werner Koch 2f2130ff24
gpgconf: Do not show "quiet" as option.
* tools/gpgconf-comp.c: Remove "quiet" and two unsupported options
--

The --quiet option is not intended for config files and thus should
not be displayed by config dialogs.
2022-02-09 20:08:58 +01:00
Werner Koch 5f3e857ef6
Post release updates
--
2022-02-07 21:44:36 +01:00
Werner Koch 04d40a680b
Release 2.2.34 2022-02-07 20:24:26 +01:00
Werner Koch 3c79ff34c4
dirmngr: Changes to the linking order.
* dirmngr/Makefile.am: Tweak library order.
2022-02-07 20:24:22 +01:00
Werner Koch cd6a165d61
po: msgmerge introduced indenting for ja.po
--
2022-02-07 18:24:26 +01:00
Werner Koch ce6e0b172e
Update copyright notices.
--

Note that for this LTS version we now print g10 Code as the first
copyright holder with --version.  This is to avoid confusion at our
customers, now that we also provide a Linux^WGNU/Linux version of
GnuPG VS-Desktop and the Windows version has always shown g10 Code.
2022-02-07 18:22:30 +01:00
Werner Koch 5a7ed6dd8f
gpgconf: Make gpgconf --launch dirmngr work again
* tools/gpgconf.h (gc_component_id_t): Fix the order.
--

The order has not been adjusted here in 2.2 after we have changed the
order of the gc_components array to have a more logical layout of the
tabs in Gpa and Kleopatra's setting dialogs.  In 2.3 everything is
correct, probably because we have another component (keyboxd) there.
2022-02-07 18:04:10 +01:00
Werner Koch 32b364b99b
gpgconf: Print the used code pages on Windows with --show-configs
* tools/gpgconf.c (show_configs): Add some code
2022-02-07 17:59:31 +01:00
Werner Koch 7d1215cb9c
common: Fix creation of Windows socket directories.
* common/homedir.c (w32_try_mkdir): Remove.
(standard_homedir): Use gnupg_mkdir instead of w32_try_mkdir.
(_gnupg_socketdir_internal): Ditto.
--

The w32_try_mkdir was once introduced for WindowsCE and unfortunately
at a too brief inspection it looks like it does the utf8->wchar
conversion.  Which it does not.  Thus I obviously never tested the
switch to from APPDATA to LOCAL_APPDATA with a non-ascii account name.
That might have been due to the use of the very same code for the
homedir - but there is other code in gpg to create the homedir; thus a
failure here is mostly fixed later.

The missing error diagnostic was - and is - on purpose to avoid such
error messages due to a race between several running gpg instances.

GnuPG-bug-id: 5537
2022-02-07 17:59:22 +01:00
NIIBE Yutaka 8021fe7670 po: Update Japanese Translation.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-02-07 19:29:37 +09:00
Werner Koch 98f84479ae
po: Auto update
--
2022-02-07 10:21:57 +01:00
Werner Koch 03c547ee04
po: Update the German translation
--
2022-02-07 10:20:35 +01:00
Werner Koch c8cd66ae7e
m4: Update our library m4 files from master
* m4/gpg-error.m4: Updated
* m4/ksba.m4: Updated
* m4/libassuan.m4: Updated
* m4/libgcrypt.m4: Updated
* m4/npth.m4: Updated
* m4/ntbtls.m4: Updated
--

This better fits with the new gpgrt-config system
2022-02-04 18:30:19 +01:00
Werner Koch 137590fd86
dirmngr: Allow building with non-standard ntbtls location.
* dirmngr/Makefile.am: Add missing -L and -I
--
2022-02-03 21:54:09 +01:00
Werner Koch 0b76ef48e1
dirmngr: Simplify --gpgconf-list output
* dirmngr/dirmngr.c (main): Keep only values with the default flag.
--

This is not anymore required abnd brings us in sync with 2.3.
2022-02-03 18:28:25 +01:00
Werner Koch bcf446b70c
sm: New option --ignore-cert-with-oid.
* sm/gpgsm.c (oIgnoreCertWithOID): New.
(opts): Add option.
(main): Store its value.
* sm/call-agent.c (learn_cb): Test against that list.
--
2022-02-03 14:29:19 +01:00
Werner Koch e058d15d2d
gpgconf: Return the compliance_de_vs item.
* tools/gpgconf-comp.c (known_options_gpg): Add missing pseudo option.
2022-02-02 20:39:42 +01:00
Werner Koch dde88897e2
dirmngr: Avoid initial delay on the first keyserver access.
* dirmngr/dirmngr.c (dirmngr_never_use_tor_p): New.
* dirmngr/server.c (ensure_keyserver): Don't even test for the Tor
proxy in never-use-tor Mode.

* tools/gpgtar-create.c: Include unistd.h to avoid a warning on
Windows.
--

This delay of 2 or 3 seconds is in particular annoying on Windows.
This is now suppressed, as it should be, if --no-use-tor is used.

The second patch is unrelated
2022-02-01 16:02:20 +01:00
Werner Koch d426ed66ac
gpg: Set --verbose and clear --quiet in debug mode.
* g10/gpg.c (set_debug): Tweak options.
--
2022-02-01 15:17:52 +01:00
Werner Koch 2331900d1c
ssh: Fix adding an ed25519 key with a zero length comment.
* agent/command-ssh.c (sexp_key_construct): Do not put an empty string
into an S-expression.
(stream_read_string): Do not not try to a read a zero length block.
--

Actually we could handles this different by not putting a comment tag
into the s-expression, however this requires more code and at other
places we already return "(none)" instead of an empty comment.

The second fix is more or less a cosmetic thing to get better error
messages in case the underlying read system call returns an error.

GnuPG-bug-id: 5794
2022-01-28 20:00:50 +01:00
Werner Koch e1fc053dc1
gpgconf: Tweak the use of ldapserver.
* tools/gpgconf-comp.c (known_options_gpgsm): Make "keyserver"
invisible.
(known_options_dirmngr): Add "ldapserver".
* sm/gpgsm.c (oKeyServer_deprecated): New.
(opts): Assign "ldapserver" to the new option and makr it as obsolete.
--

We want to use "ldapserver" in dirmngr but need to keep using
"keyserver" in gpgsm for existant versions of Kleopatra etc.

GnuPG-bug-id: 5801
2022-01-27 15:22:48 +01:00
Werner Koch eefa2d19ee
gpgconf: Some more fixes for the backported stuff.
* agent/gpg-agent.c (main) <gpgconf_list>: Keep only those option which
have a default.  Remove runtime flag.
* common/gc-opt-flags.h (GC_OPT_FLAG_RUNTIME): Move to ...
* tools/gpgconf-comp.c: here because it is now inetrnal to gpgconf.
(known_options_gpg_agent): Add a few missing runtime flags.  Remove
"options".  Add "check-sym-passphrase-pattern".
(known_options_scdaemon, known_options_gpgsm): Remove "options".
(dirmngr): Ditto.

* tools/gpgconf-comp.c (is_known_option): Return only options having a
value for name.  Thus we list list options from the known_options
tables.
2022-01-26 16:43:46 +01:00
Werner Koch 85300587cc
gpgconf: Fix --list-options for forced options
* tools/gpgconf-comp.c: Remove assert.h and replace all assert calls
by log_assert.
(known_options_gpg): Add "keyserver" as invisible.  Remove "options".
(known_pseudo_options_gpg, known_pseudo_options_gpgsm): New.
(gc_component): Add field known_pseudo_options.
(struct read_line_wrapper_parm_s): New.
(read_line_wrapper): New.
(retrieve_options_from_program): Use read_line_wrapper to handle
pseudo options.
(retrieve_options_from_program): Ignore to be ignored options.  Add
failsafe code to avoid calling percent_escape with NULL.
--

GnuPG-bug-id: 5341,5800

Due to reading the list of options from the argparser of the
component, we had no more information about the pseudo options and
thus could not emit them.  Well, there is just one pseudo option right
now, but with this change we have a generalized concept for them:
Pseudo options are used to convey information from a component to
gpgconf; for example build-in values.

This is a combined backport of patches to master.
2022-01-26 13:32:17 +01:00
Werner Koch d8e6d1e9ed
common: Fix returning of option attributes for options with args.
* common/argparse.c (gnupg_argparse): Set attribute flags
--
GnuPG-bug-id: 5799

This is a backport from the fix in libgpg-error in case gnupg 2.2 is
build against an older version of libgpg-error.
2022-01-25 19:05:16 +01:00
Werner Koch 38c666ec3f
scd: Also prefer Yubikeys if no reader port is given.
* scd/apdu.c (select_a_reader): Extend the white list.
2022-01-25 19:02:38 +01:00
Werner Koch b64cae5abb
doc: Add comments on the legacy status of gpgconf.conf.
--
2022-01-25 10:09:49 +01:00
Ingo Klöcker 9f64bf6c0b po: Remove duplicate message definitions
--

This fixes fatal errors reported by msgfmt which made the build fail.

Note: The other translation of "Please re-enter this passphrase" uses
"das Passwort" instead of "die Passphrase". I chose to keep the
translation using "das Passwort" which seems to be the preferred
translation of "passphrase" used in almost all German strings.

Fixes-commit: c54f7e154f
Cherry picking translations is dangerous. Sorting messages by msgid
should make it less dangerous and would make it much easier to spot
duplicates.
2022-01-17 14:20:27 +01:00
Werner Koch c54f7e154f
po: Make agent/commands.c translatable and update German translation.
--

GnuPG-bug-id: 4777

This also fixes a bad fuzzy translation which accidently had been
commited without realizing that there was indeed a change (from
"... GnuPG" to "... %s").

(cherry picked from commit 5ed1567e7c)
2022-01-17 09:00:40 +01:00
NIIBE Yutaka 4cc724639c gpg: Fix adding the list of ultimate trusted keys.
* g10/keygen.c (do_generate_keypair): Remove call to
register_trusted_keyid for updating user_utk_list.
* g10/trust.c (register_trusted_keyid): Remove.
(update_ownertrust): Add call to tdb_update_utk.
* g10/trustdb.c (tdb_register_trusted_keyid): Make it internal
function by adding "static" qualifier.
Replace calls of register_trusted_keyid to tdb_register_trusted_keyid.
(tdb_update_utk): New.
* g10/trustdb.h (tdb_update_utk): New.

--

Backport of master commit of:
	4aeeaa65ad

GnuPG-bug-id: 5742
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-01-17 13:58:58 +09:00
Werner Koch f16c535eee
gpgconf: Add command aliases -L -K -R.
* tools/gpgconf.c (enum cmd_and_opt_values): Assign shortcuts.
--

I have to type them to often ;-)
2022-01-12 20:32:31 +01:00
Werner Koch 96db487a4d
common,w32: Improve HKCU->HKLM fallback
* common/w32-reg.c (read_w32_registry_string): Add another fallback.
--

We use the same method in gpgme and libgpg-error since 2017 - should
be done here as well.  Thus the fallback also happens if the key
exists but not the actual entry.
2022-01-12 14:48:55 +01:00
Werner Koch bf4cf04a54
gpgtar: List and extract using extended headers.
* tools/gpgtar.h (TF_EXTHDR, TF_GEXTHDR): New.
* tools/gpgtar-list.c (parse_header): Set the new type flags.
(parse_extended_header): New.
(read_header): Add arg r_extheader and parse extended header.
(print_header): Consult the extended header.
(gpgtar_list): Pass an extended header object.
(gpgtar_read_header): Ditto.
(gpgtar_print_header): Ditto.
* tools/gpgtar-extract.c (extract): New arg exthdr and factor name
checking out to ...
(check_suspicious_name): new.
(extract_regular): Add arg exthdr and consult it.
(extract_directory): Likewise.
(gpgtar_extract): Provide extheader object.
--

GnuPG-bug-id: 5754
2022-01-10 09:28:10 +01:00
Werner Koch ec69ceab26
gpgtar: Create extended header for long file names
* tools/gpgtar-create.c (global_header_count): new.
(myreadlink): New.
(build_header): New arg r_exthdr.  Detect and store long file and link
names.  Factor checkum computation out to ...
(compute_checksum): new.
(add_extended_header_record): New.
(write_extended_header): New.
(write_file): Write extended header.
--

GnuPG-bug-id: 5754
2022-01-10 09:24:58 +01:00
Werner Koch c4153f7021
build: Fixes recent commits to still build with gpgrt 1.27.
* agent/gpg-agent.c (main): Use gnupg_argparse.
* tools/gpgconf-comp.c: Use gnupg_opt_t.
* tools/gpgconf.c (show_version_gnupg): Use strusage.
--
2021-12-30 10:48:44 +01:00
Werner Koch c69c51bce0
gpgconf: Do not list ignored options and mark forced options as r/o.
* tools/gpgconf-comp.c (list_one_option): Skip ignored options and set
the no_change flag for forced options.
(retrieve_options_from_program): Put the attributes into the option
table.
--

(cherry picked from commit 42785d7c8a)
This commit also marks the end of the back port as requested by
GnuPG-bug-id: 5732
2021-12-30 10:23:01 +01:00
Werner Koch bf284fdf22
dirmngr: Re-group the options in the --help output.
--

This looks better and is also required for further simplifications of
gpgconf.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 4c43fabbb0)
2021-12-30 09:23:45 +01:00
Werner Koch 5fb71a8e03
gpgsm: Re-group the options in the --help output.
--

This looks better and is also required for further simplifications of
gpgconf.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 9bc3e7ec03)
2021-12-30 09:07:13 +01:00
Werner Koch f7bde071cc
gpg: Re-group the options in the --help output.
* g10/gpg.c (opts): Change oLoadExtensions, oStrict, and oNoStrict to
use ARGPARSE_ignore and remove the code in the option switch.
--

This looks better and is also required for further simplifications of
gpgconf.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 41eb5108ce)
2021-12-29 22:52:38 +01:00
Werner Koch 7f9791e167
scd: Re-group the options in the --help output.
--

This looks better and is also required for further simplifications of
gpgconf.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit daf5f4355d)
2021-12-29 21:24:42 +01:00