aboutsummaryrefslogtreecommitdiffstats
path: root/g10 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Fully implement the group key flag.Werner Koch2025-05-122-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: 202ed9e281d5fb95f166faeb6741c75872be464c
* Update distsigkeyWerner Koch2025-05-091-0/+0
| | | | | | -- Added Alexander. Removed Andre.
* gpg: Fix double free of internal data.Werner Koch2025-03-131-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
* gpg: Add the AEAD algo number to the DECRYPTION_INFO status line.Werner Koch2024-11-211-1/+1
| | | | | | | * g10/decrypt-data.c (decrypt_data): Print the aead_algo -- GnuPG-bug-id: 7398
* gpgtar: Make sure to create upper directories for regular files.Werner Koch2024-11-071-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 exit status status line due to the use of log_error. But the actual cause needs stuill needs tobe investigated.
* gpg: Allow the use of an ADSK subkey as ADSK subkey.Werner Koch2024-10-314-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* gpg: Emit status error for an invalid ADSK.Werner Koch2024-10-072-0/+3
| | | | | | | | | * g10/keygen.c (prepare_adsk): Emit status error. -- This is useful for GPGME. GnuPG-bug-id: 7322
* gpg: Add magic parameter "default" to --quick-add-adsk.Werner Koch2024-09-265-16/+114
| | | | | | | | | | | * 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)
* gpg: New command --quick-add-adskWerner Koch2024-09-263-1/+80
| | | | | | | | | | | | * 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)
* gpg: New option --default-new-key-adsk and "addadsk" for edit-key.Werner Koch2024-09-2611-50/+477
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* gpg: Exclude expired trusted keys from the key validation process.Werner Koch2024-09-251-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
* gpg: Validate the trustdb after the import of a trusted key.Werner Koch2024-09-251-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
* gpg: Remove useless variable in validate_keys.Werner Koch2024-09-251-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.
* gpg: Avoid wrong decryption_failed for signed+OCB msg w/o pubkey.Werner Koch2024-09-192-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: 82b39fe254703776209cebb88f428bf2d1eb596b GnuPG-bug-id: 7042
* gpg: Don't bail out for unknown subkey packet versions.Werner Koch2024-09-122-2/+6
| | | | | | | | | | | | | | | | | * 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
* gpg: New option --proc-all-sigsWerner Koch2024-08-233-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 (cherry picked from commit cb739bb2a5796b8d48cbb92c615538bf53bcd482)
* gpg: Improve decryption diagnostic for an ADSK key.Werner Koch2024-08-124-8/+37
| | | | | | | | | | | | | | | | | | | | | * 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
* gpg: Rename recently added import option no-seckeys to only-pubkeys.Werner Koch2024-06-243-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
* gpg: Add --import-option "no-seckeys".Werner Koch2024-06-111-0/+2
| | | | | | | * g10/import.c (parse_import_options): Add "no-seckeys". -- GnuPG-bug-id: 7146
* gpg: Do not bail out on secret keys with an unknown algoWerner Koch2024-06-111-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.
* gpg: Do not show RENC if no key capabilities are found for a key.Werner Koch2024-06-052-2/+9
| | | | | | | * g10/packet.h (PUBKEY_USAGE_BASIC_MASK): New. * g10/getkey.c (merge_selfsigs_subkey): Mask the default. (merge_selfsigs_main): Ditto. --
* gpg,gpgsm: Remove compatibility_flags allow-ecc-encr and vsd-allow-encr.Werner Koch2024-05-064-12/+1
| | | | | | | | | | | | | | | | * g10/options.h (COMPAT_VSD_ALLOW_OCB): Remove. * g10/gpg.c (compatibility_flags): Remove "vsd-allow_ocb". (main): Alwas set CO_EXTRA_INFO_VSD_ALLOW_OCB. * g10/keygen.c (keygen_set_std_prefs): Always set OCB feature flag. * g10/encrypt.c (use_aead): Always OCB also in de-vs mode. * sm/gpgsm.h (COMPAT_ALLOW_ECC_ENCR): Remove. * sm/gpgsm.c (compatibility_flags): Remove "allow-ecc-encr". * sm/encrypt.c (encrypt_dek): Always allow ecc encryption. * sm/certreqgen.c (proc_parameters): Likewise. -- Both feature are meanwhile approved in de-vs mode thus there is no more need for the flags.
* gpg: Do not allow to accidently set the RENC usage.Werner Koch2024-04-041-1/+13
| | | | | | | | | | | | * 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
* gpg: Make sure a DECRYPTION_OKAY is never issued for a bad OCB tag.Werner Koch2024-03-142-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.
* gpg: Fix mixed invocation with --trusted-keys and --no-options.Werner Koch2024-03-041-16/+36
| | | | | | | | | | | | * g10/trustdb.c: Move some definitions around. (user_utk_list): Rename to trusted_key_list. Change all users. (any_trusted_key_seen): New. (tdb_register_trusted_key): Set it here. Handle the new value "none". (verify_own_keys): Do not delete a trusted key from the trustdb if a trusted-key option was not used. -- GnuPG-bug-id: 7025
* gpg: Fix leftover unprotected card backup key.Werner Koch2024-01-242-2/+11
| | | | | | | | | | | | | | | | | | * agent/command.c (cmd_learn): Add option --reallyforce. * agent/findkey.c (agent_write_private_key): Implement reallyforce. Also add arg reallyforce and pass it along the call chain. * g10/call-agent.c (agent_scd_learn): Pass --reallyforce with a special force value. * g10/keygen.c (card_store_key_with_backup): Use that force value. -- This was a regression in 2.2.42. We took the easy path to fix it by getting the behaviour back to what we did prior to 2.2.42. With GnuPG 2.4.4 we use an entire different and safer approach by introducing an ephemeral private key store. GnuPG-bug-id: 6944
* gpg: Allow to create revocations even with non-compliant algos.Werner Koch2024-01-101-5/+7
| | | | | | | | | | * g10/sign.c (do_sign): Skip compliance check for revocation certs. -- It just does not make sense to inhibit the creation of revocations depending on the compliance mode. We do this only for key revocation but not for another kind of revocation because the rationale for uid or subkey revocation is more complicated to explain.
* po: Update po filesWerner Koch2023-11-281-1/+3
| | | | | * g10/keyserver.c (keyserver_refresh): Use ngettext to avoid msgmerge warnings.
* gpg,gpgsm: Hide password in debug output also for asked passwords.Werner Koch2023-11-141-1/+5
| | | | | | | | | | | | | * g10/call-agent.c (agent_get_passphrase): Call assuan_begin_confidential and assuan_end_confidential. * sm/call-agent.c (gpgsm_agent_ask_passphrase): Ditto. -- GnuPG-bug-id: 6654 The drawback of this solution is that we don't see any IPC lines from the assuan_transact. Everything else would require larger changes to libassuan.
* gpg,sm: Set confidential in assuan communication for password.NIIBE Yutaka2023-11-101-0/+2
| | | | | | | | | | | | | | * g10/call-agent.c (default_inq_cb): Call assuan_begin_confidential and assuan_end_confidential. * sm/call-agent.c (default_inq_cb): Likewise. -- Cherry pick from master commit of: ec1446f9446506b5fbdf90cdeb9cbe1f410a657e GnuPG-bug-id: 6654 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Pass ECDH parameters to OpenPGP smartcardsWerner Koch2023-10-276-11/+68
| | | | | | | | | | | | | | * g10/call-agent.c (agent_keytocard): Add arg ecdh_param_str. * g10/keyid.c (ecdh_param_str_from_pk): New. * g10/card-util.c (card_store_subkey): Pass ECDH params to writekey. * g10/keygen.c (card_store_key_with_backup): Ditto. -- Backported from 2.4 - here the gpg part. See-commit: c03ba92576e34f791430ab1c68814ff16c81407b This is related to GnuPG-bug-id: 6378
* gpg: Allow expiration time after 2013-01-19 on 32 bit Windows.Werner Koch2023-10-261-7/+18
| | | | | | | | * g10/keygen.c (parse_expire_string): Use isotime2epoch_u64. (parse_creation_string): Ditto. -- GnuPG-bug-id: 6736
* gpg: Allow to specify seconds since Epoch beyond 2038.Werner Koch2023-10-141-3/+10
| | | | | | | | | | | * g10/keygen.c (parse_expire_string_with_ct): Use new function scan_secondsstr. (parse_creation_string): Ditto. -- Noet that we cap the seconds at the year 2106. GnuPG-bug-id: 6736
* gpg: Keep the integrity of the code for KEYINFO command.NIIBE Yutaka2023-09-262-7/+1
| | | | | | | | | | | | | | | | * g10/call-agent.c (struct keyinfo_data_parm_s): Remove CARD_AVAILABLE field. (keyinfo_status_cb): Don't touch CARD_AVAILABLE field. (agent_probe_secret_key); Don't check CARD_AVAILABLE field. * g10/import.c (do_transfer): Check if it's card key or not. -- In 2.2 branch, gpg-agent doesn't have a capability to report if card is available or not by KEYINFO command. Thus, this clean up. GnuPG-bug-id: 3456 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Enhance agent_probe_secret_key to return bigger value.NIIBE Yutaka2023-09-251-38/+63
| | | | | | | | | | | | | | * g10/call-agent.c (keyinfo_status_cb): Parse more fields. (agent_probe_secret_key): Use KEYINFO and returns bigger value representing the preference. -- Backport the commit of: 8748c50bfaa8df2b1e59c301d15fd6b9ddbd9c47 GnuPG-bug-id: 3456 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Fix --no-utf8-strings.Werner Koch2023-09-181-1/+1
| | | | | | | | * g10/gpg.c (main): Ignore --no-utf8-strings only on Windows. -- Fixes-commit: b912f07cdf00043b97fca54e4113fab277726e03 Reported-by: Ingo Klöcker
* gpg: New option --add-desig-revokerWerner Koch2023-09-074-16/+115
| | | | | | | | | | | | | | | | | | | * g10/gpg.c (oAddDesigRevoker): New. (opts): Add new option. * g10/options.h (opt): Add field desig_revokers. * g10/keygen.c (get_parameter_idx): New. (get_parameter): Make use of get_parameter_idx. (prepare_desig_revoker): New. (get_parameter_revkey): Add arg idx. (proc_parameter_file): Add designated revokers. (do_generate_keypair): Write all designated revokers. -- (cherry picked from commit 3d094e2bcf6c9ed2cd405623f2dbc6131d04366f) Support for v5 desig revokers has been removed. However, we should check whether we can add a longer v4 desig revoker fingerprint in addition to the regular v4 desig revoker.
* gpg: Fix validity of re-imported keys.Werner Koch2023-09-061-1/+22
| | | | | | | | | | | | | | | | | | | | | | | * g10/trustdb.c (tdb_clear_ownertrusts): Detect stale validity records. -- GnuPG-bug-id: 6399 This problem was introduced by an actually very useful patch 2002-12-13 David Shaw <[email protected]> [...] * import.c (import_keys_internal): Used here so we don't rebuild the trustdb if it is still clean. (import_one, chk_self_sigs): Only mark trustdb dirty if the key that is being imported has any sigs other than self-sigs. Suggested by Adrian von Bidder. [the last part] The bug exhibited itself only after signing a key, deleting that key and then re-importing the original non-signed key.
* gpg: Fix for overridden key import.NIIBE Yutaka2023-09-061-1/+1
| | | | | | | | | | | | | | * g10/import.c (do_transfer): Force the overridden key import even when smartcard is available. -- Cherry picked from 2.4 branch: 0ec10fbd0d4007997cec59da9a514797bc0531a8 Fixes-commit: 2c1297055041b4657ea1a927acac978c2b09a483 GnuPG-bug-id: 3456 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Allow overridden key import when stub exists.NIIBE Yutaka2023-09-061-1/+11
| | | | | | | | | | | | | * g10/import.c (do_transfer): Force importing when it's card reference. -- Cherry-picked from 2.4 branch: 2c1297055041b4657ea1a927acac978c2b09a483 GnuPG-bug-id: 3456 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Prepare enhancement of agent_probe_secret_key.NIIBE Yutaka2023-09-068-26/+32
| | | | | | | | | | | | | | | | | | | | | | * g10/call-agent.c (agent_probe_secret_key): Change semantics of return value. * g10/call-agent.h (agent_probe_secret_key): Change comment. * g10/delkey.c (do_delete_key): Follow the change. * g10/getkey.c (get_seckey, parse_def_secret_key): Likewise. (finish_lookup, have_secret_key_with_kid): Likewise. * g10/gpgv.c (agent_probe_secret_key): Likewise. * g10/keyedit.c (keyedit_menu, quick_find_keyblock): Likewise. (show_key_with_all_names_colon): Likewise. * g10/revoke.c (gen_desig_revoke, gen_revoke): Likewise * g10/test-stubs.c (agent_probe_secret_key): Likewise. -- Cherry picked from 2.4 branch of: 853d5b7677ea01f65c9bc5160cd8509b62f486f7 GnuPG-bug-id: 3416 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Fix format_keyid.NIIBE Yutaka2023-08-281-5/+4
| | | | | | | | | * g10/keyid.c (format_keyid): Allocate buffer earlier. -- Signed-off-by: NIIBE Yutaka <[email protected]> (cherry picked from commit a9be9f4e6e6d451698afa3d4780a53ed3718b30b)
* gpg: Do not continue the export after a cancel for the primary key.Werner Koch2023-08-251-1/+10
| | | | | | | | | * g10/export.c (do_export_one_keyblock): Handle a cancel for the primary key special. -- GnuPG-bug-id: 6093 (cherry picked from commit 49d16f4f6edf872babf04ae383974d891871a33b)
* gpg: Return ERROR status for --quick-sign-key.Werner Koch2023-07-051-3/+6
| | | | | * g10/keyedit.c (keyedit_quick_sign): Return an error status line. --
* gpg: New option --no-compress as alias for -z0.Werner Koch2023-07-051-0/+7
|
* gpg: Make progress work for large files on Windows.Werner Koch2023-07-057-34/+44
| | | | | | | | | | | | | | | | | | | | * common/iobuf.c (iobuf_get_filelength): Change return type to uint64_t and remove the overflow args. For Windows always use GetFileSizeEx which is available since the long EOL-ed Windows XP. * g10/sign.c (write_plaintext_packet): Adjust for changed iobuf_get_filelength. * g10/encrypt.c (encrypt_simple, encrypt_crypt): Ditto. * g10/photoid.c (generate_photo_id): Ditto. Also add an upper limit. * g10/filter.h (progress_filter_context_t): Change amount values to use uint64_t. * g10/progress.c (write_status_progress): Change accordingly. -- GnuPG-bug-id: 6534 Backported-from: 808494b48577c2efb894a0877f59d9c4ed664f56
* gpg: Print status line and proper diagnostics for write errors.Werner Koch2023-07-051-3/+11
| | | | | | | | | * common/iobuf.c (file_filter): Improve diagnostics. * g10/build-packet.c (do_plaintext): Make sure to cache all error cases. -- GnuPG-bug-id: 6528
* gpg: Set default expiration date to 3 years.Werner Koch2023-07-051-1/+1
| | | | | | | | * g10/keygen.c (default_expiration_interval): Change. -- This is a revision of GnuPG-bug-id: 2701
* delete redundant characterszhangguangzhi2023-06-201-1/+1
| | | | | | | -- GnuPG-bug-id: 6482 Signed-off-by: zhangguangzhi <[email protected]>
* gpg: Skip keys found via ADSKs.Werner Koch2023-05-252-12/+28
| | | | | | | | | | | | | | | * g10/encrypt.c (write_pubkey_enc): Indicate encryption to an ADSK. * g10/getkey.c (finish_lookup): Skip ADKS keys. -- If a key is searched by fingerprint or keyid and it happens that this is an ADSK (subkey with the RENC usage), we need to skip this key because it is not the key we actually want to encrypt to. The actual ADSK key is taken later by looking at all subkeys of the actual selected key. This is related to GnuPG-bug-id: 6504