aboutsummaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common: Extend the openpgp_curve_to_oid function.Werner Koch2020-02-113-4/+13
| | | | | | | | | * common/openpgp-oid.c (openpgp_curve_to_oid): Add optional arg R_NBITS. Change all callers. -- In particular for ed25519 and cv25519 it is quite useful to have an ability to get the required algorithm.
* build: Always use EXTERN_UNLESS_MAIN_MODULE pattern.Werner Koch2020-02-103-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | * common/util.h (EXTERN_UNLESS_MAIN_MODULE): Add the definion only here but now without the Norcroft-C. Change all other places where it gets defined. * common/iobuf.h (iobuf_debug_mode): Declare unconditionally as extern. * common/iobuf.c (iobuf_debug_mode): Define it here. * agent/gpg-agent.c (INCLUDED_BY_MAIN_MODULE): Define here and also in all main modules of all other programs. * g10/main.h: Put util.h before the local header files. -- This change is required for use with gcc/ld's LTO feature which does not allow common blocks. Further gcc 10 will make -fno-common the default and thus this chnage is always needed. What a pitty. Co-authored-by: Tomáš Mráz GnuPG-bug-id: 4831 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 21d9bd8b87a9f793a106095e3838eb71825189d7) - Applied respective chnages also to gpg-card and keyboxd. Signed-off-by: Werner Koch <[email protected]>
* common: Extend the new get_keyalgo_string functionWerner Koch2020-02-092-5/+29
| | | | | | | | | | | | * common/openpgp-oid.c (openpgp_oid_or_name_to_curve): New. (get_keyalgo_string): Use it. -- We do not always have an OID, so except the name or the alias of the curve as well. This creates a second entry mapping to the same name but that does not matter. Signed-off-by: Werner Koch <[email protected]>
* common: Remove duplicated call to a function.Werner Koch2020-02-091-1/+0
| | | | | | | | | | * common/openpgp-oid.c (openpgp_oid_to_str): Remove duplicated call. -- The removed function was already called. No memleak etc, though. Fixes-commit: 4a1558d0c7190cf13d35385e47291a7aa121be3e Signed-off-by: Werner Koch <[email protected]>
* common: New function get_keyalgo_string.Werner Koch2020-02-093-2/+194
| | | | | | | | | | | | | | | | | * common/openpgp-oid.c (struct keyalgo_string_s): New. (keyalgo_strings): New. (keyalgo_strings_size, keyalgo_strings_used): New. (get_keyalgo_string): New. -- This function is intended as a more general version of gpg's pubkey_string function. It has the advantage to avoid mallocs and uses static table of algorithm strings instead. There should be only a few dozen of such strings (if at all) and thus all those allocations we do internally in gpg's pubkey_string and the static buffers all over the place are not too nice. Signed-off-by: Werner Koch <[email protected]>
* common: Add OpenPGP<->Gcrypt pubkey id mapping functions.Werner Koch2020-02-092-1/+37
| | | | | | | | | * g10/misc.c (map_pk_gcry_to_openpgp): Move to ... * common/openpgp-oid.c (map_gcry_pk_to_openpgp): here and rename. Change all 4 callers. (map_openpgp_pk_to_gcry): New. Signed-off-by: Werner Koch <[email protected]>
* gpgconf,w32: Print a warning for a suspicious homedir.Werner Koch2020-01-171-0/+3
| | | | | | | | * tools/gpgconf.c (list_dirs): Check whether the homedir has been taken from the registry. -- Signed-off-by: Werner Koch <[email protected]>
* gpg,sm: Avoid useless ASFW diagnostic in loopback mode.Werner Koch2020-01-132-0/+22
| | | | | | | | | | | * common/sysutils.c (inhibit_set_foregound_window): New var. (gnupg_inhibit_set_foregound_window): New func. (gnupg_allow_set_foregound_window): Use var. * g10/gpg.c (main): Inhibit in loopback mode. * sm/gpgsm.c (main): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
* scd: Use a scdaemon internal key to protect the PIN cache IPC.Werner Koch2020-01-091-1/+1
| | | | | | | | | | | | | | | | | | | * agent/call-scd.c (handle_pincache_put): Do not decrypt. (handle_pincache_get): New. (inq_needpin): Call it. * scd/command.c (set_key_for_pincache): New. (pincache_put): Restructure and set key. (pincache_get): Ditto. -- This change does away with encrypting and decrypting the cached PIN in the agent. There is no need for this we can simply cache the cryptogram and let scdaemon decrypt after retrieving it from the agent. This way we do not need to share a key between gpg-agent and scdaemon and further the cached content is invalid after the scdaemon process has been replaced. Signed-off-by: Werner Koch <[email protected]>
* doc: Typ fix in commentWerner Koch2019-12-231-1/+1
| | | | --
* kbx: Redefine the UBID which is now the primary fingerprint.Werner Koch2019-11-282-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/util.h (UBID_LEN): New. Use it at all places. * kbx/keybox-blob.c (create_blob_finish): Do not write the UBID item. * kbx/keybox-dump.c (print_ubib): Remove. (_keybox_dump_blob): Do not print the now removed ubid flag. * kbx/keybox-search-desc.h (struct keydb_search_desc): Use constants for the size of the ubid and grip. * kbx/keybox-search.c (blob_cmp_ubid): New. (has_ubid): Make it a simple wrapper around blob_cmp_ubid. (keybox_get_data): Add arg 'r_ubid'. * kbx/frontend.h (enum kbxd_store_modes): New. * kbx/kbxserver.c (cmd_store): Add new option --insert. * kbx/backend-cache.c (be_cache_initialize): New. (be_cache_add_resource): Call it here. * kbx/backend-kbx.c (be_kbx_seek): Remove args 'fpr' and 'fprlen'. (be_kbx_search): Get the UBID from keybox_get_data. * kbx/backend-support.c (be_fingerprint_from_blob): Replace by ... (be_ubid_from_blob): new. Change all callers. * kbx/frontend.c (kbxd_add_resource): Temporary disable the cache but use the new cache init function. (kbxd_store): Replace arg 'only_update' by 'mode'. Seek using the ubid. Take care of the mode. -- It turned out that using the hash of the entire blob was not helpful. Thus we redefine the Unique-Blob-ID (UBID) as the primary fingerprint of the blob. In case this is a v5 OpenPGP key a left truncated version of the SHA-256 hash is used; in all other cases the full SHA-1 hash. Using a SHA-256 hash does not make sense because v4 keys are and will for some time be the majority of keys and thus padding them with zeroes won't make any difference. Even if fingerprint collisions can eventually be created we will assume that the keys are bogus and that it does not make sense to store its twin also in our key storage. We can also easily extend the update code to detect a collision and reject the update. Signed-off-by: Werner Koch <[email protected]>
* common: New function hex2fixedbuf.Werner Koch2019-10-013-1/+71
| | | | | | | | | | * common/convert.c (hex2fixedbuf): New. -- This function is useful for converting hex strings received via assuan if they have a known length. For example keygrips or the new UBID. Signed-off-by: Werner Koch <[email protected]>
* Merge branch 'switch-to-gpgk' into masterWerner Koch2019-09-279-180/+312
|\ | | | | | | | | | | | | | | | | | | | | | | -- Resolved Conflicts: * common/asshelp.c: Keep the new code in master for spawing under Windows. * g10/Makefile.am: Keep all new file. * g10/photoid.c: Pass CTRL to pct_expando. Signed-off-by: Werner Koch <[email protected]>
| * kbx,gpg: Allow lookup using a UBID.Werner Koch2019-09-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | * 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]>
| * 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-101-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]>
| * common: Allow a readlimit for iobuf_esopen.Werner Koch2019-09-102-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]>
| * tools: New option --keyboxd for gpg-connect-agent.Werner Koch2019-08-064-9/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1210-27/+170
| |\
| * \ Merge branch 'master' into switch-to-gpgkWerner Koch2019-03-1836-246/+1166
| |\ \ | | | | | | | | | | | | --
| * | | common: New function status_printf.Werner Koch2018-09-052-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp2.c (set_assuan_context_func): New. (status_printf): New. * po/Makevars (XGETTEXT_OPTIONS): Add status_printf -- This is a first patch to unify the status printing functions. Signed-off-by: Werner Koch <[email protected]>
* | | | gpg: Prepare parser for the new attestation certificates.Werner Koch2019-09-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (SIGSUBPKT_ATTST_SIGS): New. * g10/keydb.h (IS_ATTST_SIGS): New. (IS_CERT): Include the new one. * g10/sign.c (mk_notation_policy_etc): Do not put notations into attestation key signatures. * g10/parse-packet.c (dump_sig_subpkt): Add new arg digest_algo. Print the attestation sigs. (parse_one_sig_subpkt): Support SIGSUBPKT_ATTST_SIGS. (can_handle_critical): Ditto. (enum_sig_subpkt): Pass digest algo to dump_sig_subpkt. -- This change allows to list the new subpacket with --list-packets. Example output: :signature packet: algo 22, keyid C694723A1370EAB1 version 4, created 1567097576, md5len 0, sigclass 0x16 digest algo 8, begin of digest ff 0c hashed subpkt 2 len 4 (sig created 2019-08-29) hashed subpkt 37 len 32 (attst-sigs: 1 A794C6E9CCFE2F34C67E07[...]) hashed subpkt 33 len 21 (issuer fpr v4 156A3872[...]) subpkt 16 len 8 (issuer key ID C694723A1370EAB1) data: [256 bits] data: [256 bits] GnuPG-bug-id: 4694 Signed-off-by: Werner Koch <[email protected]>
* | | | common: Fix line break handling, finding a space.NIIBE Yutaka2019-08-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | * common/name-value.c (assert_raw_value): Correctly find a space. Signed-off-by: NIIBE Yutaka <[email protected]>
* | | | common: Fix the previous commit.NIIBE Yutaka2019-07-241-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp.c [HAVE_W32_SYSTEM] (start_new_gpg_agent): Use gnupg_spawn_process_detached. (start_new_dirmngr): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* | | | common: Use gnupg_spawn_process_fd to invoke gpg-agent/dirmngr.NIIBE Yutaka2019-07-241-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp.c (start_new_gpg_agent): Call gnupg_spawn_process_fd and gnupg_wait_process. (start_new_dirmngr): Likewise. -- With --daemon option, gpg-agent/dirmngr detaches by itself. Signed-off-by: NIIBE Yutaka <[email protected]>
* | | | common,w32: Fix cast from gnupg_fd_t to call _open_osfhandle.NIIBE Yutaka2019-07-241-2/+2
| |_|/ |/| | | | | | | | | | | | | | | | | * common/sysutils.c (translate_sys2libc_fd): Use intptr_t. (gnupg_tmpfile): Likewise. 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: Allow deletion of subkeys with --delete-[secret-]key.Werner Koch2019-05-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/userids.c (classify_user_id): Do not set the EXACT flag in the default case. * g10/export.c (exact_subkey_match_p): Make static, * g10/delkey.c (do_delete_key): Implement subkey only deleting. -- GnuPG-bug-id: 4457
* | | common: New functions nvc_delete_named and nvc_get_string.Werner Koch2019-05-073-0/+65
| | | | | | | | | | | | | | | | | | | | | * common/name-value.c (nvc_delete_named): New. (nvc_get_string): New. Signed-off-by: Werner Koch <[email protected]>
* | | common: In private key mode write "Key:" always last in name-value.Werner Koch2019-05-031-13/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/name-value.c (nvc_write): Take care of Key. Factor some code out to ... (write_one_entry): new. -- The key item is in general not manual editable thus we put it at the end of a file. Signed-off-by: Werner Koch <[email protected]>
* | | common,w32: Breakaway detached childs when in jobAndre Heinecke2019-04-291-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/exechelp-w32.c (gnupg_spawn_process_detached): Add CREATE_BREAKAWAY_FROM_JOB creation flag if required. -- When the gpg process is assigned to a W32 "Job" the child processes are killed once the Job is finished. As we want our detached processes to linger e.g. gpg-agent the breakaway flag is required in that case. GnuPG-Bug-Id: T4333 Thanks to Jan Echternach for reporting this and providing a patch. Signed-off-by: Andre Heinecke <[email protected]>
* | | common: Fix AWK portability.NIIBE Yutaka2019-04-162-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/Makefile.am: Use pkg_namespace. * common/mkstrtable.awk: Use pkg_namespace. Regexp fix. -- GnuPG-bug-Bug: 4459 Signed-off-by: NIIBE Yutaka <[email protected]>
* | | common: Extend function pubkey_algo_string.Werner Koch2019-04-022-3/+8
| |/ |/| | | | | | | | | | | | | * common/sexputil.c (pubkey_algo_string): Add arg R_ALGOID. * sm/certreqgen-ui.c (gpgsm_gencertreq_tty): Adjust. * tools/gpg-card.c (list_one_kinfo): Ditto. Signed-off-by: Werner Koch <[email protected]>
* | kbx: Unify the fingerprint search modes.Werner Koch2019-03-141-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kbx/keybox-search-desc.h (KEYDB_SEARCH_MODE_FPR16) (KEYDB_SEARCH_MODE_FPR20, KEYDB_SEARCH_MODE_FPR32): Remove. Switch all users to KEYDB_SEARCH_MODE_FPR along with the fprlen value. -- These search modes were added over time and there has until recently be no incentive to remove the cruft. With the change for v5 keys I finally went over all places and allowed the generic fingerprint mode along with a given length of the fingerprint at all places. Consequently the other modes can now be removed. Signed-off-by: Werner Koch <[email protected]>
* | kbx: Add support for 32 byte fingerprints.Werner Koch2019-03-141-7/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/userids.c (classify_user_id): Support 32 byte fingerprints. * kbx/keybox-search-desc.h (KEYDB_SEARCH_MODE_FPR32): New. (struct keydb_search_desc): Add field fprlen. * kbx/keybox-defs.h (struct _keybox_openpgp_key_info): Add field version and increase size of fpr to 32. * kbx/keybox-blob.c: Define new version 2 for PGP and X509 blobs. (struct keyboxblob_key): Add field fprlen and increase size of fpr. (pgp_create_key_part_single): Allow larger fingerprints. (create_blob_header): Implement blob version 2 and add arg want_fpr32. (_keybox_create_openpgp_blob): Detect the need for blob version 2. * kbx/keybox-search.c (blob_get_first_keyid): Support 32 byte fingerprints. (blob_cmp_fpr): Ditto. (blob_cmp_fpr_part): Ditto. (has_fingerprint): Add arg fprlen and pass on. (keybox_search): Support KEYDB_SEARCH_MODE_FPR32 and adjust for changed has_fingerprint. * kbx/keybox-openpgp.c (parse_key): Support version 5 keys. * kbx/keybox-dump.c (_keybox_dump_blob): Support blob version 2. * g10/delkey.c (do_delete_key): Support KEYDB_SEARCH_MODE_FPR32. * g10/export.c (exact_subkey_match_p): Ditto. * g10/gpg.c (main): Ditto. * g10/getkey.c (get_pubkey_byfprint): Adjust for changed KEYDB_SEARCH_MODE_FPR. * g10/keydb.c (keydb_search_desc_dump): Support KEYDB_SEARCH_MODE_FPR32 and adjust for changed KEYDB_SEARCH_MODE_FPR. (keydb_search): Add new arg fprlen and change all callers. * g10/keyedit.c (find_by_primary_fpr): Ditto. * g10/keyid.c (keystr_from_desc): Ditto. * g10/keyring.c (keyring_search): Ditto. * g10/keyserver.c (print_keyrec): Ditto. (parse_keyrec): Ditto. (keyserver_export): Ditto. (keyserver_retrieval_screener): Ditto. (keyserver_import): Ditto. (keyserver_import_fprint): Ditto. (keyidlist): Ditto. (keyserver_get_chunk): Ditto. * g10/keydb.c (keydb_search): Add new arg fprlen and change all callers. * sm/keydb.c (keydb_search_fpr): Adjust for changed KEYDB_SEARCH_MODE_FPR. -- This prepares the support for OpenPGP v5 keys. The new version 2 blob format is needed for the longer fingerprints and we also use this opportunity to prepare for storing the keygrip in the blob for faster lookup by keygrip. Right now this is not yet functional. Signed-off-by: Werner Koch <[email protected]>
* | common: Minor rework of tty_get.Werner Koch2019-03-071-118/+142
| | | | | | | | | | | | | | | | | | | | | | | | * common/ttyio.c (do_get): Re-indent and remove the checking for char values larger than 0xa0. Use explicy control character checking. -- The code is really old (mid 1998) and with the checking for 0xa0 it has an implicit assumption of utf-8 or latin-1. Worse, the check was for c > 0xa0 and not c == 0xa0 so it never worked as intended. Signed-off-by: Werner Koch <[email protected]>
* | scd: For PIV cards used NO_AUTH instead of BAD_PIN.Werner Koch2019-02-111-1/+4
| | | | | | | | | | | | | | | | | | * common/util.h (GPG_ERR_NO_AUTH, GPG_ERR_BAD_AUTH): Add replacement codes for gpgrt < 1.36. * scd/app-piv.c (auth_adm_key): (do_genkey, do_writecert): Use better error codes. Signed-off-by: Werner Koch <[email protected]>
* | common: Provide function to get public key algo names in our format.Werner Koch2019-02-082-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | * tools/card-tool-misc.c (pubkey_algo_string): Move to ... * common/sexputil.c (pubkey_algo_string): here. -- The new gpg format for public key algorithms is useful at other places as well. Thus we make this new function available. Note that the code we use in gpg is not based on s-expressions and thus a new function was required. Signed-off-by: Werner Koch <[email protected]>
* | common: New functions get_option_value and ascii_strupr.Werner Koch2019-02-084-1/+71
| | | | | | | | | | | | | | * common/server-help.c (get_option_value): New. * common/stringhelp.c (ascii_strupr): New. Signed-off-by: Werner Koch <[email protected]>
* | card: Print matching OpenPGP and X.509 data.Werner Koch2019-01-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | * tools/card-tool-keys.c: New. * tools/Makefile.am (gpg_card_tool_SOURCES): Add file. * tools/card-tool.h (struct pubkey_s, pubkey_t): New. (struct userid_s, userid_t): New. (struct keyblock_s, keyblock_t): New. * common/util.h (GNUPG_PROTOCOL_): New const * tools/gpg-card-tool.c (aTest): Add temporary command. (list_one_kinfo): Print info from gpg and gpgsm. Signed-off-by: Werner Koch <[email protected]>
* | common: Add kludge to allow silencing gnupg_exec_tool_stream.Werner Koch2019-01-301-4/+15
| | | | | | | | | | | | | | | | | | | | * common/exectool.c (read_and_log_buffer_t): Take care of a --quiet argument. (gnupg_exec_tool_stream): Ditto. -- If we pass --quiet to a program it should really shutup and the parent should be quite as well.
* | common: New function decode_c_string.Werner Koch2019-01-302-0/+77
| | | | | | | | | | | | | | | | | | * common/miscellaneous.c (decode_c_string): New. -- This is basically a copy from the code we use in gpgme and gpa. Signed-off-by: Werner Koch <[email protected]>
* | common: Provide some convenient OpenPGP related constants.Werner Koch2019-01-291-1/+5
| | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (OPENPGP_MAX_NPKEY): New. (OPENPGP_MAX_NSKEY): New. (OPENPGP_MAX_NSIG): New. (OPENPGP_MAX_NENC): New. * g10/packet.h: Define PUBKEY_MAX using the new consts. Signed-off-by: Werner Koch <[email protected]>
* | common: New helper functions for OpenPGP curve OIDs.Werner Koch2019-01-293-34/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgp-oid.c (openpgp_oidbuf_to_str): Factor most code out to ... (openpgp_oidbuf_to_str): new. (openpgp_oidbuf_is_ed25519): New. (openpgp_oidbuf_is_cv25519): New. -- At some places it is more convenient (and faster) to directly work on buffers and avoid the way via opaque MPIs. These 3 new functions allow for that. Signed-off-by: Werner Koch <[email protected]>
* | gpg: Move S2K encoding function to a shared file.Werner Koch2019-01-264-1/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/passphrase.c (encode_s2k_iterations): Move function to ... * common/openpgp-s2k.c: new file. Remove default intialization code. * common/openpgpdefs.h (S2K_DECODE_COUNT): New to keep only one copy. * g10/call-agent.c (agent_get_s2k_count): Change to return the count and print an error. * agent/protect.c: Include openpgpdefs.h * g10/card-util.c (gen_kdf_data): Adjust for changes * g10/gpgcompose.c: Include call-agent.h. (sk_esk): Adjust for changes. * g10/passphrase (passphrase_to_dek): Adjust for changes. * g10/main.h (S2K_DECODE_COUNT): Remove macro. Signed-off-by: Werner Koch <[email protected]>
* | common: Extend function percent_data_escape.Werner Koch2019-01-243-25/+223
| | | | | | | | | | | | | | | | | | | | | | | | * common/percent.c (percent_data_escape): Add new args prefix and plus_escape. * agent/command.c (cmd_put_secret): Adjust for changed function * common/t-percent.c (test_percent_data_escape): Extend test for the prefix. (test_percent_data_escape_plus): new test for the plus escaping. Signed-off-by: Werner Koch <[email protected]>
* | common: Add generic status print function.Werner Koch2019-01-222-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/status.c (gnupg_set_status_fd): New. (gnupg_status_printf): New. * po/Makevars (XGETTEXT_OPTIONS): Add gnupg-status_printf. -- Some of the extra tools take a --status-fd option to print certain status messages. A generic printf style print function thus makes sense. Signed-off-by: Werner Koch <[email protected]>
* | common/iobuf: fix memory wiping in iobuf_copyJussi Kivilinna2018-12-011-1/+6
| | | | | | | | | | | | | | | | * common/iobuf.c (iobuf_copy): Wipe used area of buffer instead of first sizeof(char*) bytes. -- Signed-off-by: Jussi Kivilinna <[email protected]>