aboutsummaryrefslogtreecommitdiffstats
path: root/g10 (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* scd: Fix commit b30c15bf (again).NIIBE Yutaka2015-12-231-0/+1
| | | | | | | | * g10/keygen.c (do_generate_keypair): Clear the variable S. -- GnuPG-bug-id: 2201
* gpg: Fix type.Neal H. Walfield2015-12-221-1/+1
| | | | | | | * g10/keygen.c (card_write_key_to_backup_file): Change n to a size_t. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Fix error message.Neal H. Walfield2015-12-221-1/+1
| | | | | | | * g10/getkey.c (parse_def_secret_key): Fix error message. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Don't check for ambiguous keys.Neal H. Walfield2015-12-225-512/+313
| | | | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (struct result): Move from here... * g10/keydb.h (struct pubkey): ... to here. Update users. * g10/gpg.c (check_user_ids): Move from here... * g10/getkey.c (get_pubkeys): ... to here. Update users. Use get_pubkey_byname to look up the keys (this also prunes invalid keys). (pubkey_free): New function. (pubkeys_free): New function. * g10/gpg.c (main): Don't check for ambiguous key specifications. -- Signed-off-by: Neal H. Walfield <[email protected]> Regression-due-to: e8c53fc This change not only moves the checks for ambiguous key specifications from gpg.c to getkey.c, it also disables the checks. The old code was too divorced from the actual key lookups and, as such, it reproduced the logic. Unfortunately, the reproduction was a poor one: despite fixing some inconsistencies (e.g., 10cca02), it still didn't deal with group expansion or the auto key lookup functionality. Given the amount of instability introduced by this change, we (Neal & Werner) decided it is better to defer introducing this functionality until 2.3.
* gpg: Lazily evaluate --default-key.Neal H. Walfield2015-12-222-21/+47
| | | | | | | | | | | * g10/gpg.c (main): If --encrypt-to-default-key is specified, don't add --default-key's value to REMUSR here... * g10/pkclist.c (build_pk_list): ... do it here. * tests/openpgp/Makefile.am (TESTS): Add default-key.test. * tests/openpgp/default-key.test: New file. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Remove unused parameter.Neal H. Walfield2015-12-224-18/+17
| | | | | | | | * g10/pkclist.c (build_pk_list): Remove parameter use, which is always called set to PUBKEY_USAGE_ENC. Update callers. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Improve check for ambiguous keys.Neal H. Walfield2015-12-221-94/+143
| | | | | | | | * g10/gpg.c (check_user_ids): When checking for ambiguous keys, ignore encryption-only keys when a signing key is needed and vice-versa. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Fix TOCTTOU when updating keyblocks.Neal H. Walfield2015-12-222-6/+31
| | | | | | | | | | | | | | | | | | | * g10/keydb.c (keydb_update_keyblock): Don't replace the record at the current offset. After taking the lock, extract the fingerprint from the keyblock, find it and then replace it. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 2193 Between locating the record to update and actually updating the keyblock, it is possible that another process modifies the keyring, which causes the update to corrupt the keyring. This is due to a time of check to time of use bug. The fix is straightforward: both operations must be done while holding the lock. This changes the semantics of the function slightly, but no callers need to be modified. Further, it now becomes impossible to replace key A with B; this function will only ever update B.
* gpg: Display the key that is invalid, not the search description.Neal H. Walfield2015-12-221-6/+6
| | | | | | | | * g10/getkey.c (parse_def_secret_key): Display the key that is invalid, not the search description. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Mark more options as coming from the config file (when this holds)Neal H. Walfield2015-12-221-1/+5
| | | | | | | | | * g10/gpg.c (main): When --default-key or --encrypt-to-default-key is taken from the config file, note this. -- Signed-off-by: Neal H. Walfield <[email protected]> Regression-due-to: 28311d1
* gpg: Use enums instead of defines.Neal H. Walfield2015-12-221-4/+10
| | | | | | | | | | | | * g10/keydb.h (PK_LIST_ENCRYPT_TO): Change from a macro to an enum. (PK_LIST_HIDDEN): Likewise. (PK_LIST_CONFIG): Likewise. (PK_LIST_SHIFT): Likewise.n -- Signed-off-by: Neal H. Walfield <[email protected]> Using an enum has the advantage that the symbol can be used in gdb.
* g10: clean up of headers for card.NIIBE Yutaka2015-12-212-8/+0
| | | | | * g10/main.h (save_unprotected_key_to_card): Remove. * g10/options.h (ctapi_driver, pcsc_driver, disable_ccid): Remove.
* g10: Fix commit b30c15bf.NIIBE Yutaka2015-12-181-4835/+0
| | | | | | -- Remove the backup file g10/keygen.c.~HEAD~
* g10: Remove deprecated internal functions.NIIBE Yutaka2015-12-181-404/+0
| | | | | | | | | | | * g10/keygen.c (do_ask_passphrase, generate_raw_key) (gen_card_key_with_backup, save_unprotected_key_to_card): Remove. -- Now, key generation is done by gpg-agent. Asking passphrase is done through pinentry invoked by gpg-agent. It is done by new internal function of card_store_key_with_backup.
* g10: Fix a regression for generating card key with backup.NIIBE Yutaka2015-12-183-20/+5006
| | | | | | | | | | | | * g10/main.h (receive_seckey_from_agent): Declare. * g10/keygen.c (card_write_key_to_backup_file): New. (card_store_key_with_backup): New. (do_generate_keypair): Create a key on host for encryption key when backup is requested. Then, call card_store_key_with_backup. -- GnuPG-bug-id: 2169
* g10: factor out a function for secret key retrieval.NIIBE Yutaka2015-12-171-70/+83
| | | | | | | | | | | | | * g10/export.c (receive_seckey_from_agent): New. (do_export_stream): Use it. -- Also fixed a memory leak of WRAPPEDKEY on a successful path of build_packet. In the log message, key is now by a hexgrip instead of a format by keystr_with_sub.
* gpg: When checking for ambiguous keys, ignore invalid keys.Neal H. Walfield2015-12-161-139/+297
| | | | | | | | | | * g10/gpg.c (check_user_ids): When checking for ambiguous keys, ignore disabled, revoked and expired keys (if appropriate for the provided option). -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 2186
* gpg: Reduce number of strings to translate.Werner Koch2015-12-151-10/+10
| | | | | | | | | | * g10/getkey.c (parse_def_secret_key): Do not make debug messages translatable. Make use of print_reported_error. -- This patch also passes all required arguments to log_debug ;-). Signed-off-by: Werner Koch <[email protected]>
* gpg: New function to printed a detailed error code.Werner Koch2015-12-152-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/misc.c (print_reported_error): New. -- Often the user is only interested in a catch all error code like "not found" but sometimes it is useful to also see the real reason. By this function this can easily be achieved. Example: err = search_for_key (keyid) if (err) { log_info ("error locating key '%s': %s\n", keyid, gpg_strerror (GPG_ERR_NOT_FOUND)); print_reported_error (err, GPG_ERR_NOT_FOUND); } results in gpg: error locating key 'foobar': not found gpg: (reported error: no keyring <keybox>) where the second line is only printed in verbose mode and if ERR is not GPG_ERR_NOT_FOUND. Signed-off-by: Werner Koch <[email protected]>
* gpg: Improve the keyblock cache's transparency.Neal H. Walfield2015-12-151-0/+6
| | | | | | | | | * kbx/keybox-search.c (keybox_seek): New function. * g10/keydb.c (keydb_search): When reading from the cache, seek to just after the cached record. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Improve the keyblock cache's transparency.Neal H. Walfield2015-12-151-1/+18
| | | | | | | | | | | | | | * kbx/keybox-search.c (keybox_offset): New function. * g10/keydb.c (struct keyblock_cache): Add fields resource and offset. (keyblock_cache_clear): Reset HD->KEYBLOCK_CACHE.RESOURCE and HD->KEYBLOCK_CACHE.OFFSET. (keydb_search): Don't use the cached result if it comes before the current file position. When caching an entry, also record the position at which it was found. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 2187
* gpg: Use more descriptive names.Neal H. Walfield2015-12-151-111/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/keyring.c (KR_NAME): Rename this... (KR_RESOURCE): ... to this. Update users. (struct keyring_name): Rename this... (struct keyring_resource): ... to this. Update users. (struct off_item): Rename this... (struct key_present): ... to this. Update users. (OffsetHashTable): Rename this... (key_present_hash_t): ... to this. Update users. (kr_offtbl): Rename this... (key_present_hash): ... to this. Update users. (kr_offtbl_ready): Rename this... (key_present_hash_ready): ... to this. Update users. (KEY_PRESENT_HASH_BUCKETS): New define. Replace use of literals with this. (new_offset_item): Rename this... (key_present_value_new): ... to this. Update users. (release_offset_items): Drop dead code. (new_offset_hash_table): Rename this... (key_present_hash_new): ... to this. Update users. (release_offset_hash_table): Drop dead code. (lookup_offset_hash_table): Rename this... (key_present_hash_lookup): ... to this. Update users. (update_offset_hash_table): Rename this... (key_present_hash_update): ... to this. Drop unused parameter off. Update users. (update_offset_hash_table_from_kb): Rename this... (key_present_hash_update_from_kb): ... to this. Drop unused parameter off. Update users. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Print ownertrust in TOFU+PGP trust model.Damien Goutte-Gattat2015-12-141-2/+3
| | | | | | | | | | | | * g10/keyedit.c: Print ownertrust in TOFU+PGP trust model. -- The key editor currently prints out the ownertrust value assigned to a key only when using the classic or PGP trust models; but that value is also meaningful in the recently introduced TOFU+PGP combined model. Signed-off-by: Damien Goutte-Gattat <[email protected]>
* gpg: Fix --default-key checks.Neal H. Walfield2015-12-141-3/+59
| | | | | | | | | | | | * g10/getkey.c (parse_def_secret_key): Don't just check if a secret key is available for the public key, also consider subkeys. Also check that the key has the signing capability, is not revoked, is not expired and is not disabled. Print a warning if there was a least one value passed to --default-key and all were ignored. -- Signed-off-by: Neal H. Walfield <[email protected]> Regression-due-to: e16d7168
* gpg: Use a regular type instead of a void* for import stats.Werner Koch2015-12-123-31/+36
| | | | | | | | | * g10/import.c (struct stats_s): Rename to import_stats_s. Change all users. * g10/main.h (import_stats_t): New. Change fucntions to use this instead of a void pointer. Signed-off-by: Werner Koch <[email protected]>
* gpg: Fix buffer overflow.Neal H. Walfield2015-12-111-1/+1
| | | | | | | | | | | * g10/keydb.c (keydb_search_desc_dump): Fix buffer overflow. -- Signed-off-by: Neal H. Walfield <[email protected]> Regression-due-to: 11ec478 Note: this buffer overflow will only occur if --debug=lookup is passed to gpg and a search by fingerprint is done.
* gpg: Don't error out if a key occurs multiple times in the keyring.Neal H. Walfield2015-12-111-32/+82
| | | | | | | | | * g10/gpg.c (check_user_ids): Don't error out if a key occurs multiple times in the keyring. Instead, print a warning. When printing out fingerprint prints, use format_hexfingerprint to format them. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Write ERROR status on delete-key cancellationDaiki Ueno2015-12-041-1/+4
| | | | | | | | | * g10/delkey.c (do_delete_key): Write ERROR status code with the error location "delete_key.secret", when the user cancelled the operation on Pinentry. -- I changed the original patch to emit the full gpg_error_t code. -wk
* gpg: Do not pre-check keys given on the command line.Werner Koch2015-12-043-19/+59
| | | | | | | | | | | | | | | | | | | | * g10/keydb.h (PK_LIST_ENCRYPT_TO, PK_LIST_HIDDEN, PK_LIST_CONFIG) (PK_LIST_SHIFT): New. * g10/pkclist.c (build_pk_list): Use them here. * g10/gpg.c (check_user_ids, main): Ditto. * g10/gpg.c (main): Set PK_LIST_CONFIG for REMUSR and LOCUSR. (check_user_ids): Skip check for command line specified options. -- If a key has been given on the command line and it has not been given by one of the encrypt-to options, we now skip the checks. The reason is that the actual key selection code does its own checks and provides proper status message to the caller to detect the wrong keys. Without this we would break most frontends because they expect for example STATUS_INV_RECP. Signed-off-by: Werner Koch <[email protected]>
* gpg: Allow "help" as value for --tofu-policy.Werner Koch2015-12-041-15/+33
| | | | | | | | * g10/gpg.c (parse_tofu_policy): Add keyword "help". (parse_tofu_db_format): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
* Do not translate messages printed with log_debug.Werner Koch2015-12-041-2/+3
| | | | | | | | | * common/asshelp.c (start_new_gpg_agent): Do not i18n string. (start_new_dirmngr): Ditto. * g10/mainproc.c (proc_encrypted): Ditto. Print only if debug is enabled. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add variant of 'key "%s" not found: %s' error message.Werner Koch2015-12-032-3/+2
| | | | | | | * g10/gpg.c (check_user_ids): Change error message. * g10/delkey.c (do_delete_key): Ditto. Signed-off-by: Werner Koch <[email protected]>
* gpg: Make keyidlist more robust in case of errors.Werner Koch2015-12-031-1/+4
| | | | | | * g10/keyserver.c (keyidlist): Clear *KLIST on error. Signed-off-by: Werner Koch <[email protected]>
* gpg: Take care of keydb_new returning NULL.Werner Koch2015-12-0316-37/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/keydb.c (keydb_new): Print an error message if needed. Also use xtrycalloc because we return an error anyway. * g10/delkey.c (do_delete_key): Handle error retruned by keydb_new. * g10/export.c (do_export_stream): Ditto. * g10/getkey.c (get_pubkey): Ditto. (get_pubkey_fast): Ditto. (get_pubkeyblock): Ditto. (get_seckey): Ditto. (key_byname): Ditto. (get_pubkey_byfprint): Ditto. (get_pubkey_byfprint_fast): Ditto. (parse_def_secret_key): Ditto. (have_secret_key_with_kid): Ditto. * g10/import.c (import_one): Ditto. (import_revoke_cert): Ditto. * g10/keyedit.c (keyedit_quick_adduid): Ditto. * g10/keygen.c (quick_generate_keypair): Ditto. (do_generate_keypair): Ditto. * g10/trustdb.c (validate_keys): Ditto. * g10/keyserver.c (keyidlist): Ditto. * g10/revoke.c (gen_desig_revoke): Ditto. (gen_revoke): Ditto. * g10/gpg.c (check_user_ids): Ditto. (main): Do not print an error message for keydb_new error. * g10/keylist.c (list_all): Use actual error code returned by keydb_new. * g10/t-keydb-get-keyblock.c (do_test): Abort on keydb_new error. * g10/t-keydb.c (do_test): Ditto. * g10/keyring.c (keyring_new): Actually return an error so that the existing keydb_new error checking makes sense for a keyring resource. (keyring_rebuild_cache): Take care of keyring_new returning an error. -- Commit 04a6b903 changed keydb_new to return an error. However the error was not checked at most places which we fix with this patch. To make things easier keydb_new prints an error message itself. Signed-off-by: Werner Koch <[email protected]>
* gpg: Change some error messages.Werner Koch2015-12-036-43/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/getkey.c (parse_def_secret_key): Change error message. Replace log_debug by log_info. * g10/gpg.c (check_user_ids): Make function static. Change error messages. (main): Change error messages. * g10/revoke.c (gen_revoke): Ditto. -- There are other smaller changes not described above. This change tries to avoid new error messages so not to increase the the number of translated strings or break too many existing translations. It also tries to use existing strings and changes the quoting to the most common style used in gpg. Key specifications should in general use double quotes. Other values should use single quotes. However. sometimes it is not easy to distinguish between values given on the command line and key specifications. According to old GNU coding standards diagnostics should not start capitalized - whether this is a good idea is a different thing but we used this rules for most strings. However, strings which are used interactively should be properly capitalized and end with a dot. Signed-off-by: Werner Koch <[email protected]>
* gpg: Use the matching key if the search description is exact.Neal H. Walfield2015-12-021-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (check_user_ids): If the search description is for an exact match (a keyid or fingerprint that ends in '!'), then use the matching key, not the primary key. * tests/openpgp/Makefile.am (TESTS): Add use-exact-key.test. (priv_keys): Add privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc, privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc, privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc, privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc and privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc. (sample_keys): Add samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc. * tests/openpgp/privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc: New file. * tests/openpgp/privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc: New file. * tests/openpgp/privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc: New file. * tests/openpgp/privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc: New file. * tests/openpgp/privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc: New file. * tests/openpgp/samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc: New file. * tests/openpgp/use-exact-key.test: New file. * tests/openpgp/version.test: Install the new private keys. -- Signed-off-by: Neal H. Walfield <[email protected]> Reported-by: Reported-by: Kristian Fiskerstrand <[email protected]> Fixes-commit: 10cca02
* gpg: Improve documentation.Neal H. Walfield2015-12-021-2/+1
| | | | | | | * g10/tofu.c (initdb): Improve documentation. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Fix type mismatch resulting in a buffer overflow.Neal H. Walfield2015-12-021-1/+4
| | | | | | | | | | | * g10/tofu.c (record_binding): Change policy_old's type from an enum tofu_policy to a long: this variable is passed by reference and a long is expected. -- Signed-off-by: Neal H. Walfield <[email protected]> Reported-by: Justus Winter <[email protected]> Fixes-commit: f77913e
* dirmngr: Switch to an onion address if Tor is running.Werner Koch2015-12-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | * dirmngr/dirmngr.h (opt): Turn field 'keyserver' into an strlist. * dirmngr/dirmngr.c (parse_rereadable_options): Allow multiple --keyserver options. * dirmngr/server.c (server_local_s): Add field 'tor_state'. (release_uri_item_list): New. (release_ctrl_keyservers): Use it. (start_command_handler): Release list of keyservers. (is_tor_running): New. (cmd_getinfo): Re-implement "tor" subcommand using new fucntion. (ensure_keyserver): Rewrite. * g10/dirmngr-conf.skel: Add two keyserver options. -- This feature is independent of --use-tor and automagically uses Tor if available. The dirmngr.conf file needs to specify two keyservers to make this work. For new installations this is done using the skeleton file. This feature requires the Libassuan 2.4.2 to work. This patch also fixes a memory leak of opt.keyserver en passant. Signed-off-by: Werner Koch <[email protected]>
* common,gpg: Fix processing of search descriptions ending in '!'.Neal H. Walfield2015-12-021-1/+13
| | | | | | | | | | | | | | | * g10/gpg.c (check_user_ids): If the search description describes a keyid or fingerprint and ends in a '!', include the '!' in the rewritten description. * common/userids.c (classify_user_id): Accept keyids and fingerprints ending in '!'. -- Signed-off-by: Neal H. Walfield <[email protected]> Reported-by: Kristian Fiskerstrand <[email protected]> Fixes-commit: f99830b7 Fixes-commit: e8c53fca
* gpg: Avoid extra translation strings.Werner Koch2015-11-271-16/+4
| | | | | | | | | | | | | | | | | | | | | | * g10/keyedit.c (menu_expire): Use only one prompt. -- The old code was anyway not fully i18n because it did not used ngettext. Further we ran into const char*/char* conflicts on Windows where we use a different gettext implementation. FWIW: A better pattern in the case of a static and a malloced string w/o error return on malloc failure would be: const char *s; char *s_buf; s_buf = xtryasprintf ("%d foo", n); if (!s_buf) s = "several foo"; else s = s_buf; bar (s); xfree (s_buf);
* gpg,w32: Fix a format string error.Werner Koch2015-11-271-2/+2
| | | | | | * g10/keyring.c (keyring_search): Fix format string for off_t. Signed-off-by: Werner Koch <[email protected]>
* Silence unused variable or parameter warnings.Werner Koch2015-11-272-1/+8
| | | | --
* gpg: When comparing keyids, use the keyid, not the fingerprint's suffix.Neal H. Walfield2015-11-241-12/+41
| | | | | | | | | | | * g10/keyedit.c (menu_select_key): Use spacep and hexdigitp instead of inline tests. Don't compare P to the suffix of the fingerprint. If P appears to be a keyid, do an exact compare against the keyid. If it appears to be a fingerprint, do an exact compare against the fingerprint. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Reflow long texts.Neal H. Walfield2015-11-231-4/+12
| | | | | | | | | | | * common/stringhelp.c (format_text): New function. * common/t-stringhelp.c (stresc): New function. (test_format_text): New function. Test format_text. * g10/tofu.c (get_trust): Use format_text to reflow long texts. (show_statistics): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Extend utf8_charcount to include the string's length.Neal H. Walfield2015-11-231-1/+1
| | | | | | | | * common/stringhelp.c (utf8_charcount): Take additional parameter, len. Process at most LEN bytes. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Allow updating the expiration time of multiple subkeys at once.Neal H. Walfield2015-11-231-6/+25
| | | | | | | | | * g10/keyedit.c (menu_expire): Allow updating the expiration time of multiple subkeys at once. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 1944
* gpg: Don't crash if key is not passed an argument.Neal H. Walfield2015-11-231-1/+2
| | | | | | | * g10/keyedit.c (menu_select_key): Don't crash if P is NULL. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Fail if the search description passed to --gen-revoke is ambiguous.Neal H. Walfield2015-11-201-0/+41
| | | | | | | | * g10/revoke.c (gen_revoke): Error out if the search description is ambiguous. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Refactor print_seckey_info.Neal H. Walfield2015-11-202-5/+17
| | | | | | | | | * g10/keylist.c (print_seckey_info): Break formatting functionality into... (format_seckey_info): ... this new function. -- Signed-off-by: Neal H. Walfield <[email protected]>