aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* gpg: Fix endless loop for expired keys given by fpr.Werner Koch2015-07-311-0/+5
| | | | | | | | | | * g10/getkey.c (lookup): Disable keydb caching when continuing a search. -- Caches are Fierce Creatures. Reported-by: Patrick Brunschwig
* gpg: Do not return "Legacy Key" from lookup if a key is expired.Werner Koch2015-07-291-1/+2
| | | | | | | | | | | | * g10/getkey.c (lookup): Map GPG_ERR_LEGACY_KEY. -- If an expired key is directly followed by a legacy key in the keyring, the lookup function incorrectly returned "legacy key" instead of "unusable key". We fix it by handling not found identical to a legacy key if the last finish lookup failed. Signed-off-by: Werner Koch <[email protected]>
* Don't segfault if the first 'auto-key-locate' option is 'clear'.Neal H. Walfield2015-07-161-0/+3
| | | | | | | | | * g10/getkey.c (free_akl): If AKL is NULL, just return. -- Signed-off-by: Neal H. Walfield <[email protected]>. Reported-by: Sami Farin. GnuPG-bug-id: 2045
* gpg: Improve 'General key info' line of --card-status.Werner Koch2015-05-071-3/+19
| | | | | | | | | | | | | | | | | * g10/keylist.c (print_pubkey_info): Print either "pub" or "sub". * g10/getkey.c (get_pubkey_byfprint): Add optional arg R_KEYBLOCK. * g10/keyid.c (keyid_from_fingerprint): Adjust for change. * g10/revoke.c (gen_desig_revoke): Adjust for change. * g10/card-util.c (card_status): Simplify by using new arg. Align card-no string. * g10/card-util.c (card_status): Remove not used GnuPG-1 code. -- This now prints "sub" if the first used card key is actually a subkey. Signed-off-by: Werner Koch <[email protected]>
* gpg: Merge duplicated code for get_user_id et al.Werner Koch2015-04-061-57/+45
| | | | | | | | | * g10/getkey.c (get_user_id_string): Add args mode and r_LEN. (get_user_id_string_native): Add new args. (get_long_user_id_string, get_user_id): Rewrite using get_user_id_string. Signed-off-by: Werner Koch <[email protected]>
* Fix use of DBG_CACHE and DBG_LOOKUPWerner Koch2015-04-061-16/+16
| | | | | | * dirmngr/dirmngr.h (DBG_LOOKUP_VALUE): Change to 8192. * g10/options.h (DBG_LOOKUP_VALUE, DBG_LOOKUP): New. * g10/getkey.c: Use DBG_LOOKUP instead of DBG_CACHE at most places.
* gpg: Switch to a hash and CERT record based PKA system.Werner Koch2015-02-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/dns-cert.c (get_dns_cert): Make r_key optional. * common/pka.c: Rewrite for the new hash based lookup. * common/t-pka.c: New. * configure.ac: Remove option --disable-dns-pka. (USE_DNS_PKA): Remove ac_define. * g10/getkey.c (parse_auto_key_locate): Always include PKA. -- Note that although PKA is now always build, it will only work if support for looking up via DNS has not been disabled. The new PKA only works with the IPGP DNS certtype and shall be used only to retrieve the fingerprint and optional the key for the first time. Due to the security problems with DNSSEC the former assumption to validate the key using DNSSEC is not anymore justified. Instead an additional layer (e.g. Trust-On-First-Use) needs to be implemented to track change to the key. Having a solid way of getting a key matching a mail address is however a must have. More work needs to go into a redefinition of the --verify-options pka-lookups and pka-trust-increase. The auto-key-locate mechanism should also be able to continue key fetching with another methods once the fingerprint has been retrieved with PKA. Signed-off-by: Werner Koch <[email protected]>
* Move new mailbox.c source file to common/.Werner Koch2015-02-251-1/+1
| | | | | | | | | | | * g10/mailbox.c: Move to ... * common/mbox-util.c: new file. * common/mbox-util.h: New. Include where needed. * g10/t-mailbox.c: Move to ... * common/t-mbox-util.c: new file. -- This will make it easier to use the code by other modules in common/.
* gpg: Skip legacy keys while searching keyrings.Werner Koch2015-02-231-2/+37
| | | | | | | | | * g10/getkey.c (search_modes_are_fingerprint): New. (lookup): Skip over legacy keys. -- GnuPG-bug-id: 1847 Signed-off-by: Werner Koch <[email protected]>
* gpg: Replace remaining uses of stdio by estream.Werner Koch2015-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * g10/sign.c (sign_file): Use log_printf instead of stderr. * g10/tdbdump.c (export_ownertrust): Use estream fucntions. (import_ownertrust): Ditto. * g10/tdbio.c (tdbio_dump_record): Ditto. Change arg to estream_t. -- Reported-by: Guilhem Moulin <[email protected]> Needed for unattended key edits with --status-fd, because since 2.1 status prompts are preceded by es_fflush (in cpr.c:do_get_from_fd) not fflush(3), so the standard output may not be flushed before each prompt. (Which breaks scripts using select(2) to multiplex between the standard and status outputs.) His patch only affected print_and_check_one_sig_colon() but there are many more places where stdio and estream are mixed. This patch now replaces most of them in g10/. At some places stdio is still used, but that is local to a function and should not have side effects. Signed-off-by: Werner Koch <[email protected]>
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-111-6/+8
| | | | | | | | | | | | | | | * common/host2net.h (buf16_to_ulong, buf16_to_uint): New. (buf16_to_ushort, buf16_to_u16): New. (buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New. -- Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to avoid all sign extension on shift problems. Hanno Böck found a case with an invalid read due to this problem. To fix that once and for all almost all uses of "<< 24" and "<< 8" are changed by this patch to use an inline function from host2net.h. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add dedicated error code for PGP-2 keys.Werner Koch2015-01-221-3/+2
| | | | | | | | | | | | * g10/parse-packet.c (parse_key): Return GPG_ERR_LEGACY_KEY for PGP2 keys. * g10/import.c (read_block): Simplify by checking GPG_ERR_LEGACY_KEY. * g10/getkey.c (lookup): Silence error message for PGP-2 keys. * common/util.h (GPG_ERR_LEGACY_KEY): Add replacement for older libgpg-error. Signed-off-by: Werner Koch <[email protected]>
* gpg: Replace remaining old error code macros by GPG_ERR_.Werner Koch2015-01-221-23/+26
| | | | | | | | | * g10/gpg.h (g10_errstr): Remove macro and change all occurrences by gpg_strerror. (G10ERR_): Remove all macros and change all occurrences by their GPG_ERR_ counterparts. Signed-off-by: Werner Koch <[email protected]>
* gpg: Remove an unused variable.Werner Koch2015-01-221-2/+0
| | | | * g10/getkey.c (getkey_ctx_s): Remove last_rc.
* gpg: Remove unused args from a function.Werner Koch2015-01-051-1/+1
| | | | | | | * g10/keyserver.c (parse_keyserver_uri): Remove args configname and configlineno. Change all callers. Signed-off-by: Werner Koch <[email protected]>
* gpg: Fix endless loop in keylisting with fingerprint.Werner Koch2014-11-021-0/+6
| | | | | | | * g10/getkey.c (getkey_next): Disable cache. -- Signed-off-by: Werner Koch <[email protected]>
* gpg: Minor cleanup for key listing related code.Werner Koch2014-11-021-16/+10
| | | | | | | | | * g10/getkey.c (get_pubkey_next): Divert to getkey_next. (get_pubkey_end): Move code to getkey_end. * g10/keydb.c (keydb_search_reset): Add a debug statement. (dump_search_desc): Add arg HD and print the handle. Signed-off-by: Werner Koch <[email protected]>