1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

9207 Commits

Author SHA1 Message Date
Werner Koch
c8c86f25fd
gpg: Add the AEAD algo number to the DECRYPTION_INFO status line.
* g10/decrypt-data.c (decrypt_data): Print the aead_algo
--

GnuPG-bug-id: 7398
2024-11-21 09:52:46 +01:00
Werner Koch
5b3fc8abaa
gpgconf: Show also the used nPth version with -V
* dirmngr/dirmngr.c (gpgconf_versions): Get and show nPth version.
--

Note that this requires nPth 1.8
2024-11-12 14:19:57 +01:00
Werner Koch
fc47bdad59
gpgtar: Make sure to create upper directories for regular files.
* tools/gpgtar-extract.c (extract_directory): Factor parent directory
creation out to ..
(try_mkdir_p): new.
(extract_regular): Create directory on ENOENT.

* g10/pubkey-enc.c (get_it): Use log_info instead of log_error if the
public key was not found for preference checking.
--

If tarball was created with
    tar cf tarball file1.txt foo/file2.txt
the tarball has no entry for foo/ and thus the extraction fails. This
patch fixes this.

GnuPG-bug-id: 7380

The second patch avoid a wrong exit status status line due to the use
of log_error.  But the actual cause needs stuill needs tobe
investigated.
2024-11-07 15:39:42 +01:00
Werner Koch
6c58694a88
gpg: Allow the use of an ADSK subkey as ADSK subkey.
* g10/packet.h (PKT_public_key): Increased size of req_usage to 16.
* g10/getkey.c (key_byname): Set allow_adsk in the context if ir was
requested via req_usage.
(finish_lookup): Allow RENC usage matching.
* g10/keyedit.c (append_adsk_to_key): Adjust the assert.
* g10/keygen.c (prepare_adsk): Also allow to find an RENC subkey.
--

If an ADSK is to be added it may happen that an ADSK subkey is found
first and this should then be used even that it does not have the E
usage.  However, it used to have that E usage when it was added.

While testing this I found another pecularity: If you do
  gpg -k ADSK_SUBKEY_FPR
without the '!' suffix and no corresponding encryption subkey is dound,
you will get an unusabe key error.  I hesitate to fix that due to
possible side-effects.

GnuPG-bug-id: 6882
Backported-from-master: d30e345692440b9c6677118c1d20b9d17d80f873

Note that we still use the NO_AKL and not the newer TRY_LDAP in 2.2.
We may want to backport that change as well.
2024-10-31 15:20:16 +01:00
NIIBE Yutaka
2ca38bee7a
agent: Fix status output for LISTTRUSTED.
* agent/trustlist.c (istrusted_internal): When LISTMODE is enabled,
TRUSTLISTFPR status output should be done.

--

GnuPG-bug-id: 7363
Fixes-commit: 4fa82eec43e8d205fa336113f6ea554923fd6986
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-10-31 11:47:55 +09:00
Werner Koch
5c0383d558
Post release updates
--
2024-10-22 18:24:59 +02:00
Werner Koch
8e3fc26d4a
Release 2.2.45 gnupg-2.2.45 2024-10-22 15:50:33 +02:00
Werner Koch
8838e795e9
po: msgmerge
--
2024-10-22 15:50:23 +02:00
Werner Koch
ae383e0e73
po: Update German translation
--
2024-10-22 15:49:50 +02:00
Werner Koch
cb5f4aba57
dirmngr: Print a brief list of URLs with LISTCRLS.
* dirmngr/crlcache.c (crl_cache_list): Print a summary of URLs.

* sm/call-dirmngr.c (gpgsm_dirmngr_run_command): Print a notice to
stdout if the dirmngr has been disabled.
--

GnuPG-bug-id: 7337
2024-10-14 16:46:27 +02:00
Werner Koch
69a8aefa5b
gpgsm: Fix cached istrusted lookup.
* sm/call-agent.c (gpgsm_agent_istrusted): Actually set istrusted
list.
--

Fixes-commit: 9087c1d3637cf1c61744ece0002dc0dc5675d7c9
2024-10-10 18:05:57 +02:00
Werner Koch
85d8fa57db
gpg: Emit status error for an invalid ADSK.
* g10/keygen.c (prepare_adsk): Emit status error.
--

