aboutsummaryrefslogtreecommitdiffstats
path: root/common (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-12-21common: Remove superfluous debug output from dotlock.c.Werner Koch1-2/+0
* common/dotlock.c (dotlock_create_unix): Remove debug output. -- This was left over from developement about 10 years ago. Exhibits itself when using sshfs. GnuPG-bug-id: 5193
2020-11-18build: Update to newer autoconf constructs.NIIBE Yutaka1-4/+4
* acinclude.m4 (GNUPG_CHECK_ENDIAN): Use AC_COMPILE_IFELSE instead of AC_TRY_COMPILE. Use AC_RUN_IFELSE instead of AC_TRY_RUN. (GNUPG_BUILD_PROGRAM): Use AS_HELP_STRING instead of AC_HELP_STRING. * configure.ac: Use AC_USE_SYSTEM_EXTENSIONS instead of AC_GNU_SOURCE. Use AS_HELP_STRING instead of AC_HELP_STRING. (AC_ISC_POSIX): Replace by AC_SEARCH_LIBS. (AC_TYPE_SIGNAL): Remove. * m4/isc-posix.m4: Remove. * m4/codeset.m4: Update from gnulib. * m4/gettext.m4: Update from gnulib. * m4/lcmessage.m4: Update from gnulib. * m4/socklen.m4: Update from gnulib. * m4/ldap.m4: Use AS_HELP_STRING instead of AC_HELP_STRING. Use AC_LINK_IFELSE instead of AC_TRY_LINK. Use AC_RUN_IFELSE instead of AC_TRY_RUN. * m4/gpg-error.m4: Update from libgpg-error. * m4/readline.m4: Update from libgpg-error. * m4/npth.m4: Update from npth. * m4/libassuan.m4: Update from libassuan. * m4/libgcrypt.m4: Update from libgcrypt. * m4/ksba.m4: Update from libksba. * m4/ntbtls.m4: Update from ntbtls. * common/signal.c [!HAVE_DOSISH_SYSTEM] (init_one_signal): Replace RETSIGTYPE to void. [!HAVE_DOSISH_SYSTEM] (got_fatal_signal, got_usr_signal): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-11-18build: Use modern Autoconf check for types.NIIBE Yutaka1-11/+11
* common/types.h: Use HAVE_TYPE_BYTE, HAVE_USHORT_TYPEDEF, HAVE_ULONG_TYPEDEF, HAVE_U16_TYPEDEF, and HAVE_TYPE_U32. * configure.ac (byte, ushort, ulong, u16, u32): Use AC_CHECK_TYPES. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-11-05gpg: Add canceled status message.Ben Kibbey1-0/+1
* common/status.h (STATUS_CANCELED_BY_USER): New. * g10/passphrase.c (passphrase_to_dek): Send STATUS_CANCELED_BY_USER instead of STATUS_MISSING_PASSPHRASE when canceled is set. -- This is to prevent further pinentry tries when the pinentry is canceled by the user during symmetric decryption. Signed-off-by: Ben Kibbey <[email protected]>
2020-11-04common: Fix duplicate implementation of try_make_homedir.Werner Koch2-0/+34
* g10/openfile.c (try_make_homedir): Move core of the code to ... * common/homedir.c (gnupg_maybe_make_homedir): new. * sm/keydb.c (try_make_homedir): Implement using new function. * common/homedir.c: Include i18n.h. * po/POTFILES.in: Add common/homedir.c. Signed-off-by: Werner Koch <[email protected]>
2020-11-04w32: Add another pinentry search pathAndre Heinecke1-0/+2
* common/homedir.c (get_default_pinentry_name): Try ../bin/pinentry.exe -- In an installation layout where GnuPG is installed as a component of another software it might be useful to have pinentry placed in a different bin directory without the forced folder name of Gpg4win. (cherry picked from commit b4cb91d5fbe2b8917d76d12eb72aaac0d97ed596)
2020-11-03w32: Fix strftime problem on Windows.Werner Koch1-2/+31
* common/gettime.c: Include locale.h. (asctimestamp): Increase buffer. On Windows use setlocale. -- GnuPG-bug-id: 5073 Signed-off-by: Werner Koch <[email protected]>
2020-10-23common: Allow building with released libgpg-error.Werner Koch1-7/+9
* common/sysutils.c (gnupg_access) [W32]: Fix for older libgpgrt. -- Fixes-commit: c94ee1386e0d5cdac51086c4d5b92de59c09c9b5 Signed-off-by: Werner Koch <[email protected]>
2020-10-21common: New functions gnupg_opendir et al.Werner Koch2-0/+180
* common/sysutils.h (struct gnupg_dirent_s): New. * common/sysutils.c: Include dirent.h. (struct gnupg_dir_s): New. (gnupg_opendir, gnupg_readdir, gnupg_closedir): New. Change all callers of opendir, readdir, and closedir to use these functions. -- GnuPG-bug-id: 5098
2020-10-21w32: Make gnupg_remove and gnupg_rename_file Unicode awareWerner Koch1-3/+33
* common/sysutils.c (w32_rename): New. (gnupg_rename_file) [W32]: Support Unicode. (gnupg_remove) [W32]: Support Unicode. Drop Windows-CE support. -- GnuPG-bug-id: 5098
2020-10-20Replace all calls to stat by gnupg_stat.Werner Koch3-1/+50
* common/sysutils.c (gnupg_stat): New. * common/sysutils.h: Include sys/stat.h. -- Yet another wrapper for Unicode support on Windows. GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <[email protected]>
2020-10-20Replace most calls to open by a new wrapper.Werner Koch3-15/+67
* common/sysutils.c (any8bitchar) [W32]: New. (gnupg_open): New. Replace most calls to open by this. * common/iobuf.c (any8bitchar) [W32]: New. (direct_open) [W32]: Use CreateFileW if needed. -- This is yet another step for full Unicode support on Windows. GnuPG-bug-id: 5098
2020-10-20w32: Allow Unicode filenames for dotlockWerner Koch2-27/+192
* common/dotlock.c (any8bitchar) [W32]: New. (dotlock_create_w32): Use strconcat and CreateFileW. * common/t-dotlock.c: Source include dotlock.c and modify to allow manual testing on Windows. -- GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <[email protected]>
2020-10-20Replace most of the remaining stdio calls by estream calls.Werner Koch2-6/+8
-- We need to use es_fopen on Windows to cope with non-ascii file names. This is quite a large but fortunately straightforward change. At a very few places we keep using stdio (for example due to the use of popen). GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <[email protected]>
2020-10-20Replace all calls to access by gnupg_accessWerner Koch6-63/+69
* common/sysutils.c (gnupg_access): New. Replace all calls to access by this wrapper. * common/homedir.c (w32_shgetfolderpath): Change to return UTF-8 directory name. (standard_homedir): Adjust for change. (w32_commondir, gnupg_cachedir): Ditto. -- Also use SHGetFolderPathW instead of SHGetFolderPathA on Windows. This is required to correctly handle non-ascii filenames on Windows. GnuPG-bug-id: 5098
2020-10-02w32: Silence warning due to recent change of split_fields.Werner Koch1-1/+1
* common/compliance.c (gnupg_rng_is_compliant): Make fields const. Signed-off-by: Werner Koch <[email protected]>
2020-09-24keyboxd: Integrate into gpgconf.Werner Koch3-1/+15
* common/asshelp.c (lock_spawning): Use a dedicated name for keyboxd. * common/homedir.c (keyboxd_socket_name): New. (gnupg_module_name): Put keyboxd into libexecdir. * tools/gpgconf-comp.c (known_options_keyboxd): New. (gc_component): Add entry for keyboxd. (keyboxd_runtime_change): New. (gc_component_launch): Support keyboxd. * tools/gpgconf.c (list_dirs): Emit new item keyboxd-socket. (main): Also remove keyboxd socket. Signed-off-by: Werner Koch <[email protected]>
2020-09-22common: Fix name of keyboxd.Werner Koch1-1/+1
* common/homedir.c (gnupg_module_name): Fix name.
2020-09-18common,agent,dirmngr,g10,tools: Fix split_fields API.NIIBE Yutaka3-8/+10
* common/stringhelp.h (split_fields): Use const * for the strings in the ARRAY. (split_fields_colon): Likewise. * common/stringhelp.c (split_fields, split_fields_colon): Fix the implementation. * agent/call-scd.c, agent/command.c: Follow the change. * common/t-stringhelp.c, dirmngr/loadswdb.c: Likewise. * g10/call-agent.c, tools/card-call-scd.c: Likewise. * tools/card-yubikey.c, tools/gpg-card.c: Likewise. * tools/gpg-card.h, tools/gpg-wks-client.c: Likewise. * tools/gpgconf-comp.c, tools/gpgconf.c: Likewise. * tools/wks-util.c: Likewise. -- The strings in the ARRAY don't need to be released by caller, as those are references. It's easier to follow the code when it's explicitly const *. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-09-11common: New function cmp_canon_sexp.Werner Koch4-2/+200
* common/sexputil.c (cmp_canon_sexp): New. (cmp_canon_sexp_def_tcmp): New. * common/t-sexputil.c (test_cmp_canon_sexp): Add a simple test. -- To be used to fix GnuPG-bug-id: 5061 Signed-off-by: Werner Koch <[email protected]>
2020-09-09agent: Keep some permissions of private-keys-v1.d.Werner Koch1-23/+41
* common/sysutils.c (modestr_to_mode): Re-implement. (gnupg_chmod): Support keeping of permissions. -- GnuPG-bug-id: 2312
2020-09-09kbx: Change X.509 S/N search definition.Werner Koch1-1/+2
* kbx/keybox-search-desc.h (struct keydb_search_desc): Do not overload SNLLEN with a hex flag. Add SNHEX. * kbx/keybox-search.c (keybox_search): Adjust. * common/userids.c (classify_user_id): Adjust. * sm/keydb.c (keydb_search_desc_dump): Adjust. * g10/keydb.c (keydb_search_desc_dump): Adjust. Signed-off-by: Werner Koch <[email protected]>
2020-09-02common: New helper function gnupg_close_pipe.Werner Koch3-0/+21
* common/exechelp-posix.c (gnupg_close_pipe): New. * common/exechelp-w32.c (gnupg_close_pipe): New. -- This function is mainly for documentation purposes and should be used along with gnupg_create_pipe. Signed-off-by: Werner Koch <[email protected]>
2020-09-01Use only one copy of the warn_server_mismatch function.Werner Koch5-1/+110
* common/asshelp.c (warn_server_version_mismatch): New. Actually a slightly modified version of warn_version_mismatch found in other modules. * common/status.c (gnupg_status_strings): New. * g10/cpr.c (write_status_strings2): New. * g10/call-agent.c (warn_version_mismatch): Use the new unified warn_server_version_mismatch function. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * g10/call-keyboxd.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. * tools/card-call-scd.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <[email protected]>
2020-08-28common: Fix fallback handling to utf-8.NIIBE Yutaka1-1/+1
* common/utf8conv.c (handle_iconv_error): Set NO_TRANSLATION. -- GnuPG-bug-id: 5038 Fixes-commit: 99c9bf7defd6c1ac9cc49c84e6c78eeb886a6952 Signed-off-by: NIIBE Yutaka <[email protected]>
2020-08-21common: Use gpgrt functions for mkdir and chdir.Werner Koch1-24/+6
* common/sysutils.c (gnupg_mkdir): Divert to gpgrt_mkdir. (gnupg_chdir): Divert to gpgrt_chdir
2020-08-21common,w32: Do not assume the ANSI code during string conversion.Werner Koch1-2/+21
* common/utf8conv.c (get_w32_codepage): New. (wchar_to_native): Use instead oc CP_ACP. (native_to_wchar): Ditto. -- This should fix quite some issue; we fixed it when using the iconv based machinery about 14 years ago. At some point we introduced the new conversion functions because Windows started to support UTF-8 natively. The fix comes late but well, it is done. Signed-off-by: Werner Koch <[email protected]>
2020-08-21common: Strip trailing CR,LF from w32_strerror.Werner Koch2-1/+7
* common/stringhelp.c (w32_strerror): Strip trailing CR,LF. * common/iobuf.c (iobuf_get_filelength): Use -1 and not 0 for the arg to w32_strerror. -- This is in particular annoying since we started to use a string argument sanitizer in the logging code. Before that we just add an extra blank line. The second patch corrects a never yet seen error message. Signed-off-by: Werner Koch <[email protected]>
2020-08-20gpgtar: Make --files-from and --null work as described.Werner Koch3-1/+32
* tools/gpgtar-create.c (gpgtar_create): Add args files_from and null_names. Improve reading from a file. * tools/gpgtar.c: Make global vars static. (main): Remove tests for --files-from and --null option combinations. Pass option variables to gpgtar_create. -- GnuPG-bug-id: 5027 Signed-off-by: Werner Koch <[email protected]>
2020-08-20build: New configure option --disable-testsWerner Koch1-0/+4
* configure.ac: Add option --disable-tests. Print warnings in the summary. (DISABLE_TESTS): New am_conditional. -- GnuPG-bug-id: 4960
2020-08-19common: Fix iobuf.c.NIIBE Yutaka1-3/+3
* common/iobuf.c (iobuf_cancel): Initialize DUMMY. (do_iobuf_fdopen): Initialize LEN. (iobuf_read_line): Fix the loop condition. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-08-19Silence compiler warnings.NIIBE Yutaka1-1/+1
* common/openpgp-oid.c (map_openpgp_pk_to_gcry): Use cast for enum conversion. * dirmngr/dns-stuff.c (get_dns_srv): Use explicit conversion from int to float. * sm/gpgsm.c (parse_keyserver_line): Initialize ERR. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-08-12common: Pass the WAYLAND_DISPLAY envvar alongWerner Koch1-0/+1
* common/session-env.c (stdenvnames): Add WAYLAND_DISPLAY. -- GnuPG-bug-id: 5016 Signed-off-by: Werner Koch <[email protected]>
2020-08-06common: New helper function gnupg_chuid.Werner Koch2-0/+99
* common/sysutils.c (try_set_envvar): New. (gnupg_chuid): New. Signed-off-by: Werner Koch <[email protected]>
2020-08-03w32: Fix cast from intptr_t of _get_osfhandle.NIIBE Yutaka1-1/+1
* common/exectool.c (gnupg_exec_tool_stream): Cast to unsigned long. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-07-30w32: More adding NETLIBS.NIIBE Yutaka1-1/+1
* common/Makefile.am (t_common_ldadd): Add $(NETLIBS). -- GnuPG-bug-id: 4994 Signed-off-by: NIIBE Yutaka <[email protected]>
2020-07-28Revert patches applied wrongly.NIIBE Yutaka1-0/+11
-- In the experiment for 4994, and patches were wrongly applied. Fixes-commit: 46d185f60397f68830bfdfb99627b29aea5016f1 Signed-off-by: NIIBE Yutaka <[email protected]>
2020-07-17scd: PC/SC: Don't release the context when it's in use.NIIBE Yutaka1-11/+0
* scd/apdu.c (close_pcsc_reader): Check if it's not in the loop. -- GnuPG-bug-id: 4998 Reported-by: Kevin Locke Signed-off-by: NIIBE Yutaka <[email protected]>
2020-07-16common: Avoid undefined behavior of left shift operator.NIIBE Yutaka1-5/+11
* common/iobuf.c (block_filter): Handle an error earlier. Make sure it's unsigned. -- GnuPG-bug-id: 4975 Suggested-by: lutianxiong <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
2020-07-14gpgsm: Make rsaPSS a compliant scheme in de-vs mode.Werner Koch1-8/+4
-- GnuPG-bug-id: 4538 Signed-off-by: Werner Koch <[email protected]>
2020-07-03sm: Exclude rsaPSS from de-vs compliance mode.Werner Koch2-2/+18
* common/compliance.h (PK_ALGO_FLAG_RSAPSS): New. * common/compliance.c (gnupg_pk_is_compliant): Add arg alog_flags and test rsaPSS. Adjust all callers. (gnupg_pk_is_allowed): Ditto. * sm/misc.c (gpgsm_ksba_cms_get_sig_val): New wrapper function. (gpgsm_get_hash_algo_from_sigval): New. * sm/certcheck.c (gpgsm_check_cms_signature): Change type of sigval arg. Add arg pkalgoflags. Use the PK_ALGO_FLAG_RSAPSS. * sm/verify.c (gpgsm_verify): Use the new wrapper and new fucntion to also get the algo flags. Pass algo flags along. Signed-off-by: Werner Koch <[email protected]>
2020-07-02Support a history file in gpg-card and gpg-connect-agent.Werner Koch4-5/+110
* common/gpgrlhelp.c (read_write_history): New. (gnupg_rl_initialize): Register new function. * common/ttyio.c (my_rl_rw_history): New var. (tty_private_set_rl_hooks): Add arg read_write_history. (tty_read_history): New. (tty_write_history): New. * tools/gpg-card.c (HISTORYNAME): New. (oNoHistory): New enum value. (opts): New option --no-history. (cmd_history): New. (cmds): New command "history". (interactive_loop): Read and save the history. * tools/gpg-connect-agent.c (HISTORYNAME): New. (opts): New option --no-history. (main): Read and save the history. New command /history. -- Yeah, finally we have stored history; I should have added this much earlier. Signed-off-by: Werner Koch <[email protected]>
2020-06-24gpg,agent: Support Ed448 signing.NIIBE Yutaka2-1/+9
* agent/pksign.c (do_encode_eddsa): First argument is NBITs, so that it can support Ed448, as well as Ed25519. (agent_pksign_do): Follow the change. * agent/sexp-secret.c (fixup_when_ecc_private_key): No fix-up needed for Ed448, it's only for classic curves. * common/openpgp-oid.c (oidtable): Add Ed448. * common/sexputil.c (get_pk_algo_from_key): Ed448 is only for EdDSA. * g10/export.c (match_curve_skey_pk): Ed448 is for EdDSA. * g10/keygen.c (gen_ecc): Support Ed448 with the name of "ed448". (ask_algo, parse_key_parameter_part): Handle "ed448". * g10/pkglue.c (pk_verify): Support Ed448. (pk_check_secret_key): Support Ed448. * g10/sign.c (hash_for): Defaults to SHA512 for Ed448. (make_keysig_packet): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-06-23ecc: Use "cv448" to specify key using X448.NIIBE Yutaka2-9/+16
* common/openpgp-oid.c (oidtable): Use "cv448". (oid_cv448): Rename from oid_x448. (openpgp_oidbuf_is_cv448, openpgp_oid_is_cv448): Likewise. * common/util.h (openpgp_oid_is_cv448): Follow the change. * g10/ecdh.c (pk_ecdh_generate_ephemeral_key): Likewise. * g10/keygen.c (gen_ecc, ask_algo): Use "cv448". (parse_key_parameter_part): Likewise. * g10/pkglue.c (get_data_from_sexp): Fix for debug output. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-06-09gpg: Add X448 support.NIIBE Yutaka2-0/+29
* common/openpgp-oid.c (oidtable): Add X448. (oid_x448,openpgp_oidbuf_is_x448,openpgp_oid_is_x448): New. * common/util.h (openpgp_oid_is_x448): New. * g10/ecdh.c (gen_k): Add handling of opaque MPI and support endianness. (pk_ecdh_generate_ephemeral_key): X448 requires opaque MPI. * g10/keygen.c (gen_ecc): Add support for X448. (ask_algo, parse_key_parameter_part): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-19common: New function to extract Q from an ECC key.Werner Koch2-1/+93
* common/sexputil.c (get_ecc_q_from_canon_sexp): New. Signed-off-by: Werner Koch <[email protected]>
2020-05-08sm: Print algorithm infos in data decryption mode.Werner Koch2-0/+17
* common/sexputil.c (cipher_mode_to_string): New. * sm/decrypt.c (prepare_decryption): Show cipher algo and mode. (gpgsm_decrypt): Show key algo and fingerprint Signed-off-by: Werner Koch <[email protected]>
2020-05-08sm: Cleanup the use of GCRY_PK_ECC and GCRY_PK_ECDSA.Werner Koch2-0/+18
* common/sexputil.c (pubkey_algo_to_string): New. * sm/certcheck.c (do_encode_md): Replace GCRY_PK_ECDSA by GCRY_PK_ECC. * sm/certreqgen-ui.c (check_keygrip): Add all ECC algorithms. * sm/gpgsm.c (our_pk_test_algo): Also allow EdDSA. * sm/verify.c (gpgsm_verify): Map ECC algo to ECDSA. Use new pubkey algo name function Signed-off-by: Werner Koch <[email protected]>
2020-05-07sm: Print the key types as standard key algorithm strings.Werner Koch1-3/+3
* sm/fingerprint.c (gpgsm_get_key_algo_info): Factor code out to ... (gpgsm_get_key_algo_info2): new. (gpgsm_pubkey_algo_string): New. * sm/keylist.c (list_cert_colon): Put curve into field 17 (list_cert_raw): Print the unified key algotithm string instead of the algo and size. (list_cert_std): Ditto. -- It is important to known whether a 256 bit ECC uses a NIST or a Brainpool curve. Signed-off-by: Werner Koch <[email protected]>
2020-05-04doc: Typo fixes in code commentsWerner Koch1-1/+1
-- Signed-off-by: Werner Koch <[email protected]>