aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* gpg: Move documentation from keydb.h to keydb.c and getkey.c.Werner Koch2016-01-111-24/+321
| | | | | | | | | | | -- When using tags (e.g. GNU global) to navigate the source code it is way easier to have the documentation close to the function we are looking at. Having the documentation in the header file would require an extra manual lookup to understand the function. Signed-off-by: Werner Koch <[email protected]>
* gpg: Fix NULL de-ref for ambiguous key check in --export-ssh-keys.Werner Koch2016-01-111-1/+5
| | | | | | | | | | | * g10/getkey.c: Allow arg RET_KEYBLOCK to be NULL. -- This change adds the expected behavior for the getkey_next function to fix this NULL de-ref. GnuPG-bug-id: 2212 Signed-off-by: Werner Koch <[email protected]>
* gpg: Add an exact search flag to the PK struct.Werner Koch2016-01-081-4/+6
| | | | | | | | | * g10/getkey.c (merge_selfsigs_subkey): Clear exact flag. (finish_lookup): Set exact flag. * g10/packet.h (PKT_public_key): Add field flags.exact. -- Signed-off-by: Werner Koch <[email protected]>
* gpg: Avoid warnings about possible NULL deref.Werner Koch2016-01-071-1/+1
| | | | | | | | | | | | | * g10/getkey.c (cache_public_key): Protect deref of CE which actually can't happen. * g10/keygen.c (quickgen_set_para): s/sprintf/snprintf/. * g10/tofu.c (end_transaction, rollback_transaction): Allow NULL for DB. * g10/trustdb.c (update_min_ownertrust): Remove useless clearling of ERR. -- Signed-off-by: Werner Koch <[email protected]>
* gpg: Fix warnings about useless assignments.Werner Koch2016-01-071-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * g10/armor.c (parse_hash_header): Remove duplicate var assignment. * g10/getkey.c (cache_user_id): Ditto. * g10/keygen.c (ask_curve): Ditto. This also fixes a small memory leak. * g10/keygen.c (proc_parameter_file): Remove useless assignment or pointer increment. (generate_keypair): Ditto. * g10/getkey.c (finish_lookup, lookup): Ditto. * g10/card-util.c (change_pin): Ditto. * g10/gpg.c (main) <aVerify>: Ditto. * g10/import.c (import): Ditto. (print_import_check): Ditto * g10/keyring.c (do_copy): Ditto. * g10/tdbio.c (tdbio_read_record): Ditto. * g10/trustdb.c (tdb_update_ownertrust): Ditto. (update_validity): Ditto. * g10/server.c (cmd_passwd): Remove useless call to skip_options. -- Signed-off-by: Werner Koch <[email protected]>
* gpg: Fix double free.Neal H. Walfield2016-01-041-9/+1
| | | | | | | | | | | * g10/getkey.c (get_pubkeys): Fix double free. -- Signed-off-by: Neal H. Walfield <[email protected]> Fixes-commit: 7195b943 Note: this error is not a security problem, because this code path is currently never executed.
* Revert commit 4654384fe7a4dcee113dacf27c398b13dea5d0be.Neal H. Walfield2016-01-041-1/+1
| | | | | | | | | -- Signed-off-by: Neal H. Walfield <[email protected]> Werner pointed out that a special error message is not needed: the error code (as displayed by gpg_strerror) will indicate what went wrong.
* gpg: Rename struct pubkey to pukey_s and add pubkey_t.Werner Koch2015-12-231-11/+11
| | | | | | | | | | | | | | | | | * g10/keydb.h (struct pubkey): Rename to pubkey_s. (pubkey_t): New. Change all struct pubkey_s to use this type. * g10/getkey.c (get_pubkeys): Rename arg keys to r_keys. -- It is common in GnuPG to use a suffix of _s for struct names. There is no technical need for this (actually this pattern comes from pre ANSI C compilers which had no separate namespaces) but it avoid surprises when reading the code. Adding the pubkey_t type is mainly to improve font locking by using the common suffix _t for a typedefed type. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add standard free() semantic to pubkey_free.Werner Koch2015-12-231-3/+6
| | | | | | | | | * g10/getkey.c (pubkey_free): Check for NULL arg. -- We don't like surprises ;-) Signed-off-by: Werner Koch <[email protected]>
* gpg: Do not translate debug output.Werner Koch2015-12-231-3/+3
| | | | | | | | | * g10/getkey.c (parse_def_secret_key): Do not make strings passed to log_debug translatable. -- Debug output is intended to be used along with the source or to be send to the developers. Thus translations are at best not helpful.
* 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-221-0/+276
| | | | | | | | | | | | | | | | | | | | | | | | | * 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: 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: 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: 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: Take care of keydb_new returning NULL.Werner Koch2015-12-031-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-031-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: Change keydb_search to not return legacy keys.Neal H. Walfield2015-11-171-45/+2
| | | | | | | | | | | | | | | | | | | | * g10/keyring.c (keyring_search): Take new argument, ignore_legacy. If set, skip any legacy keys. Update callers. * g10/keydb.c (keydb_search): Skip any legacy keys. (keydb_search_first): Don't skip legacy keys. Treat them as an error. (keydb_search_next): Likewise. (keydb_search_fpr): Likewise. * g10/export.c (do_export_stream): Likewise. * g10/getkey.c (lookup): Likewise. (have_secret_key_with_kid): Likewise. * g10/keylist.c (list_all): Likewise. (keyring_rebuild_cache): Likewise. * g10/keyserver.c (keyidlist): Likewise. * g10/trustdb.c (validate_key_list): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>
* Fix typos found using codespell.Justus Winter2015-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c: Fix typos. * agent/call-pinentry.c: Likewise. * agent/call-scd.c: Likewise. * agent/command-ssh.c: Likewise. * agent/command.c: Likewise. * agent/divert-scd.c: Likewise. * agent/findkey.c: Likewise. * agent/gpg-agent.c: Likewise. * agent/w32main.c: Likewise. * common/argparse.c: Likewise. * common/audit.c: Likewise. * common/audit.h: Likewise. * common/convert.c: Likewise. * common/dotlock.c: Likewise. * common/exechelp-posix.c: Likewise. * common/exechelp-w32.c: Likewise. * common/exechelp-w32ce.c: Likewise. * common/exechelp.h: Likewise. * common/helpfile.c: Likewise. * common/i18n.h: Likewise. * common/iobuf.c: Likewise. * common/iobuf.h: Likewise. * common/localename.c: Likewise. * common/logging.c: Likewise. * common/openpgp-oid.c: Likewise. * common/session-env.c: Likewise. * common/sexputil.c: Likewise. * common/sysutils.c: Likewise. * common/t-sexputil.c: Likewise. * common/ttyio.c: Likewise. * common/util.h: Likewise. * dirmngr/cdblib.c: Likewise. * dirmngr/certcache.c: Likewise. * dirmngr/crlcache.c: Likewise. * dirmngr/dirmngr-client.c: Likewise. * dirmngr/dirmngr.c: Likewise. * dirmngr/dirmngr_ldap.c: Likewise. * dirmngr/dns-stuff.c: Likewise. * dirmngr/http.c: Likewise. * dirmngr/ks-engine-hkp.c: Likewise. * dirmngr/ks-engine-ldap.c: Likewise. * dirmngr/ldap-wrapper.c: Likewise. * dirmngr/ldap.c: Likewise. * dirmngr/misc.c: Likewise. * dirmngr/ocsp.c: Likewise. * dirmngr/validate.c: Likewise. * g10/encrypt.c: Likewise. * g10/getkey.c: Likewise. * g10/gpg.c: Likewise. * g10/gpgv.c: Likewise. * g10/import.c: Likewise. * g10/keydb.c: Likewise. * g10/keydb.h: Likewise. * g10/keygen.c: Likewise. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/keyring.c: Likewise. * g10/mainproc.c: Likewise. * g10/misc.c: Likewise. * g10/options.h: Likewise. * g10/packet.h: Likewise. * g10/parse-packet.c: Likewise. * g10/pkclist.c: Likewise. * g10/pkglue.c: Likewise. * g10/plaintext.c: Likewise. * g10/server.c: Likewise. * g10/sig-check.c: Likewise. * g10/sqlite.c: Likewise. * g10/tdbio.c: Likewise. * g10/test-stubs.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. * g13/create.c: Likewise. * g13/mountinfo.c: Likewise. * kbx/keybox-blob.c: Likewise. * kbx/keybox-file.c: Likewise. * kbx/keybox-init.c: Likewise. * kbx/keybox-search-desc.h: Likewise. * kbx/keybox-search.c: Likewise. * kbx/keybox-update.c: Likewise. * scd/apdu.c: Likewise. * scd/app-openpgp.c: Likewise. * scd/app-p15.c: Likewise. * scd/app.c: Likewise. * scd/ccid-driver.c: Likewise. * scd/command.c: Likewise. * scd/iso7816.c: Likewise. * sm/base64.c: Likewise. * sm/call-agent.c: Likewise. * sm/call-dirmngr.c: Likewise. * sm/certchain.c: Likewise. * sm/gpgsm.c: Likewise. * sm/import.c: Likewise. * sm/keydb.c: Likewise. * sm/minip12.c: Likewise. * sm/qualified.c: Likewise. * sm/server.c: Likewise. * tools/gpg-check-pattern.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgkey2ssh.c: Likewise. * tools/gpgparsemail.c: Likewise. * tools/gpgtar.c: Likewise. * tools/rfc822parse.c: Likewise. * tools/symcryptrun.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
* gpg: Fix regression in --locate-keys (in 2.1.9).Werner Koch2015-11-131-1/+13
| | | | | | | | | | | | | | | | | | * g10/getkey.c (getkey_ctx_s): Add field "extra_list". (get_pubkey_byname): Store strings in the context. (getkey_end): Free EXTRA_LIST. -- This fixes a use-after-free bug. It showed up with: gpg --auto-key-locate local --locate-key [email protected] The key was shown but also all other following keys in the keyring. Bisecting showed d47e84946ee010917cfc3501062721b74afbb771 as culprit but the actual cause was a part of: Regression-due-to: b06f96ba4f57f55194efcd37a0e3a2aa5450b974 Signed-off-by: Werner Koch <[email protected]>
* gpg: Check for ambiguous or non-matching key specs.Neal H. Walfield2015-11-061-9/+0
| | | | | | | | | | | | | | | | | * g10/gpg.c (check_user_ids): New function. (main): Check that any user id specifications passed to --local-user and --remote-user correspond to exactly 1 user. Check that any user id specifications passed to --default-key correspond to at most 1 user. Warn if any user id specifications passed to --local-user or --default-user are possible ambiguous (are not specified by long keyid or fingerprint). * g10/getkey.c (parse_def_secret_key): Don't warn about possible ambiguous key descriptions here. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 1128 Debian-debug-id: 544490
* gpg: Add --encrypt-to-default-key.Neal H. Walfield2015-11-041-1/+1
| | | | | | | | | | | | | * g10/getkey.c (parse_def_secret_key): Drop the static qualifier and export the function. * g10/gpg.c (enum cmd_and_opt_values): Add value oEncryptToDefaultKey. (opts): Handle oEncryptToDefaultKey. (main): Likewise. * g10/options.h (opt): Add field encrypt_to_default_key. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 807
* gpg: Allow multiple --default-key options. Take the last available key.Neal H. Walfield2015-11-041-10/+89
| | | | | | | | | | | | | | | | | | | | | | | | | * g10/getkey.c (parse_def_secret_key): New function. (get_seckey_default): Add parameter ctrl. Update callers. Use parse_def_secret_key to get the default secret key, if any. (getkey_byname): Likewise. (enum_secret_keys): Likewise. * g10/options.h (opt): Change def_secret_key's type from a char * to a strlist_t. * g10/gpg.c (main): When processing --default-key, add the key to OPT.DEF_SECRET_KEY. * g10/gpgv.c (get_session_key): Add parameter ctrl. Update callers. * g10/mainproc.c (proc_pubkey_enc): Likewise. (do_proc_packets): Likewise. * g10/pkclist.c (default_recipient): Likewise. * g10/pubkey-enc.c (get_session_key): Likewise. * g10/sign.c (clearsign_file): Likewise. (sign_symencrypt_file): Likewise. * g10/skclist.c (build_sk_list): Likewise. * g10/test-stubs.c (get_session_key): Likewise. -- Signed-off-by: Neal H. Walield <[email protected]> GnuPG-bug-id: 806
* gpg: Add new --auto-key-locate mechanism "dane".Werner Koch2015-10-061-1/+10
| | | | | | | | | | | | | | | * g10/call-dirmngr.c (gpg_dirmngr_dns_cert): Allow fetching via DANE. * g10/keyserver.c (keyserver_import_cert): Add arg "dane_mode". * g10/options.h (AKL_DANE): New. * g10/getkey.c (get_pubkey_byname): Implement AKL_DANE. (parse_auto_key_locate): Ditto. -- To test this use gpg --auto-key-locate clear,dane,local --locate-key -v [email protected] Signed-off-by: Werner Koch <[email protected]>
* g10: Be more careful when merging self-signed data.Neal H. Walfield2015-09-161-3/+21
| | | | | | | | | | | * g10/getkey.c (merge_selfsigs_main): Stop looking for self-signed data belonging to the public key when we encounter an attribute packet or a subkey packet, not just a user id packet. When looking for self-signed data belonging to a user id packet, stop when we see a user attribute packet. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Simplify some complicated boolean expressions.Neal H. Walfield2015-09-161-8/+29
| | | | | | | * g10/getkey.c (finish_lookup): Simplify logic. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Also mark revoked and expired keys as unusable.Neal H. Walfield2015-09-161-2/+6
| | | | | | | | * g10/getkey.c (skip_unusable): Also mark the key as unusable if it has been revoked or has expired. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Release resources when returning an error in get_seckey.Neal H. Walfield2015-09-161-1/+5
| | | | | | | | * g10/getkey.c (get_seckey): If the key doesn't have a secret key, release *PK. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Improve documentation and comments for getkey.c.Neal H. Walfield2015-09-161-173/+325
| | | | | | | | | * g10/getkey.c: Improve documentation and comments for most functions. Move documentation for public functions from here... * g10/keydb.h: ... to here. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Remove unused function have_any_secret_key.Neal H. Walfield2015-09-161-14/+0
| | | | | | | * g10/getkey.c (have_any_secret_key): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Bring cache semantics closer to non-cache semantics.Neal H. Walfield2015-09-161-3/+7
| | | | | | | | * g10/getkey.c (get_pubkey_fast): When reading from the cache, only consider primary keys. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Break out of the loop earlier.Neal H. Walfield2015-09-161-6/+9
| | | | | | | | | | * g10/getkey.c (have_secret_key_with_kid): Once we find the relevent key or subkey, stop searching. -- Signed-off-by: Neal H. Walfield <[email protected]>. Only a single key or subkey will ever be selected per keyblock.
* g10: Don't skip legacy keys if the search mode is KEYDB_SEARCH_MODE_NEXTNeal H. Walfield2015-09-161-1/+2
| | | | | | | | | | | | | * g10/getkey.c (lookup): Also don't skip legacy keys if the search mode is KEYDB_SEARCH_MODE_NEXT. -- Signed-off-by: Neal H. Walfield <[email protected]>. We currently don't skip keys if the search mode is KEYDB_SEARCH_MODE_FIRST. Since we change KEYDB_SEARCH_MODE_FIRST to KEYDB_SEARCH_MODE_NEXT (to avoid a reset), it only makes sense to have the same semantics for KEYDB_SEARCH_MODE_NEXT.
* g10: Remove unused function get_seckeyblock_byfprint.Neal H. Walfield2015-09-161-29/+0
| | | | | | | | * g10/keydb.h (get_seckeyblock_byfprint): Remove prototype. * g10/getkey.c (get_seckeyblock_byfprint): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Remove unused function get_seckey_byfprint.Neal H. Walfield2015-09-161-36/+0
| | | | | | | | * g10/keydb.h (get_seckey_byfprint): Remove prototype. * g10/getkey.c (get_seckey_byfprint): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Simplify get_seckey_byname: it was never called with NAME not NULL.Neal H. Walfield2015-09-161-7/+2
| | | | | | | | | | | | * g10/keydb.h (get_seckey_byname): Rename from this... (get_seckey_default): ... to this. Drop the parameter name. Update users. * g10/getkey.c (get_seckey_byname): Rename from this... (get_seckey_default): ... to this. Drop the parameter name. Drop the code which assumed that NAME is not NULL. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Eliminate the redundant function get_keyblock_byfprint.Neal H. Walfield2015-09-161-30/+0
| | | | | | | | | * g10/keydb.h (get_keyblock_byfprint): Remove prototype. Replace use of this function with get_pubkey_byfprint. * g10/getkey.c (get_pubkey_byname): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Simplify semantics of get_pubkey_byname.Neal H. Walfield2015-09-161-8/+6
| | | | | | | | | | | * g10/getkey.c (get_pubkey_byname): If R_KEYBLOCK is not NULL, return the keyblock in R_KEYBLOCK independent of whether PK is set or not. -- Signed-off-by: Neal H. Walfield <[email protected]>. Currently, no caller invokes get_pubkey_byname with PK==NULL and R_KEYBLOCK != NULL. Thus, this change does not change any behavior.
* g10: Eliminate the redundant function get_pubkey_byname.Neal H. Walfield2015-09-161-30/+2
| | | | | | | | * g10/getkey.c (get_pubkey_byname): Remove function. (lookup): Replace use of get_pubkey_byname by get_pubkey_byfprint. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Eliminate the redundant function get_pubkey_end.Neal H. Walfield2015-09-161-19/+12
| | | | | | | | | * g10/keydb.h (get_pubkey_end): Remove declaration. Replace use of function with getkey_end. * g10/getkey.c (get_pubkey_byname): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Eliminate the redundant function get_pubkey_next.Neal H. Walfield2015-09-161-6/+0
| | | | | | | | | | * g10/keydb.h (get_pubkey_next): Remove prototype. * g10/getkey.c (get_pubkey_next): Remove function. * g10/keylist.c (locate_one): Use getkey_next instead of get_pubkey_next. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* kbx: Change skipfnc's prototype so that we can provide all information.Neal H. Walfield2015-09-161-10/+21
| | | | | | | | | | | | | | | | * kbx/keybox-search-desc.h (struct keydb_search_desc.skipfnc): Change third parameter to be the index of the user id packet in the keyblock rather than the packet itself. Update users. -- Signed-off-by: Neal H. Walfield <[email protected]>. The keybox code doesn't work directly with keyblocks. As such, the matched user packet is not readily available to pass to DESC[n].SKIPFNC. But, we do know the index of the user id packet that matched. Thus, pass that instead. If the skip function needs the user id packet, it can use the key id to look up the key block and find the appropriate packet.
* g10: Remove unused function (get_pubkey_bynames).Neal H. Walfield2015-09-161-16/+1
| | | | | | | | * g10/keydb.h (get_pubkey_bynames): Remove prototype. * g10/getkey.c (get_pubkey_bynames): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Simplify code. Turn struct getkey_ctx_s.found_key into an argumentNeal H. Walfield2015-09-161-30/+48
| | | | | | | | | | | | | * g10/getkey.c (struct getkey_ctx_s): Remove field found_key. (lookup): Add argument ret_found_key. If not NULL, set it to the found key. Update callers. (pk_from_block): Add argument found_key. Use it instead of CTX->FOUND_KEY. Update callers. (finish_lookup): Return a KBNODE (the found key) instead of an int. Don't set CTX->FOUND_KEY. Return the found key instead. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Remove unused field struct getkey_ctx_s.kbpos.Neal H. Walfield2015-09-161-2/+0
| | | | | | | | * g10/getkey.c (struct getkey_ctx_s): Remove field kbpos. (getkey_end): Don't clear CTX->KBPOS. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* g10: Simplify code: remove field struct getkey_ctx_s.keyblock.Neal H. Walfield2015-09-161-13/+12
| | | | | | | | | | * g10/getkey.c (struct getkey_ctx_s): Remove field keyblock. (finish_lookup): Add parameter keyblock. Update caller to pass this. (lookup): Add new local variable keyblock. Use this instead of ctx->keyblock for referencing the keyblock. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* doc: Minor comment fixes.Werner Koch2015-09-091-5/+6
| | | | --
* g10: Remove unused field req_algo.Neal H. Walfield2015-09-021-4/+0
| | | | | | | | | | * g10/packet.h (PKT_public_key): Remove unused field req_algo. Remove users. * g10/getkey.c (struct getkey_ctx_s): Remove unused field req_algo. Remove users. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common: Don't assume on-disk layout matches in-memory layout.Neal H. Walfield2015-08-211-2/+2
| | | | | | | | | | | * g10/packet.h (PKT_signature): Change revkey's type from a struct revocation_key ** to a struct revocation_key *. Update users. -- revkey was a pointer into the raw data. But, C doesn't guarantee that there is no padding. Thus, we copy the data. Signed-off-by: Neal H. Walfield <[email protected]>.
* gpg: Properly handle legacy keys while looking for a secret key.Werner Koch2015-08-041-1/+8
| | | | | | | | | | * g10/getkey.c (have_secret_key_with_kid): Skip legacy keys. -- This fixes GnuPG-bug-id: 2031 Signed-off-by: Werner Koch <[email protected]>