This is useful for GPGME.

GnuPG-bug-id: 7322
2024-10-07 08:26:49 +02:00
Werner Koch
a5527edebb
gpgsm: Add compatibility flag no-keyinfo-cache
* sm/gpgsm.c (compatibility_flags): Add flag.
* sm/gpgsm.h (COMPAT_NO_KEYINFO_CACHE): New.
* sm/call-agent.c (gpgsm_agent_istrusted): Act upon it.
(gpgsm_agent_keyinfo): Ditto.
2024-10-04 12:03:11 +02:00
Werner Koch
9087c1d363
gpgsm: Implement a cache for the KEYINFO queries.
* sm/gpgsm.h (struct keyinfo_cache_item_s): New.
(struct server_control_s): Add keyinfo_cache and keyinfo_cache_valid.
* sm/call-agent.c (keyinfo_cache_disabled): New flag.
(release_a_keyinfo_cache): New.
(gpgsm_flush_keyinfo_cache): New.
(struct keyinfo_status_parm_s): New.
(keyinfo_status_cb): Implement a fill mode.
(gpgsm_agent_keyinfo): Implement a cache.
* sm/server.c (reset_notify): Flush the cache.
* sm/gpgsm.c (gpgsm_deinit_default_ctrl): Ditto.
--

In almost all cases we have just a few private keys in the agent and
thus it is better to fetch them early.  This does not work in a
restricted connection but we take care and disable the cache in this
case.

This cache gives a a minor speed up.

GnuPG-bug-id: 7308
(cherry picked from commit 241971fac0fc52efc87ed5753a01d18b0672d900)
2024-10-04 09:40:04 +02:00
Werner Koch
09d4b8f496
gpgsm: Use a cache for ISTRUSTED queries.
* sm/call-agent.c (struct istrusted_cache_s): New.
(istrusted_cache, istrusted_cache_valid): New.
(istrusted_cache_disabled): New.
(flush_istrusted_cache): New.
(struct istrusted_status_parm_s): New.
(istrusted_status_cb): Fill the cache.
(gpgsm_agent_istrusted): Implement a cache.
--

Not a really measurable performance improvements on Linux but maybe
somewhat on Windows (not yet tested).  However, it does not clutter
the log files with IPC calls returning NOT_TRUSTED.

GnuPG-bug-id: 7308
(cherry picked from commit ef2be95258d2e02659e96f6c4df5a9a1a233c8fd)
2024-10-04 09:36:32 +02:00
Werner Koch
4fa82eec43
agent: Add option --status to the LISTRUSTED command.
* agent/trustlist.c (istrusted_internal): Add arg listmode and print
new status line in this mode.  Adjust callers.
(agent_listtrusted): Add new args ctrl and status_mode.  Get all
trusted keys and then call is_trusted_internal for all of them.

* agent/command.c (cmd_listtrusted): Add new option --status.
--

This allows in a non-restricted connection to list all trusted keys in
one go.

(cherry picked from commit 4275d5fa7a51731544d243ba16628a9958ffe3ce)
2024-10-04 09:35:30 +02:00
Werner Koch
269efd89a3
Update NEWS
--
2024-10-01 12:52:46 +02:00
Werner Koch
41626a1661
gpgsm: Possible improvement for some rare P12 files.
* sm/minip12.c (parse_shrouded_key_bag): Increase size of salt buffer.
--

Reported on the mailing list.  The change does not seem to have a big
regression risk, thus applied.  See below for the mail

# ------------------------ >8 ------------------------
https://lists.gnupg.org/pipermail/gnupg-users/2024-September/067312.html
2024-10-01 12:41:03 +02:00
Werner Koch
f1e1cb0767
gpgconf: Allow listing of some new options
--

Also one old option.

