aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* common: New function decode_c_string.Werner Koch2019-01-301-0/+1
| | | | | | | | | * 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: New helper functions for OpenPGP curve OIDs.Werner Koch2019-01-291-0/+3
| | | | | | | | | | | | | | | * 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]>
* common: Extend function percent_data_escape.Werner Koch2019-01-241-1/+2
| | | | | | | | | | | | * 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: New function percent_data_escape.Werner Koch2018-07-021-0/+1
| | | | | | | * common/percent.c (percent_data_escape): New. * common/t-percent.c (test_percent_data_escape): New. Signed-off-by: Werner Koch <[email protected]>
* Require libgpg-error 1.29 and remove internal logging functions.Werner Koch2018-06-121-15/+0
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Set to 1.29 * common/util.h: Remove replacement error codes. * common/logging.h: Remove fallback to internal logging functions. * common/logging.c: Remove. * common/Makefile.am (common_sources): Remove logging.c Signed-off-by: Werner Koch <[email protected]>
* common: Add constant KEYGRIP_LEN.Werner Koch2017-09-271-0/+5
| | | | | | | | * common/util.h (KEYGRIP_LEN): New. * g10/call-agent.c (agent_probe_any_secret_key): Use that constant. * g10/keyid.c (keygrip_from_pk): Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: New functions gnupg_daemon_rootdir and gnupg_chdir.Werner Koch2017-07-251-0/+1
| | | | | | | | | | | * common/sysutils.c (gnupg_chdir): New. * common/homedir.c (gnupg_daemon_rootdir): New. * agent/gpg-agent.c (main): Use these functions instead chdir("/"). * dirmngr/dirmngr.c (main): Ditto. * scd/scdaemon.c (main): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
* common: New function print_utf9_string.Werner Koch2017-07-201-0/+1
| | | | | | | | | * common/miscellaneous.c (print_utf8_string): New. -- This is a simple convenience function. Signed-off-by: Werner Koch <[email protected]>
* gpg: Allow creating keys using an existing ECC key.Werner Koch2017-03-011-3/+3
| | | | | | | | | | | * common/sexputil.c (get_pk_algo_from_canon_sexp): Remove arg R_ALGO. Change to return the algo id. Reimplement using get_pk_algo_from_key. * g10/keygen.c (check_keygrip): Adjust for change. * sm/certreqgen-ui.c (check_keygrip): Ditto. -- GnuPG-bug-id: 2976 Signed-off-by: Werner Koch <[email protected]>
* Clarify text of LGPLv2+/GPLv2+ licensed files.Werner Koch2017-02-241-2/+2
| | | | --
* common: Support locating components in the build tree.Justus Winter2016-12-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (gnupg_build_directory): New variable. (gnupg_module_name_called): Likewise. (gnupg_set_builddir): New function. (gnupg_set_builddir_from_env): Likewise. (gnupg_module_name): Support locating components in the build tree. * common/util.h (gnupg_set_builddir): New prototype. * tests/openpgp/defs.scm (tools): Drop 'gpg and 'gpg-agent. (tool): Rename to 'tool-hardcoded. (gpg-conf): New function, with accessors for the results. (gpg-components): New variable. (tool): New function. * tools/gpgconf.c (enum cmd_and_opt_values): New key. (opts): New option '--build-prefix'. (main): Handle new option. -- This change makes sure that the components from the build tree are used, and not some older installed version in PATH. It also lets us make GPGME use components from the build tree, making it possible to execute GPGME's test suite with them. Signed-off-by: Justus Winter <[email protected]>
* common: Fix typo.Justus Winter2016-12-141-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* common: Add replacements for error codes from gpg-error 1.26.Werner Koch2016-12-141-1/+13
| | | | Signed-off-by: Werner Koch <[email protected]>
* gpg: New option --default-new-key-algo.Werner Koch2016-12-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgp-oid.c (openpgp_is_curve_supported): Add optional arg R_ALGO and change all callers. * common/util.h (GPG_ERR_UNKNOWN_FLAG): New error code. * g10/options.h (struct opt): Add field DEF_NEW_KEY_ALGO. * g10/gpg.c (oDefaultNewKeyAlgo): New enum. (opts): New option "--default-new-key-algo". (main): Set the option. * g10/keygen.c: Remove DEFAULT_STD_ FUTURE_STD_ constants and replace them by ... (DEFAULT_STD_KEY_PARAM, FUTURE_STD_KEY_PARAM): new string constants. (get_keysize_range): Remove arg R_DEF and return that value instead. Change all callers. (gen_rsa): Use get_keysize_range instead of the removed DEFAULT_STD_KEYSIZE. (parse_key_parameter_part): New function. (parse_key_parameter_string): New function. (quick_generate_keypair): Refactor using parse_key_parameter_string. (generate_keypair): Ditto. (parse_algo_usage_expire): Ditto. -- This new option is intended to be used in the forthcoming --set-profile command of gpgconf. It allows to provide a gpg configuration with custom defaults for a new key using the simple commands which use the default algorithm set. Signed-off-by: Werner Koch <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* common: Add GNUPG_MODULE_NAME_GPGV.Werner Koch2016-10-271-0/+1
| | | | | | | * common/util.h (GNUPG_MODULE_NAME_GPGV): New. * common/homedir.c (gnupg_module_name): Implement. Signed-off-by: Werner Koch <[email protected]>
* common: Rename an odd named function.Werner Koch2016-08-251-1/+1
| | | | | | | | | | | | | * common/openpgp-oid.c (oid_crv25519): Rename to oid_cv25519. (openpgp_oid_is_crv25519): Rename to openpgp_oid_is_cv25519. Change callers. -- We use "cv25519" everywhere else and thus the test function should not have a surprising name. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Remove all system daemon features.Werner Koch2016-08-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dirmngr/dirmngr.h (opts): Remove fields 'system_service' and 'system_daemon'. * common/homedir.c (dirmngr_sys_socket_name): Remove. (dirmngr_user_socket_name): Rename to ... (dirmngr_socket_name): this. Change call callers. * common/asshelp.c (start_new_dirmngr): Remove the system socket feature. * tools/gpgconf.c (list_dirs): Do not print "dirmngr-sys-socket". * sm/server.c (gpgsm_server): Adjust for removed system socket feature. * dirmngr/server.c (cmd_getinfo): Ditto. (cmd_killdirmngr): Remove check for system daemon. (cmd_reloaddirmngr): Ditto. * dirmngr/dirmngr.c (USE_W32_SERVICE): Remove macro. (aService): Remove. (opts): Remove --service. (w32_service_control): Remove. (real_main, call_real_main) [W32]: Remove wrapper. (main): Remove Windows system service feature. Remove system dameon feature. Use only the "~/.gnupg/dirmngr_ldapservers.conf" file. * dirmngr/certcache.c (load_certs_from_dir): Remove warning in the system dameon case. * dirmngr/crlcache.c (DBDIR_D): Always use "~/.gnupg/crls.d". * dirmngr/ocsp.c (validate_responder_cert): Do not call validate_cert_chain which was used only in system daemon mode. * dirmngr/validate.c (validate_cert_chain): Always use the code. -- We are now starting dirmngr as needed as a user daemon. The deprecated system daemon mode does not anymore make sense. In case a system wide daemon is required, it is better to setup a dedicated account to run dirmngr and tweak socket permissions accordingly. Signed-off-by: Werner Koch <[email protected]>
* common: New function try_make_printable_string.Werner Koch2016-08-101-0/+1
| | | | | | | | * common/stringhelp.c (sanitize_buffer): Remove. Move code to ... * common/miscellaneous.c (try_make_printable_string): new. (make_printable_string): Call try_make_printable_string. Signed-off-by: Werner Koch <[email protected]>
* agent: More clean up of SSH support.NIIBE Yutaka2016-08-081-0/+1
| | | | | | | | | | | | | | | | | | | | | * common/util.h (get_pk_algo_from_key): New. * common/sexputil.c (get_pk_algo_from_key): The implementation. * agent/gpg-agent.c: Remove include of openpgpdefs.h. * agent/command-ssh.c (struct ssh_key_type_spec): Use integer ALGO. (ssh_key_types): Update with GCRY_PK_*. (make_cstring, sexp_extract_identifier): Remove. (sexp_key_construct): Use gcry_pk_algo_name to get ALGO string. (ssh_key_to_blob): Use cadr to get value list. (ssh_key_type_lookup): Lookup with integer ALGO. (ssh_receive_key): Follow the change of ssh_key_type_lookup. (ssh_send_key_public): Likewise. Use get_pk_algo_from_key to get ALGO. -- This fixes the regresson introduced by the commit 894789c3299dc47a8c1ccaaa7070382f0fae0262. Signed-off-by: NIIBE Yutaka <[email protected]>
* common: New file utilproto.cWerner Koch2016-08-031-5/+1
| | | | | | | | * common/util.h: Factor prototypes from signal.c out to ... * common/utilproto.h: new. * common/Makefile.am (common_sources): Add new file. Signed-off-by: Werner Koch <[email protected]>
* build: Require latest released librariesWerner Koch2016-07-141-5/+4
| | | | | | | | | | | | | | * agent/protect.c (OCB_MODE_SUPPORTED): Remove macro. (do_encryption): Always support OCB. (do_decryption): Ditto. (agent_unprotect): Ditto. * dirmngr/server.c (is_tor_running): Unconditionally build this. -- Although not technically required, it is easier to require them to avoid bug reports due to too old library versions. Signed-off-by: Werner Koch <[email protected]>
* Implement /run/user/UID/gnupg based sockets.Werner Koch2016-06-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c: Include sys/stat.h and zb32.h. (w32_portable_app, w32_bin_is_bin): Change type from int to byte. (non_default_homedir): New. (is_gnupg_default_homedir): New. (default_homedir): Set non_default_homedir. (gnupg_set_homedir): Set non_default_homedir and make the_gnupg_homedir and absolute directory name. (gnupg_homedir): Return an absolute directory name. (_gnupg_socketdir_internal): New. (gnupg_socketdir): Implement /run/user/ based sockets. * tools/gpg-connect-agent.c (get_var_ext): Replace now obsolete make_filename by xstrdup. * tools/gpgconf.c (main): Sue gnupg_homedir for the "homedir:" output. -- If a [/var]/run/user/$(id -u)/ directory exists, a gnupg subdir is created as needed and the permissions of the directories are checked. If that all matches that directory name is returned instead of the homedir. To cope with non standard homedirs (via GNUPGHOME or --homedir) the SHA-1 hash of the homedir is computed, left truncated to 120 bits, zBase-32 encoded, prefixed with "d.", and appended to "[/var]/run/user/$(id -u)/gnupg/". If that directory exists and has proper permissions it is returned as socket dir - if not the homedir is used. Due to cleanup issues, this directory will not be auto-created but needs to be created by the user in advance. The required permissions are: directory owned by the user, group and others bits not set. Signed-off-by: Werner Koch <[email protected]>
* common: New function gnupg_socketdir.Werner Koch2016-06-071-0/+1
| | | | | | | | | | | | | | | * common/homedir.c (gnupg_socketdir): New. * agent/gpg-agent.c (create_socket_name): Use new function instead of gnupg_homedir. (check_own_socket): Ditto. (check_for_running_agent): Ditto. * agent/preset-passphrase.c (main): Ditto. * common/asshelp.c (start_new_gpg_agent): Ditto. * scd/scdaemon.c (create_socket_name): Ditto. * tools/gpgconf.c (main): Ditto. * tools/symcryptrun.c (main): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Replace use of opt.homedir by accessor functions.Werner Koch2016-06-071-0/+2
| | | | | | | | | | | | | | | | | | | * common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch <[email protected]>
* common: New function openpgp_is_curve_supported.Werner Koch2016-06-021-1/+1
| | | | | | | | | * common/openpgp-oid.c: Include openpgpdefs.h. (oidtable): Add field pubkey_algo. (openpgp_is_curve_supported): New. -- Signed-off-by: Werner Koch <[email protected]>
* common: Use new function to print a failure of xtrymalloc.Werner Koch2016-04-251-0/+3
| | | | | | | | * common/miscellaneous.c (xoutofcore): New. * common/strlist.c (append_to_strlist): Use instead of abort. (append_to_strlist_try): Use xtrymalloc instead of xmalloc. Signed-off-by: Werner Koch <[email protected]>
* common: Add support for the new extended private key format.Justus Winter2016-04-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * agent/findkey.c (write_extended_private_key): New function. (agent_write_private_key): Detect if an existing file is in extended format and update the key within if it is. (read_key_file): Handle the new format. * agent/keyformat.txt: Document the new format. * common/Makefile.am: Add the new files. * common/private-keys.c: New file. * common/private-keys.h: Likewise. * common/t-private-keys.c: Likewise. * common/util.h (alphap, alnump): New macros. * tests/migrations: Add test demonstrating that we can cope with the new format. -- GnuPG 2.3+ will use a new format to store private keys that is both more flexible and easier to read and edit by human beings. The new format stores name,value-pairs using the common mail and http header convention. This patch adds the parser and support code and prepares GnuPG 2.1 for the new format. Signed-off-by: Justus Winter <[email protected]>
* common: Add substitute code for libgpg-error < 1.22.Werner Koch2016-01-191-2/+4
| | | | * common/util.h (GPG_ERR_DB_CORRUPTED): New.
* common: New file fwddecl.h.Werner Koch2015-12-211-7/+1
| | | | | | | | | | | | | | | | * common/util.h (server_control_s, ctrl_t): Move to ... * common/fwddecl.h: New file. * common/call-gpg.h: Replace typedef by fwddecl.h. Change include protection macro name. * common/Makefile.am (common_sources): Add fwddecl.h. -- It seems some compilers do not grok a re-declaration. Thus we factor it out into a separate file and use the include protection macro to protect against re-declaration. GnuPG-bug-id: 2200 Signed-off-by: Werner Koch <[email protected]>
* Remove replacements for libgpg-error < 1.21.Werner Koch2015-12-121-119/+2
| | | | | | | | | | | | | | | | * common/util.h: Remove replacement macros for libgpg-error<1.21. * common/types.h: Ditto. * common/mischelp.h: Ditto. * common/t-mapstrings.c: Include t-support.h before stringhelp.h * common/t-stringhelp.c: Ditto. * common/t-support.h: Always include gpg-error.h. * kbx/keybox-search.c: Do not include stringhelp.h so that keybox-defs comes first. -- This patch enhances commit d6e0149 from Dec 10. Signed-off-by: Werner Koch <[email protected]>
* Fix typos found using codespell.Justus Winter2015-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]>
* common: Add separate header for zb32.c.Werner Koch2015-10-301-5/+0
| | | | | | | * common/util.h (zb32_encode): Move prototype to ... * common/zb32.h: new. Include this for all callers of zb32_encode. Signed-off-by: Werner Koch <[email protected]>
* common: Add more replacement error codes.Werner Koch2015-10-211-0/+3
| | | | | | | | * common/util.h (GPG_ERR_SERVER_FAILED): New. (GPG_ERR_NO_KEY): New. (GPG_ERR_NO_NAME): New. Signed-off-by: Werner Koch <[email protected]>
* common: Provide two new error code replacements.Werner Koch2015-09-281-0/+4
| | | | | | * common/util.h (GPG_ERR_FALSE, GPG_ERR_TRUE): Rew replcements. Signed-off-by: Werner Koch <[email protected]>
* Curve25519 support.NIIBE Yutaka2015-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | * agent/cvt-openpgp.c (get_keygrip): Handle Curve25519. (convert_secret_key, convert_transfer_key): Ditto. * common/openpgp-oid.c (oidtable): Add Curve25519. (oid_crv25519, openpgp_oid_is_crv25519): New. * common/util.h (openpgp_oid_is_crv25519): New. * g10/ecdh.c (pk_ecdh_encrypt_with_shared_point): Handle the case with Montgomery curve which uses x-only coordinate. * g10/keygen.c (gen_ecc): Handle Curve25519. (ask_curve): Change the API and second arg is to return subkey algo. (generate_keypair, generate_subkeypair): Follow chage of ask_curve. * g10/keyid.c (keygrip_from_pk): Handle Curve25519. * g10/pkglue.c (pk_encrypt): Handle Curve25519. * g10/pubkey-enc.c (get_it): Handle the case with Montgomery curve. * scd/app-openpgp.c (ECC_FLAG_DJB_TWEAK): New. (send_key_attr): Work with general ECC, Ed25519, and Curve25519. (get_public_key): Likewise. (ecc_writekey): Handle flag_djb_tweak. -- When libgcrypt has Curve25519, GnuPG now supports Curve25519.
* common: extend API of openpgp_oid_to_curve for canonical name.NIIBE Yutaka2015-08-061-1/+1
| | | | | | | | | | | | | | | * common/openpgp-oid.c (openpgp_oid_to_curve): Add CANON argument. * common/util.h: Update. * g10/import.c (transfer_secret_keys): Follow the change. * g10/keyid.c (pubkey_string): Likewise. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Likewise. * parse-packet.c (parse_key): Likewise. * scd/app-openpgp.c (send_key_attr, get_public_key): Likewise. -- Change the function so that caller can select canonical name of curve or name for printing. Suggested by wk.
* Replace GNUPG_GCC_A_ macros by GPGRT_ATTR_ macros.Werner Koch2015-07-261-20/+24
| | | | | | | | | | | | | * common/util.h: Provide replacement for GPGRT_ATTR_ macros when using libgpg-error < 1.20. * common/mischelp.h: Ditto. * common/types.h: Ditto. -- Given that libgpg-error is a dependency of all GnuPG related libraries it is better to define such macros at only one place instead of having similar macros at a lot of places. For now we need repalcement macros, though.
* Flag the L_() function with attribute format_arg.Werner Koch2015-06-301-0/+8
| | | | | | | | | | | | * agent/agent.h (LunderscorePROTO): New. * common/util.h (GNUPG_GCC_ATTR_FORMAT_ARG): New. * common/i18n.h (GNUPG_GCC_ATTR_FORMAT_ARG): New. Use for i18n_localegettext. Expand LunderscorePROTO. * agent/genkey.c (check_passphrase_constraints): Use xtryasprintf again to keep the old translations. -- Signed-off-by: Werner Koch <[email protected]>
* common: Add function parse_debug_flagWerner Koch2015-06-221-0/+8
| | | | | | | * common/miscellaneous.c (parse_debug_flag): New. * common/util.h (struct debug_flags_s): New. Signed-off-by: Werner Koch <[email protected]>
* agent: Print a warning for obsolete options.Werner Koch2015-06-171-0/+3
| | | | | | | | | | | * g10/misc.c (obsolete_scdaemon_option): Move to * common/miscellaneous.c (obsolete_option): ... here. * agent/gpg-agent.c (main): Use obsolete_option for the 3 obsolete options. -- GnuPG-bug-id: 2016 Signed-off-by: Werner Koch <[email protected]>
* common: Remove JNLIB from boiler plate (jnlib merge).Werner Koch2015-04-241-3/+3
| | | | | | | * common/README.jnlib: Remove. -- This is the final part of merging jnlib into gnupg/common.
* common: Rename log and gcc attribute macros (jnlib merge).Werner Koch2015-04-241-2/+2
| | | | | | | | | | | * common/logging.h: Rename JNLIB_LOG_* to GPGRT_LOG_*. * common/mischelp.h: Rename JNLIB_GCC_* to GPGRT_GCC_*. -- JNLIB has no more meaning. Thus we switch to a GPGRT_ prefix in anticipation that some code may eventually be moved to libgpg-error. Signed-off-by: Werner Koch <[email protected]>
* common: Add macro GNUPG_GCC_A_USED.Werner Koch2015-03-251-0/+6
| | | | | | * common/util.h (GNUPG_GCC_A_USED): New. Signed-off-by: Werner Koch <[email protected]>
* Define replacement error codes from libgpg-error 1.19.Werner Koch2015-03-191-1/+83
| | | | * common/util.h: Add GPG_ERR_LDAP codes for libgpg-error < 1.19.
* gpg: Add --list-gcrypt-config and "curve" item for --list-config.Werner Koch2015-03-101-0/+1
| | | | | | | | | | | | | * common/openpgp-oid.c (curve_supported_p): New. (openpgp_enum_curves): New. * common/t-openpgp-oid.c (test_openpgp_enum_curves): New. (main): Add option --verbose. * g10/gpg.c (opts): Add --list-gcrypt-config. (list_config): Add items "curve" and "curveoid". Remove unused code. -- GnuPG-bug-id: 1917 Signed-off-by: Werner Koch <[email protected]>
* gpg-agent: Use "pinentry-basic" as fallback.Werner Koch2015-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (get_default_pinentry_name): New. (gnupg_module_name): Use that for the default pinentry. (gnupg_module_name_flush_some): New. * agent/gpg-agent.c (agent_sighup_action): Flush some module names. * agent/call-pinentry.c (start_pinentry): Do not modify opt.pinentry_program. -- The idea with this change is that under Windows we can install a simple native Windows pinentry as "pinentry-basic" and a full GUI version may then later install pinentry-gtk etc which would then automatically be used. Unfortunately installing another pinentry from a different package would clobber the GnuPG core directory which is not nice. To fix that we would need to agree on standard installation directories for GUIs to also look there. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add dedicated error code for PGP-2 keys.Werner Koch2015-01-221-0/+1
| | | | | | | | | | | | * 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: Add sub-command "factory-reset" to --card-edit.Werner Koch2014-12-151-1/+2
| | | | | | | | | | | | | | | | | | * common/util.h (GPG_ERR_OBJ_TERM_STATE): New. * scd/iso7816.c (map_sw): Add this error code. * scd/app-openpgp.c (do_getattr): Return the life cycle indicator. * scd/app.c (select_application): Allow a return value of GPG_ERR_OBJ_TERM_STATE. * scd/scdaemon.c (set_debug): Print the DBG_READER value. * g10/call-agent.c (start_agent): Print a status line for the termination state. (agent_scd_learn): Make arg "info" optional. (agent_scd_apdu): New. * g10/card-util.c (send_apdu): New. (factory_reset): New. (card_edit): Add command factory-reset. Signed-off-by: Werner Koch <[email protected]>
* gpg-agent: Add restricted connection feature.Мирослав Николић2014-11-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (opt): Add field extra_socket. (server_control_s): Add field restricted. * agent/command.c: Check restricted flag on many commands. * agent/gpg-agent.c (oExtraSocket): New. (opts): Add option --extra-socket. (socket_name_extra): New. (cleanup): Cleanup that socket name. (main): Implement oExtraSocket. (create_socket_name): Add arg homedir and change all callers. (create_server_socket): Rename arg is_ssh to primary and change callers. (start_connection_thread): Take ctrl as arg. (start_connection_thread_std): New. (start_connection_thread_extra): New. (handle_connections): Add arg listen_fd_extra and replace the connection starting code by parameterized loop. * common/asshelp.c (start_new_gpg_agent): Detect the use of the restricted mode and don't fail on sending the pinentry environment. * common/util.h (GPG_ERR_FORBIDDEN): New.