aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* kbx: Fix error code return in keyboxd.switch-to-gpgkWerner Koch2019-09-272-2/+6
| | | | | | | | * kbx/frontend.c (kbxd_add_resource): Print a diagnostic on error. * kbx/backend-kbx.c (be_kbx_add_resource): Acttually returh the error code. Signed-off-by: Werner Koch <[email protected]>
* kbx: Store the UBIB in the blob.Werner Koch2019-09-273-12/+78
| | | | | | | | | | | | | | | * kbx/keybox-blob.c (create_blob_header): New blob flag UBIB. (create_blob_finish): Write the UBIB. * kbx/keybox-dump.c (print_ubib): New. (_keybox_dump_blob): Print UBIB flag. * kbx/keybox-search.c (has_ubid): Compare the stored UBIB if available. -- This make scanning the keybox for a given UBIB much faster once it has been stored. Signed-off-by: Werner Koch <[email protected]>
* kbx,gpg: Allow lookup using a UBID.Werner Koch2019-09-277-7/+64
| | | | | | | | | | | | * common/userids.c (classify_user_id): Detect UBIDs. * kbx/backend-cache.c (blob_table_put): Store the public key type. (be_cache_search): Add search mode for UBIDs. * kbx/backend.h (struct db_request_part_s): Add cache.seqno_ubid. * g10/keydb.c (keydb_search_desc_dump): Fix printing of keygrip. Add ubid printing. * g10/call-keyboxd.c (keydb_search): Support search by UBID. Signed-off-by: Werner Koch <[email protected]>
* kbx: First take on a cache for the keyboxd.Werner Koch2019-09-279-44/+1420
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kbx/backend.h (enum database_types): Add DB_TYPE_CACHE. (struct db_request_part_s): Add seqno fields. (struct db_request_s): Add infos for the cache backend. * kbx/backend-support.c (struct backend_handle_s): Add 'backend_id'. (strdbtype): Support DB_TYPE_CACHE. (be_generic_release_backend): Ditto. (be_find_request_part): New. (be_return_pubkey): New arg UBID and chnage status name. * kbx/backend-cache.c: New. * kbx/backend-kbx.c (be_kbx_init_request_part): New. (be_kbx_search): Factor some code out to a support function. (be_kbx_seek): New. * kbx/frontend.c (kbxd_add_resource): Support DB_TYPE_CACHE. (kbxd_search): Support the NEXR operation with the cache. * kbx/keybox-search-desc.h (KEYDB_SEARCH_MODE_UBID): New. (struct keydb_search_desc): Add field u.ubid. * kbx/keybox-search.c (has_ubid): New. (keybox_search): Support the UBID search. -- This adds a caching backend to the keyboxd. This tries to accommodate for duplicate use of fingerprints and thus be correct in case a fingerprint is used in several keys. It also turned out that we need to have a unique identifier (UBID) to identify a keyblock or X.509 certificate. In particular with an OpenPGP keyblob we can't easily use the primary fingerprint as an identifier because that fingerprint may also be used as subkey in another key. Thus using a hash of the entire keyblock is a better identifier to be used to address a keyblock for restarting a search or for identifying the keyblock to be updated. Note that this new UBID is not a permanent identifier because it changes with all keyblock update; it should be viewed as a handle to the keyblock or X509 cert.
* doc: Minor doc updates and a typo fix.Werner Koch2019-09-252-8/+8
| | | | --
* tests: Add two user-id parsing test cases.Werner Koch2019-09-171-0/+6
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* gpg: First rough implementation of keyboxd access for key lookup.Werner Koch2019-09-106-104/+380
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/Makefile.am: Add nPth flags. * g10/gpg.c: Include npth.h. (gpg_deinit_default_ctrl): Deinit call-keyboxd local data. (main): Init nPth. * g10/keydb-private.h (struct keydb_handle_s): Add field 'kbl' and remove the search result and the assuan context. * g10/call-keyboxd.c (struct keyboxd_local_s): Add more fields. (lock_datastream, unlock_datastream): New. (gpg_keyboxd_deinit_session_data): Adjust for changed data structures. (prepare_data_pipe): New. (open_context): Return kbl instead of an Assuan context. Init mutexes etc. (close_context): Merge into ... (keydb_release): here. Adjust for changed data structures. (datastream_thread): New. (keydb_get_keyblock): Implement datastream stuff. (keydb_search): Ditto. * common/asshelp.c (wait_for_sock): Add arg connect_flags. (start_new_service): Set FDPASSING flag for the keyboxd. -- This code as a lot of rough edges, in particular it relies on a well behaving keyboxd. We need to add code to shutdown the datastream reader thread in case of errors and to properly get it up again. We also need to make really sure that both threads run in lockstep so that the datastream thread is only active while we are sending a command to the keyboxd. We should also see whether we can depend nPth initialization on the --use-keyboxd option to avoid any problems with nPth. And we need to test on Windows. Signed-off-by: Werner Koch <[email protected]>
* kbx: Allow fd-passing for the keyboxd.Werner Koch2019-09-102-6/+109
| | | | | | | | | | | | | | | * kbx/kbxserver.c: Include host2net.h (struct server_local_s): Add field outstream. (prepare_outstream): New. (kbxd_writen): New. (kbxd_write_data_line): Write to file descrptor. Disable the slow human reader friendly data line formatting. (cmd_search, cmd_next): Disable data logging. (kbxd_start_command_handler): Add OUTPUT command. * kbx/keyboxd.c (main): Enable log monitor. -- Signed-off-by: Werner Koch <[email protected]>
* common: Allow a readlimit for iobuf_esopen.Werner Koch2019-09-104-6/+41
| | | | | | | | | | | | | | * common/iobuf.c (file_es_filter_ctx_t): Add fields use_readlimit and readlimit. (file_es_filter): Implement them. (iobuf_esopen): Add new arg readlimit. * g10/decrypt-data.c (decrypt_data): Adjust for change. * g10/import.c (import_keys_es_stream): Ditto. -- This comes handy for (length,datablob) style streams. Signed-off-by: Werner Koch <[email protected]>
* gpg: New option --use-keyboxd.Werner Koch2019-09-0926-292/+1221
| | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (oUseKeyboxd,oKeyboxdProgram): New consts. (opts): New options --use-keyboxd and --keyboxd-program. (main): Implement them. * g10/keydb.c: Move some defs out to ... * g10/keydb-private.h: new file. * g10/keydb.c: prefix function names with "internal" and move original functions to ... * g10/call-keyboxd.c: new file. Divert to the internal fucntion if --use-keyboxd is used. Add a CTRL arg to most fucntions and change all callers. * g10/Makefile.am (common_source): Add new files. (noinst_PROGRAMS): Do bot build gpgcompose. -- Note that this is just the framework with only a basic implementation of searching via keyboxd. Signed-off-by: Werner Koch <[email protected]>
* kbx: Fix keyboxd search first.Werner Koch2019-09-091-3/+17
| | | | | | | * kbx/kbxserver.c (cmd_next): Switch to mode next if needed. -- Signed-off-by: Werner Koch <[email protected]>
* kbx: Allow searching from start.Werner Koch2019-09-092-12/+24
| | | | | | | * kbx/kbxserver.c (cmd_search): Detect empty pattern. -- Signed-off-by: Werner Koch <[email protected]>
* kbx: Add framework for the SEARCH commandWerner Koch2019-08-0613-34/+1237
| | | | | | | | | | | | | | * kbx/backend-kbx.c: New. * kbx/backend-support.c: New. * kbx/backend.h: New. * kbx/frontend.c: New. * kbx/frontend.h: New. * kbx/kbxserver.c: Implement SEARCH and NEXT command. * kbx/keybox-search-desc.h (enum pubkey_types): New. * kbx/keybox-search.c (keybox_get_data): New. * kbx/keyboxd.c (main): Add a standard resource. Signed-off-by: Werner Koch <[email protected]>
* kbx: Allow writing using a estream.Werner Koch2019-08-065-10/+19
| | | | | | | * kbx/keybox-file.c (_keybox_write_header_blob): New optional arg stream. Change callers. Signed-off-by: Werner Koch <[email protected]>
* tools: New option --keyboxd for gpg-connect-agent.Werner Koch2019-08-067-13/+111
| | | | | | | | | | | | | | | | | | | | | | | * configure.ac: New option --keyboxd-pgm. (KEYBOXD_NAME, KEYBOXD_DISP_NAME): New ac_defines. * common/util.h: Add substitutes for new error codes. (GNUPG_MODULE_NAME_KEYBOXD): New. * common/homedir.c (gnupg_module_name): Support GNUPG_MODULE_NAME_KEYBOXD. * common/asshelp.c (SECS_TO_WAIT_FOR_KEYBOXD): New. (wait_for_sock): Support keyboxd. (start_new_service): Ditto. (start_new_keyboxd): New. * tools/gpg-connect-agent.c: New options --keyboxd and --keyboxd-program. (start_agent): Implement new option. -- This change allows us to test the new keyboxd using our standard helper. It also provides the necessary code to start keyboxd on the fly. Signed-off-by: Werner Koch <[email protected]>
* common: Remove code duplication for service starting.Werner Koch2019-08-052-148/+113
| | | | | | | | | | | | | * common/homedir.c (gpg_agent_socket_name): New. * common/asshelp.c (start_new_service): New. Based on start_new_gpg_agent. (start_new_gpg_agent): Divert to start_new_service. (start_new_dirmngr): Ditto. -- This prepares for adding yet another service starting function. Signed-off-by: Werner Koch <[email protected]>
* common: Change yet unused status_printf function.Werner Koch2019-08-022-2/+23
| | | | | | | | | | | | * common/asshelp2.c (status_printf): Rename to status_no_printf. (status_printf): New. -- Using the the status identifier from status.h is a good idea for the external API but for some inter-component status line a keyword is a better way. Signed-off-by: Werner Koch <[email protected]>
* Merge branch 'master' into switch-to-gpgkWerner Koch2019-07-12142-2992/+7854
|\
| * scd: Remove useless GNUPG_SCD_MAIN_HEADER macro.Werner Koch2019-07-123-16/+7
| | | | | | | | | | | | | | | | | | * scd/apdu.c (): Remove never set and useless macro. * scd/ccid-driver.c: Ditto. * scd/iso7816.c: Ditto. -- Signed-off-by: Werner Koch <[email protected]>
| * doc: Dependencies for figures are only for maintainers.NIIBE Yutaka2019-07-121-0/+2
| | | | | | | | | | | | | | | | * doc/Makefile.am [MAINTAINER_MODE] (.svg.eps, etc.): Enable only when maintainer-mode. GnuPG-bug-id: 4280 Signed-off-by: NIIBE Yutaka <[email protected]>
| * Fix a reference in comment.NIIBE Yutaka2019-07-121-1/+1
| | | | | | | | | | | | * common/openpgp-s2k.c: Fix. Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: Don't try decryption by session key when NULL.NIIBE Yutaka2019-07-121-3/+6
| | | | | | | | | | | | | | | | | | * g10/mainproc.c (proc_encrypted): Only call get_session_key when PKENC_LIST is not NULL. Return GPG_ERR_BAD_KEY, instead of GPG_ERR_NO_SECKEY, when it's encrypted only by symmetric key. Signed-off-by: NIIBE Yutaka <[email protected]>
| * agent: Relax the handling of pinentry error for keyboard grab.NIIBE Yutaka2019-07-111-1/+11
| | | | | | | | | | | | | | | | * agent/call-pinentry.c (start_pinentry): It's not fatal when pinentry doesn't support no-grab/grab option. GnuPG-bug-id: 4587 Signed-off-by: NIIBE Yutaka <[email protected]>
| * scd: Fix internal CCID driver, so that -DTEST works.NIIBE Yutaka2019-07-111-42/+55
| | | | | | | | | | | | * scd/ccid-driver.c: Support a test program by ccid-driver. Signed-off-by: NIIBE Yutaka <[email protected]>
| * scd: Fix debug logging of the internal CCID driver.NIIBE Yutaka2019-07-111-4/+9
| | | | | | | | | | | | | | * scd/ccid-driver.c [GNUPG_MAJOR_VERSION] (DEBUGOUT): Use log_debug. Fixes-commit: 79c99921e35921140c83d7c101829d95f038f3da Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: Fix getting User ID.NIIBE Yutaka2019-07-113-83/+88
| | | | | | | | | | | | | | | | | | | | | | * g10/getkey.c (user_id_db): Remove, as no use anymore. (get_user_id_string): Use cache_get_uid_bykid. (get_user_id_byfpr): Use cache_get_uid_byfpr. * g10/objcache.c (cache_get_uid_byfpr): New. * g10/objcache.h (cache_get_uid_byfpr): New. Fixes-commit: 64a5fd37271a3e454c0d59ac3500e1a1b232e4f7 Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: Improve import slowness.NIIBE Yutaka2019-07-101-5/+13
| | | | | | | | | | | | | | * g10/import.c (read_block): Avoid O(N^2) append. (sec_to_pub_keyblock): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: Fix keyring retrieval.NIIBE Yutaka2019-07-101-3/+6
| | | | | | | | | | | | | | * g10/keyring.c (keyring_get_keyblock): Avoid O(N^2) append. GnuPG-bug-id: 4592 Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: Do not try the import fallback if the options are already used.Werner Koch2019-07-091-1/+3
| | | | | | | | | | | | * g10/import.c (import_one): Check options. Signed-off-by: Werner Koch <[email protected]>
| * gpg: Fix regression in option "self-sigs-only".Werner Koch2019-07-091-1/+11
| | | | | | | | | | | | | | | | | | | | * g10/import.c (read_block): Make sure KEYID is availabale also on a pending packet. -- Reported-by: Phil Pennock Fixes-commit: 2e349bb6173789e0e9e42c32873d89c7bc36cea4 Signed-off-by: Werner Koch <[email protected]>
| * sm: Fix card access.NIIBE Yutaka2019-07-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | * sm/call-agent.c (gpgsm_scd_pksign): Cast to integer for %b. -- This fix is needed on big endian machine where size_t is bigger than integer. Signed-off-by: NIIBE Yutaka <[email protected]>
| * scd: ccid-driver: Initial getting ATR more robustly.NIIBE Yutaka2019-07-091-18/+39
| | | | | | | | | | | | | | | | | | * scd/ccid-driver.c (send_power_off): New. (do_close_reader): Use send_power_off. (ccid_get_atr): Add error recovery. GnuPG-bug-id: 4616 Signed-off-by: NIIBE Yutaka <[email protected]>
| * scd: Fix keygrip search.NIIBE Yutaka2019-07-081-1/+3
| | | | | | | | | | | | | | * scd/app.c (app_do_with_keygrip): Break the entire loop. Fixes-commit: 5a5288d051a551a1a8f169225e62572f6ee8cb10 Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: With --auto-key-retrieve prefer WKD over keyservers.Werner Koch2019-07-053-57/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/mainproc.c (check_sig_and_print): Print a hint on how to make use of the preferred keyserver. Remove keyserver lookup just by the keyid. Try a WKD lookup before a keyserver lookup. -- The use of the the keyid for lookups does not make much sense anymore since for quite some time we do have the fingerprint as part of the signature. GnuPG-bug-id: 4595 Signed-off-by: Werner Koch <[email protected]>
| * wkd: Change client/server limit back to 64 KiBWerner Koch2019-07-051-1/+1
| | | | | | | | | | | | | | | | | | * tools/wks-receive.c (decrypt_data): Change limit. -- The former limit ~1MiB of was used during development. Signed-off-by: Werner Koch <[email protected]>
| * sm: Return the last error for pubkey decryption.NIIBE Yutaka2019-07-051-6/+8
| | | | | | | | | | | | | | | | | | | | * sm/decrypt.c: Use TMP_RC for ksba_cms_get_issuer_serial, and return the last error when no key is available. Fix the error report with TMP_RC for second call of ksba_cms_get_issuer_serial. GnuPG-bug-id: 4561 Signed-off-by: NIIBE Yutaka <[email protected]>
| * gpg: Return the last error for pubkey decryption.NIIBE Yutaka2019-07-052-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | * g10/mainproc.c (proc_encrypted): Check ->result against -1. When c->dek == NULL, put GPG_ERR_NO_SECKEY only when not set. * g10/pubkey-enc.c (get_session_key): Set k->result by the result of get_it. When no secret key is available for some reasons, return the last specific error, if any. GnuPG-bug-id: 4561 Signed-off-by: NIIBE Yutaka <[email protected]>
| * dirmngr: fix handling of HTTPS redirections during HKPDaniel Kahn Gillmor2019-07-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * dirmngr/ks-engine-hkp.c (send_request): Reinitialize HTTP session when following a HTTP redirection. -- inspired by patch from Damien Goutte-Gattat <[email protected]> GnuPG-Bug_id: 4566 Signed-off-by: Daniel Kahn Gillmor <[email protected]> Originally applied to 2.2. Here a minor conflict fix was needed.
| * gpg: Add "self-sigs-only" and "import-clean" to the keyserver options.Werner Koch2019-07-042-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (main): Change default. -- Due to the DoS attack on the keyeservers we do not anymore default to import key signatures. That makes the keyserver unsuable for getting keys for the WoT but it still allows to retriev keys - even if that takes long to download the large keyblocks. To revert to the old behavior add keyserver-optiions no-self-sigs-only,no-import-clean to gpg.conf. GnuPG-bug-id: 4607 Signed-off-by: Werner Koch <[email protected]>
| * gpg: Avoid printing false AKL error message.Werner Koch2019-07-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/getkey.c (get_pubkey_byname): Add special traeatment for default and skipped-local. -- This change avoids error message like gpg: error retrieving '[email protected]' via None: No public key A 'None' mechanism is something internal. Signed-off-by: Werner Koch <[email protected]>
| * gpg: New command --locate-external-key.Werner Koch2019-07-047-32/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (aLocateExtKeys): New. (opts): Add --locate-external-keys. (main): Implement that. * g10/getkey.c (get_pubkey_byname): Implement GET_PUBKEY_NO_LOCAL. (get_best_pubkey_byname): Add arg 'mode' and pass on to get_pubkey_byname. Change callers. * g10/keylist.c (public_key_list): Add arg 'no_local'. (locate_one): Ditto. Pass on to get_best_pubkey_byname. -- This new command is a shortcut for --auto-key-locate nodefault,clear,wkd,... --locate-key and uses the default or configured AKL list but does so without local. See also GnuPG-bug-id: 4599 Signed-off-by: Werner Koch <[email protected]>
| * gpg: Make the get_pubkey_byname interface easier to understand.Werner Koch2019-07-046-32/+57
| | | | | | | | | | | | | | | | | | | | | | * g10/keydb.h (enum get_pubkey_modes): New. * g10/getkey.c (get_pubkey_byname): Repalce no_akl by a mode arg and change all callers. -- This change prepares the implementation of GET_PUBKEY_NO_LOCAL. Signed-off-by: Werner Koch <[email protected]>
| * dirmngr: Avoid endless loop in case of HTTP error 503.Werner Koch2019-07-031-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dirmngr/ks-engine-hkp.c (SEND_REQUEST_EXTRA_RETRIES): New. (handle_send_request_error): Use it for 503 and 504. (ks_hkp_search, ks_hkp_get, ks_hkp_put): Pass a new var for extra_tries. -- This is a pretty stupid fix but one which works without much risk of regressions. We could have used the existing TRIES but in that case the fallback to other host would have been too limited. With the used value we can have several fallbacks to other hosts. Note that the TRIES is still cumulative and not per host. GnuPG-bug-id: 4600 Signed-off-by: Werner Koch <[email protected]>
| * dirmngr: Do not rewrite the redirection for the "openpgpkey" subdomain.Werner Koch2019-07-031-0/+20
| | | | | | | | | | | | | | | | | | * dirmngr/http.c (same_host_p): Consider certain subdomains to be the same. -- GnuPG-bug-id: 4603 Signed-off-by: Werner Koch <[email protected]>
| * Mention --sender in documentationPeter Lebbing2019-07-021-5/+5
| |
| * gpg: Fallback to import with self-sigs-only on too large keyblocks.Werner Koch2019-07-011-21/+102
| | | | | | | | | | | | | | | | | | | | | | * g10/import.c (import_one): Rename to ... (import_one_real): this. Do not print and update stats on keyring write errors. (import_one): New. Add fallback code. -- GnuPG-bug-id: 4591 Signed-off-by: Werner Koch <[email protected]>
| * gpg: New import and keyserver option "self-sigs-only"Werner Koch2019-07-013-3/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/options.h (IMPORT_SELF_SIGS_ONLY): New. * g10/import.c (parse_import_options): Add option "self-sigs-only". (read_block): Handle that option. -- This option is intended to help against importing keys with many bogus key-signatures. It has obvious drawbacks and is not a bullet-proof solution because a self-signature can also be faked and would be detected only later. GnuPG-bug-id: 4591 Signed-off-by: Werner Koch <[email protected]>
| * gpg: Make read_block in import.c more flexible.Werner Koch2019-07-011-12/+11
| | | | | | | | | | | | | | | | | | * g10/import.c: Change arg 'with_meta' to 'options'. Change callers. -- This chnage allows to pass more options to read_block. Signed-off-by: Werner Koch <[email protected]>
| * tools: gpgconf: Killing order is children-first.NIIBE Yutaka2019-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tools/gpgconf-comp.c (gc_component_kill): Reverse the order. -- The order matters in a corner case; On a busy machine, there was a race condition between gpg-agent's running KILLAGENT command and its accepting incoming request on the socket. If a request by gpg-connect-agent was accepted, it resulted an error by sudden shutdown. This change of the order can remove such a race. Here, we know backend=0 is none. GnuPG-bug-id: 4577 Signed-off-by: NIIBE Yutaka <[email protected]>
| * agent: Close a dialog cleanly when gpg/ssh is killed for CONFIRM.NIIBE Yutaka2019-06-281-22/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/call-pinentry.c (watch_sock_start): Factor out from do_getpin. (watch_sock_end): Likewise. (do_getpin): Use those functions. (agent_get_confirmation): Likewise. (popup_message_thread): Likewise. -- Pinentry's dialog for confirmation should be also closed cleanly, as well as the dialog for pin-input. Signed-off-by: NIIBE Yutaka <[email protected]>