GnuPG-bug-id: 6882
(cherry picked from commit df977729ff3879fdeab7bce339b95ee3fd8ecc42)
2024-10-01 09:55:30 +02:00
Werner Koch
dcee2db36b
gpgsm: Use a cache to speed up parent certificate lookup.
* sm/gpgsm.h (COMPAT_NO_CHAIN_CACHE): New.
(struct cert_cache_item_s, cert_cache_item_t): New.
(struct server_control_s): Add parent_cert_cache.
* sm/gpgsm.c (compatibility_flags): Add "no-chain-cache".
(parent_cache_stats): New.
(gpgsm_exit): Print the stats with --debug=memstat.
(gpgsm_deinit_default_ctrl): Release the cache.
* sm/certchain.c (gpgsm_walk_cert_chain): Cache the certificates.
(do_validate_chain): Ditto.
--

This gives another boost of 30% (from 6.5 to 4.0 seconds in the test
environment with ~1000 certs).  do_validate_chain actually brings us
the speedup becuase the gpgsm_walk_cert_chain is not used during a key
listing.  For the latter we actually cache all certificates because
that was easier.

GnuPG-bug-id: 7308

Adjusted for 2.2:
- Add gpgsm_deinit_default_ctrl
- Remove ctrl arg from keydb_new
2024-09-30 19:05:41 +02:00
Werner Koch
9543b3567b
sm: Optmize clearing of the ephemeral flag.
* kbx/keybox-search.c (keybox_get_cert): Store the blob clags in the
cert object.
* sm/certchain.c (do_validate_chain): Skip clearing of the ephemeral
flag if we know that it is not set.
--

GnuPG-bug-id: 7308
2024-09-27 16:06:27 +02:00
Werner Koch
ecda4b1e16
gpg: Add magic parameter "default" to --quick-add-adsk.
* g10/getkey.c (has_key_with_fingerprint): New.
* g10/keyedit.c (menu_addadsk): Replace code by new function.
(keyedit_quick_addadsk): Handle magic arg "default".
* g10/keygen.c (append_all_default_adsks): New.
--

GnuPG-bug-id: 6882
(cherry picked from commit 77afc9ee1c75a28083edf6d98888f9b472c3e39d)
2024-09-26 10:38:27 +02:00
Werner Koch
45ae027ce4
gpg: New command --quick-add-adsk
* g10/gpg.c (enum cmd_and_opt_values): Add aQuickAddADSK.
(opts): Add --quick-add-adsk.
(main): Call the actual function.
* g10/keyedit.c (keyedit_quick_addadsk): New.
(menu_addadsk): Add arg adskfpr and change caller.
--

GnuPG-bug-id: 6395
(cherry picked from commit 9f27e448bf1f825906f3c53e3428087d34bbd8fc)
2024-09-26 10:38:25 +02:00
Werner Koch
eafe175320
gpg: New option --default-new-key-adsk and "addadsk" for edit-key.
* g10/free-packet.c (copy_public_key): Factor some code out to ...
(copy_public_key_basics): new.
* keygen.c (keygen_add_key_flags_and_expire): Rewrite and make public.
* g10/keyedit.c (enum cmdids): Add cmdADDADSK.
(keyedit_menu): Add command "addadsk".
(menu_addadsk): New.

* g10/options.h (opt): Add field def_new_key_adsks.
* g10/gpg.c (oDefaultNewKeyADSK): New.
(opts): Add --default-new-key-adsk.
(main): Parse option.
* g10/keyedit.c (menu_addadsk): Factor some code out to ...
(append_adsk_to_key): new.  Add compliance check.
* g10/keygen.c (pADSK): New.
(para_data_s): Add adsk to the union.
(release_parameter_list): Free the adsk.
(prepare_adsk): New.
(get_parameter_adsk): New.
(get_parameter_revkey): Remove unneeded arg key and change callers.
(proc_parameter_file): Prepare adsk parameter from the configured
fingerprints.
(do_generate_keypair): Create adsk.
--

GnuPG-bug-id: 6882
(cherry picked from commit ed118e2ed521d82c1be7765a0a19d5b4f19afe10)
and modified to adjust to other code changes
2024-09-26 10:38:21 +02:00
Werner Koch
7eb39815bd
common: New function tokenize_to_strlist.
* common/strlist.c (append_to_strlist_try): Factor code out to ...
(do_append_to_strlist): new.
(tokenize_to_strlist): New.

