aboutsummaryrefslogtreecommitdiffstats
path: root/g10 (unfollow)
Commit message (Collapse)AuthorFilesLines
2025-05-13gpg: Make combination of show-only-fpr-mbox and show-unusable-uid work.Werner Koch1-1/+2
* g10/keylist.c (list_keyblock_simple): Take care of show-unusable-uids. -- This allows to upload revoked keys to a WKD. Suggested-by: Uwe Kleine-König
2025-05-12gpg: Fully implement the group key flag.Werner Koch2-4/+7
* g10/getkey.c (merge_selfsigs_main): Do not mask out the group bit. (merge_selfsigs_subkey): Ditto/ * g10/keygen.c (ask_key_flags_with_mask): Ditto. (proc_parameter_file): Ditto. -- Updates-commit: 0988e49c45d0fb73d0b536aa027bd114f9dc65a7
2025-05-09Update distsigkeyWerner Koch1-0/+0
-- Added Alexander. Removed Andre.
2025-05-02gpg: Fix another regression due to the T7547 fix.Werner Koch1-3/+5
* g10/getkey.c (get_pubkey_for_sig): Keep a requested PUBKEY_USAGE_CERT. (finish_lookup): For correctness in future use cases allow PUBKEY_USAGE_CERT to also trigger verify mode. -- The case here was that a cert-only primary key was removed with export-clean. GnuPG-bug-id: 7583
2025-03-14gpg: Fix key generation with existing key from card.NIIBE Yutaka1-1/+1
* g10/keygen.c (ask_algo): Fix condition. Continue the loop when failure. -- Fixes-commit: 6022f10da39e512b5b3fed3869fd6579d954090c GnuPG-bug-id: 7309, 7457 Signed-off-by: NIIBE Yutaka <[email protected]>
2025-03-13gpg: Fix double free of internal data.Werner Koch1-1/+2
* g10/sig-check.c (check_signature_over_key_or_uid): Do not free in no-sig-cache mode if allocated by caller. -- GnuPG-bug-id: 7547 Fixes-commit: 44cdb9d73f1a0b7d2c8483a119b9c4d6caabc1ec
2025-03-06gpg: Fix regression for the recent malicious subkey DoS fix.Werner Koch2-16/+29
* g10/packet.h (PUBKEY_USAGE_VERIFY): New. * g10/getkey.c (get_pubkey_for_sig): Pass new flag also to requested usage. (finish_lookup): Introduce a verify_mode. -- Fixes-commit: da0164efc7f32013bc24d97b9afa9f8d67c318bb GnuPG-bug-id: 7547
2025-02-21gpg: Fix a verification DoS due to a malicious subkey in the keyring.Werner Koch6-86/+152
* g10/getkey.c (get_pubkey): Factor code out to ... (get_pubkey_bykid): new. Add feature to return the keyblock. (get_pubkey_for_sig): Add arg r_keyblock to return the used keyblock. Request a signing usage. (get_pubkeyblock_for_sig): Remove. (finish_lookup): Improve debug output. * g10/sig-check.c (check_signature): Add arg r_keyblock and pass it down. * g10/mainproc.c (do_check_sig): Ditto. (check_sig_and_print): Use the keyblock returned by do_check_sig to show further information instead of looking it up again with get_pubkeyblock_for_sig. Also re-check the signature after the import of an included keyblock. -- The problem here is that it is possible to import a key from someone who added a signature subkey from another public key and thus inhibits that a good signature good be verified. Such a malicious key signature subkey must have been created w/o the mandatory backsig which bind a signature subkey to its primary key. For encryption subkeys this is not an issue because the existence of a decryption private key is all you need to decrypt something and then it does not matter if the public subkey or its binding signature has been put below another primary key; in fact we do the latter for ADSKs. GnuPG-bug-id: 7527 Backported-from-master: 48978ccb4e20866472ef18436a32744350a65158
2025-02-21gpg: Remove a signature check function wrapper.Werner Koch3-31/+14
* g10/sig-check.c (check_signature2): Rename to (check_signature): this and remove the old wrapper. Adjust all callers.
2025-02-11gpg: Lookup key for merging/inserting only by primary key.Werner Koch3-13/+31
* g10/getkey.c (get_keyblock_byfpr_fast): Add arg primary_only and implement. * g10/import.c (import_one_real): Simplify filling the fpr buffer with zeroes. (import_one_real): Find key only by primary fingerprint. -- This should have been done early: When looking up the original keyblock we want to update, we need to lookup it up only using the primary key. This avoids to find a key which has the primary key also has a subkey. GnuPG-bug-id: 7527
2025-02-05gpg: Fix --quick-add-key for Weierstrass ECC with usage given.Werner Koch1-0/+37
* g10/keygen.c (adjust_algo_for_ecdh_ecdsa): New. (parse_algo_usage_expire): Adjust key algo. -- GnuPG-bug-id: 7506
2025-01-08gpg: Print a warning if the card backup key could not be written.Werner Koch1-4/+14
* g10/keygen.c (card_write_key_to_backup_file): Fix error handing by removing the RC variable. Add warning note. -- GnuPG-bug-id: 2169
2024-11-25gpg: Fix modifying signature data by pk_verify for Ed25519.NIIBE Yutaka1-6/+21
* g10/pkglue.c (pk_verify): When fixing R and S, make sure those are copies. -- GnuPG-bug-id: 7426 Fixing-commit: 0a5a854510fda6e6990938a3fca424df868fe676 Signed-off-by: NIIBE Yutaka <[email protected]> Also avoid clearing the error by the S code of a failed mpi_print of R. Signed-off-by: Werner Koch <[email protected]>
2024-11-22gpg: Fix comparing ed448 vs ed25519 with --assert-pubkey-algo.Werner Koch2-0/+24
* g10/keyid.c (extra_algo_strength_offset): New. (compare_pubkey_string_part): Use the mapping. -- GnuPG-bug-id: 7425
2024-11-08gpg: Do not fail with an error for a "Note:" diagnosticWerner Koch1-2/+2
* g10/trustdb.c (validate_keys): Use log_info instead of log_error for not found or expired UTKs. -- Actually the not-found case used log_error for decades. The semantically simialr expired case did thus the same. The actual problem is for example in the import case where gpg exits with a failure despite that a key validation was requested. GnuPG-bug-id: 7351
2024-11-08gpg: Robust error handling for SCD READKEY.NIIBE Yutaka1-8/+10
* g10/keygen.c (ask_algo): List the card key only when it's valid. -- GnuPG-bug-id: 7309 Signed-off-by: NIIBE Yutaka <[email protected]>
2024-11-07gpgtar: Make sure to create upper directories for regular files.Werner Koch1-2/+2
* 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 exist status status line due to the use of log_error. But the actual cause needs stuill needs tobe investigated.
2024-10-31gpg: Allow the use of an ADSK subkey as ADSK subkey.Werner Koch4-10/+16
* 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
2024-10-29gpg: Fix --quick-set-expire for V5 subkey fingerprintsIngo Klöcker1-1/+1
* g10/keyedit.c (keyedit_quick_set_expire): Use actual size of fingerprint. -- The size of the fingerprints is either 20 (V4) or 32 (V5). Using the actual size of the fingerprints fixes the lookup of subkeys with V5 fingerprint. GnuPG-bug-id: 7298 (cherry picked from commit 79298e87d8436bf0b0bd07c2c1513d10a7eb5823)
2024-10-07gpg: Emit status error for an invalid ADSK.Werner Koch2-0/+3
* g10/keygen.c (prepare_adsk): Emit status error. -- This is useful for GPGME. GnuPG-bug-id: 7322
2024-09-25gpg: Exclude expired trusted keys from the key validation process.Werner Koch1-14/+47
* 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-25gpg: Validate the trustdb after the import of a trusted key.Werner Koch1-4/+16
* 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-25gpg: Remove useless variable in validate_keys.Werner Koch1-30/+34
* 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-19gpg: Fix getting key by IPGP.NIIBE Yutaka1-1/+2
* g10/call-dirmngr.c (gpg_dirmngr_dns_cert): Check if DATA for key. -- GnuPG-bug-id: 7288 Reported-by: Wilfried Teiken Signed-off-by: NIIBE Yutaka <[email protected]>
2024-09-19gpg: Improve detection of input data read errors.Werner Koch1-3/+10
* g10/build-packet.c (do_plaintext): Better error checking for iobuf_copy. -- Fixes-commit: 2fdb950471bd36f046672254ff26ca94797cc9f1 GnuPG-bug-id: 6528 The original fix handles only the disk full case but didn't bother about read errors (i.e. I/O problems on an external drive).
2024-09-19gpg: Make --no-literal work again for -c and --store.Werner Koch2-18/+29
* g10/dearmor.c (dearmor_file): Check for errors of iobuf_copy. (enarmor_file): Ditto. * g10/encrypt.c (encrypt_simple): Fix error check of iobuf_copy (encrypt_crypt): Use iobuf_copy. -- Fixes-commit: 756c0bd5d89bd0a773f844fbc2ec508c1a36c63d GnuPG-bug-id: 5852
2024-09-19gpg: remove workaround for Libgcrypt < 1.8.6Werner Koch1-29/+4
* g10/free-packet.c (is_mpi_copy_broken): Remove.
2024-09-19gpg: Avoid wrong decryption_failed for signed+OCB msg w/o pubkey.Werner Koch2-5/+10
* 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: 122803bf1ac9ee720d9fc214f5ae5c2a0ec22bf5 GnuPG-bug-id: 7042
2024-08-28doc: Explain why we use D-Lines for keyboxd communication.Werner Koch1-1/+3
--
2024-08-23gpg: New option --proc-all-sigsWerner Koch3-1/+9
* 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
2024-08-23gpg: Warn if a keyring is specified along with --use-keyboxd.Werner Koch1-0/+3
* g10/gpg.c (main): Print the warning. -- GnuPG-bug-id: 7265
2024-08-19gpg: Minor fix when building with --disable-execWerner Koch1-1/+0
* g10/photoid.c (show_photo): No return for a void function. -- GnuPG-bug-id: 7256
2024-08-12gpg: Improve decryption diagnostic for an ADSK key.Werner Koch4-10/+39
* g10/keydb.h (GET_PUBKEYBLOCK_FLAG_ADSK): New constant. * g10/packet.h (PUBKEY_USAGE_XENC_MASK): New constant. * g10/pubkey-enc.c (get_session_key): Consider an ADSK also as "marked for encryption use". (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: 6fa4d7973db34d118b7735d5a3d1aa8cc4412f46
2024-07-01gpg: Add magic parameter "default" to --quick-add-adsk.Werner Koch5-17/+85
* 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-07-01gpg: Print designated revokers also in a standard listing.Werner Koch4-31/+67
* g10/keylist.c (print_revokers): Add arg with_colon, adjust callers, add human printable format. (list_keyblock_print): Call print_revokers. -- Designated revokers were only printed in --with-colons mode. For quick inspection of a key it is useful to see them right away. (cherry picked from commit 9d618d1273120ca2cca97028730352768b0c1897)
2024-07-01gpg: Autoload designated revoker key and ADSK when needed.Werner Koch4-27/+42
* g10/options.h (opt): Move the definition of struct akl to global scope. * g10/keydb.h (enum get_pubkey_modes): Add GET_PUBKEY_TRY_LDAP. * g10/getkey.c (get_pubkey_byname): Implement GET_PUBKEY_BYNAME. * g10/keygen.c (prepare_desig_revoker): Use it here. (prepare_adsk): and here. -- The revoker key is required before we create it along with a new key. This is because the we need to know the algo and also to make sure that the key really exists. GnuPG-bug-id: 7133 (cherry picked from commit 465ea9116d1f9467814143ed35b515034a849e86)
2024-07-01gpg: New option --default-new-key-adsk.Werner Koch5-52/+222
* 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)
2024-07-01gpg: Implement the LDAP AKL method.Werner Koch5-98/+30
* g10/keyserver.c (keyserver_import_mbox): Add arg flags and change callers. (keyserver_import_ldap): Remove. It has always returned a not implemented error since 2.1. * g10/getkey.c (get_pubkey_byname): Repurpose LDAP to do basically the same as KEYSERVER. -- The old LDAP mechanism to locate a server via SRV records has long been gone (since 2014) due to the dropping of the keyserver helpers. The new purpose better reflects reality and can be used in environments where keys are provided by an in-house LDAP server. (cherry picked from commit 068ebb6f1eee37d31f5ffb44b7f8069d9ca3f7b8)
2024-06-24gpg: Rename recently added import option no-seckeys to only-pubkeys.Werner Koch3-7/+7
* g10/import.c (parse_import_options): Rename option. * g10/options.h (IMPORT_NO_SECKEY): Rename to IMPORT_ONLY_PUBKEYS. Change all users. -- GnuPG-bug-id: 7146
2024-06-11gpg: Add --import-option "no-seckeys".Werner Koch1-0/+2
* g10/import.c (parse_import_options): Add "no-seckeys". -- GnuPG-bug-id: 7146
2024-06-11gpg: Do not bail out on secret keys with an unknown algoWerner Koch1-0/+2
* g10/getkey.c (lookup): Skip keys with unknown algos. -- If the local store has private keys with an algorithm not supported by thi version of gpg, gpg used to bail out. Thus decryption of proper messages was not possible. This fix skips such secret keys.
2024-06-05gpg: Do not show RENC if no key capabilities are found for a key.Werner Koch2-2/+8
* g10/packet.h (PUBKEY_USAGE_BASIC_MASK): New. * g10/getkey.c (merge_selfsigs_subkey): Mask the default. (merge_selfsigs_main): Ditto.
2024-05-29gpg: Avoid a double free on error in the key generation.Werner Koch1-30/+23
* g10/keygen.c (card_store_key_with_backup): Avoid double free and simplify error handling. -- This is part of GnuPG-bug-id: 7129 Co-authored-by: Jakub Jelen <[email protected]> (cherry picked from commit bcc002cd45d1c6bd51c2b2093f92d396970c082e)
2024-05-16gpg: Allow no CRC24 checksum in armor.NIIBE Yutaka1-2/+2
* g10/armor.c (radix64_read): Detect the end of armor when there is no CRC24 checksum. -- Cherry-pick master commit of: 3a344d6236521d768793e8b34a96a18ce13bab0e GnuPG-bug-id: 7071 Signed-off-by: NIIBE Yutaka <[email protected]>
2024-04-17gpg: Mark disabled keys and add show-ownertrust list option.Werner Koch5-10/+28
* g10/options.h (LIST_SHOW_OWNERTRUST): New. * g10/keylist.c (print_key_line): Show wonertrust and always show whether a key is disabled. * g10/gpg.c (parse_list_options): Add "show-ownertrust". * g10/gpgv.c (get_ownertrust_string): Add stub. * g10/test-stubs.c (get_ownertrust_string): Add stub. -- Note that in a --with-colons listing the ownertrust has always been emitted and the disabled state is marked in that listing with a special 'D' usage.
2024-04-17gpg: New command --quick-set-ownertrust.Werner Koch3-1/+97
* g10/gpg.c (aQuickSetOwnertrust): New. (opts): Add new command. (main): Implement it. * g10/keyedit.c (keyedit_quick_set_ownertrust): New.
2024-04-05gpg: Don't show the "fast path listing" diagnostic with --quiet.Werner Koch1-2/+3
* g10/call-agent.c (agent_probe_any_secret_key): Act on --quiet. -- When using the extra-socket this disagnostic will be printed because a listing of all secret keys is not allowed by a remote gpg.
2024-04-04gpg: Do not allow to accidently set the RENC usage.Werner Koch1-1/+14
* g10/keygen.c (print_key_flags): Print "RENC" if set. (ask_key_flags_with_mask): Remove RENC from the possible set of usages. Add a direct way to set it iff the key is encryption capable. -- This could be done by using "set your own capabilities" for an RSA key. In fact it was always set in this case. GnuPG-bug-id: 7072
2024-03-14gpg: Make sure a DECRYPTION_OKAY is never issued for a bad OCB tag.Werner Koch2-1/+6
* g10/mainproc.c (proc_encrypted): Force a decryption failure if any error has been seen. * g10/decrypt-data.c (aead_checktag): Issue an ERROR line. -- GnuPG-bug-id: 7042 Note that gpg in any case returns a failure exit code but due to double forking GPGME would not see it.
2024-03-06wks: Make gpg-wks-client --mirror work w/o args.Werner Koch1-1/+1
* tools/gpg-wks-client.c (mirror_one_key): Test for no domain specified. -- The code did not really work if no domain was given. It worked but filtered out all keys so that no key was actually exported.