* common/t-strlist.c (test_tokenize_to_strlist): New.

(cherry picked from commit d2dca58338a4936b293c3ec6be4572d0e74b6a0d)
2024-09-25 17:28:23 +02:00
NIIBE Yutaka
c33523a013
common:w32: Don't expose unused functions.
* common/exechelp.h [HAVE_W32_SYSTEM] (get_max_fds): Don't expose.
(close_all_fds, get_all_open_fds): Likewise.
* common/exechelp-w32.c: Don't expose unused functions.

--

GnuPG-bug-id: 7293
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-09-25 16:13:00 +02:00
Werner Koch
79ab52ff42
gpg: Exclude expired trusted keys from the key validation process.
* g10/trustdb.c (copy_key_item): New.
(validate_keys): Use a stripped down UTK list w/o expired keys.
--

This patch makes sure that an expired trusted key is not used for
trust computation.  The test case is to delete a trusted key from the
keyring, import a copy of that key which has already expired, check
that a signed key is not anymore fully trusted and finally import a
prolonged version of the trusted key and check that the signed key is
now again fully trusted.

GnuPG-bug-id: 7200
2024-09-25 15:15:51 +02:00
Werner Koch
23d4e7f0a7
gpg: Validate the trustdb after the import of a trusted key.
* g10/import.c (import_one_real): Rename non_self to non_self_or_utk.
If not set after chk_self_sigs check whether the imported key is an
ultimately trusted key.
--

The revalidation mark was only set if the imported key had a new key
signature.  This is in general correct but not if the imported key is
a trusted key.

GnuPG-bug-id: 7200
2024-09-25 14:31:46 +02:00
Werner Koch
3dd6887f13
gpg: Remove useless variable in validate_keys.
* g10/trustdb.c (store_validation_status): Remove arg  'stored'.
(validate_keys): Remove keyhashtable 'stored' which was never used.
--

This has been here since 2003.  The variable was never evaluated -
only stored.

Also added some comments.
2024-09-25 14:25:03 +02:00
Werner Koch
9e8e48e00b
gpg: Avoid wrong decryption_failed for signed+OCB msg w/o pubkey.
* g10/decrypt-data.c (struct decode_filter_context_s): Add flag
checktag_failed.
(aead_checktag): Set flag.
(decrypt_data): Initially clear that flag and check the flag after the
decryption.
* g10/mainproc.c (proc_encrypted): Revert the log_get_errorcount based
check.
--

This fixes a bug where for an OCB encrypted and signed message with
the signing key missing during decryption the DECRYPTION_FAILED status
line was printed along with "WARNING: encrypted message has been
manipulated". This was because we use log_error to show that the
signature could not be verified due to the missing pubkey; the
original fix looked at the error counter and thus triggered the
decryption failed status.

Fixes-commit: 82b39fe254703776209cebb88f428bf2d1eb596b
GnuPG-bug-id: 7042
2024-09-19 10:00:24 +02:00
Werner Koch
d9fdc165e6
agent: Fix detection of the trustflag de-vs.
* agent/trustlist.c (read_one_trustfile): Fix comparison.
--

Fixes-commit: 6d45fcdd3c3e8d039b05f7276e7619c19fc957d1
GnuPG-bug-Id: 5079
2024-09-17 13:41:02 +02:00
Werner Koch
b357ff2aa6
gpg: Don't bail out for unknown subkey packet versions.
* g10/import.c (read_block): Don't show a warning for unbnown version
also for non-primary-key packets.

* g10/parse-packet.c (parse_key): Use log_info for unsupported v5
packets.
--

This fixes the problem that 2.2 can't import keys with a v5 subkey.
This fix allows a gnupg 2.6. version to export a key with an
additional PQC subkey and 2.2 can still import the other subkeys.

The second patch avoids that gpg returns with an error code.

Updates-commit: de70a2f377c1647417fb8a2b6476c3744a901296
2024-09-12 11:06:09 +02:00
NIIBE Yutaka
95468f531c
agent: Fix KEYTOCARD for the use case with loopback pinentry.
* agent/command.c (cmd_keytocard): Copy LINE.

--

GnuPG-bug-id: 7283
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-09-03 11:15:57 +02:00
Werner Koch
67088b1ce2
gpgconf: Add missing linefeed to the -X output.
* tools/gpgconf.c (show_registry_entries_from_file): Add missing LF.
2024-09-03 11:15:47 +02:00
Werner Koch
5276a1373c
gpg: New option --proc-all-sigs
* g10/options.h (flags): Add proc_all_sigs.
* g10/mainproc.c (check_sig_and_print): Do not stop signature checking
if this new option is used.
* g10/gpg.c (oProcAllSigs): New.
(opts): Add "proc-all-sigs".
(main): Set it.
--

GnuPG-bug-id: 7261
Backported-from-master: 1eb382fb1f431575872b47dc160807858b7df3e5
(cherry picked from commit cb739bb2a5796b8d48cbb92c615538bf53bcd482)
2024-08-23 11:50:58 +02:00
Werner Koch
a891e55f15
w32: Add two more registry entries for use with -X
* tools/gpgconf.c (show_other_registry_entries): Add entries.
2024-08-21 11:26:34 +02:00
Werner Koch
080fca9f94
Post release updates
--
2024-08-16 13:45:28 +02:00
Werner Koch
148a25f3de
Release 2.2.44 gnupg-2.2.44 2024-08-12 17:12:01 +02:00
Werner Koch
377d28e1db
speedo,w32: Add extra flags for gpgrt and fix SO name of libassuan.
--

Due to the recently introduced use of STARTUPINFOEXW in gpgrt we now
need at least Windows Vista.  Version 8 of Mingw defaults to XP SP2
which requires us to explicit override that default.

The SO number of libassuan needs an update too.

(cherry picked from commit d56b63a66181b4f029e91dcea095e9eb149895b7)
2024-08-12 17:11:58 +02:00
Werner Koch
cf21e473a5
gpgconf: Print the full commit id.
* autogen.sh: Update to version 2024-07-04 from libgpg-error.
* configure.ac (BUILD_REVISION): Rename the ac_define by
BUILD_COMMITID.
* tools/gpgconf.c (show_version_gnupg): Use it here.
--

(cherry picked from commit 736579331b14035db5b857812d18b493678f7769)
2024-08-12 16:46:16 +02:00
Werner Koch
ce73691bd3
po: msgmerge
--
2024-08-12 16:46:15 +02:00
Werner Koch
99e1eae051
po: Add German translation for a new string.
--
2024-08-12 16:46:12 +02:00
Werner Koch
861dc01994
gpg: Improve decryption diagnostic for an ADSK key.
* g10/keydb.h (GET_PUBKEYBLOCK_FLAG_ADSK): New constant.
* g10/packet.h (PUBKEY_USAGE_XENC_MASK): New constant.
* g10/pubkey-enc.c (get_it): Print a note if an ADSK key was used.
Use the new get_pubkeyblock flag.
* g10/getkey.c (struct getkey_ctx_s): Add field allow_adsk.
(get_pubkeyblock): Factor all code out to ...
(get_pubkeyblock_ext): new.
(finish_lookup): Add new arg allow_adsk and make use of it.
--

This patch solves two purposes:
- We write a note that the ADSK key was used for decryption
- We avoid running into a
  "oops: public key not found for preference check\n"
  due to ADSK keys.  The error is mostly harmless but lets gpg return
  with an exit code of 2.

Backported-from-master: 882ab7fef9bf4440900c32d7463469307224f11a
2024-08-12 15:31:25 +02:00
Andre Heinecke
6f78219d0f
speedo,w32: Update libassuan dll name in wxs
* build-aux/speedo/w32/wixlib.wxs: Update name and UID for
libassuan
2024-08-12 15:07:04 +02:00
Werner Koch
80f25fab90
agent: Fix an unitialized variable in an error path.
* agent/findkey.c (agent_write_private_key): Init FP.
--

With
Fixes-commit: 3b69d8bf7146b8d10737d0cfea9c97affc60ad73
we took a shortcut but forgot to init FP which is usually set after
the new check.  At least in the AppImage this always triggered a segv
and gpg or Kleopatra had to restart the agent.  Not a problem in 2.4
becuase this code is a hack we don't need in 2.4 due to that new
ephemeral key storing feature.

GnuPG-bug-id: 6944
2024-08-08 17:13:47 +02:00
Werner Koch
62bd291dcc
common: Allow building with libgpg-error < 1.47
* common/util.h (GPG_ERR_BAD_RESET_CODE): New replacement.
(GPG_ERR_NO_RESET_CODE): New.
(GPG_ERR_BAD_PUK): New.
--

But as least 1.38 is required.  Tested with 1.42
2024-08-08 15:57:23 +02:00
Werner Koch
bc150995e4
common: Add missing file to repo
--
Fixes-commit: 0dcd1504babb4b98898f7bd738d7aaa1e4a73a05
2024-08-08 14:20:44 +02:00
Werner Koch
0dcd1504ba
sm: More improvements for PKCS#12 parsing for latest IVBB changes.
* common/tlv.h (TLV_PARSER_FLAG_T5793): New.
(tlv_parser_new): New macro.  Rename function with an underscore.
(tlv_next_with_flag): New.
* common/tlv-parser.c (struct tlv_parser_s): Remove const from buffer.
Add fields crammed, lasttlv, and origoff.  Remove bufferlist ands ist
definition.
(dump_to_file): New but disabled debug helper.
(parse_tag): Print more info on error.
(_tlv_parser_new): Add args lasttlv and LNO.  Take a copy of the data.
(_tlv_parser_release): Free the copy of the buffer and return the
recorded TLV object from tlv_parser_new.
(_tlv_peek, tlv_parser_peek, _tlv_parser_peek_null): Remove.
(_tlv_push): Record crammed length.
(_tlv_pop): Restore crammed length.
(_tlv_parser_next): Add arg flags.  More debug output.  Handle cramming
here.  Take care of cramming here.
(tlv_expect_object): Simplify to adjust for changes in _tlv_parser_next.
(tlv_expect_octet_string): Remove arg encapsulates.  Adjust for
changes in _tlv_parser_next.  Change all allers.
(tlv_expect_null): New.
(cram_octet_string): Rewrite.
(need_octet_string_cramming): Remove.

* sm/minip12.c (dump_to_file): New.  Enable in debug mode and if an
envvar ist set.  Replace all explict but disabled dumping to call this
function.
(parse_bag_encrypted_data): Replace tlv_peek_null and a peeking for an
optional SET by non-peeking code.
(parse_cert_bag): Ditto.
(parse_shrouded_key_bag): Replace tlv_peek_null by non-peeking code.
(parse_bag_encrypted_data): Use the new TLV_PARSER_FLAG_T5793 to
enable the Mozilla workaround.
(parse_bag_encrypted_data): Replace the 'renewed_tlv' code by the new
tlv_parser_release semantics.
(parse_shrouded_key_bag): Ditto.
(parse_shrouded_key_bag): Create a new context instead of using the
former encapsulated mechanism for tlv_expect_octet_string.
(parse_bag_data): Ditto.
(p12_parse): Ditto.

* common/tlv-parser.c: New
* common/Makefile.am: Add new file.
--

GnuPG-bug-id: 7213
Backported-from-master: 690fd61a0cf2b4b51ee64811656692eb644d2918

This backport required to introduce the new tlv-parser.c file and
remove most source copied stuff from minip12.c.  Thus the above
ChangeList is not fully correct.
2024-08-07 11:21:35 +02:00
Werner Koch
1d0874c3d2
scd: New getinfo subcommand "manufacturer"
* scd/command.c (cmd_getinfo): Add subcommand "manufacturer".
* scd/app-openpgp.c (get_manufacturer): Rename to ...
(app_openpgp_manufacturer): this and make global.
--

Example:

  $ gpg-connect-agent 'scd getinfo manufacturer 42' /bye
  D Magrathea
  OK

Backported-from-master: a8cef7ebc2b8c3aa1477b61fecfaa8e5d63446d7
2024-08-07 11:21:31 +02:00
Werner Koch
dfc400a2d9
doc: Fix URL to the OpenPGP card specs
--
2024-08-07 10:34:10 +02:00