aboutsummaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove support for the GPG_AGENT_INFO envvar.Werner Koch2014-10-033-203/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (opt): Remove field use_standard_socket. * agent/command.c (cmd_killagent): Always allow killing. * agent/gpg-agent.c (main): Turn --{no,}use-standard-socket and --write-env-file into dummy options. Always return true for --use-standard-socket-p. Do not print the GPG_AGENT_INFO envvar setting or set that envvar. (create_socket_name): Simplify by removing non standard socket support. (check_for_running_agent): Ditto. * common/asshelp.c (start_new_gpg_agent): Remove GPG_AGENT_INFO use. * common/simple-pwquery.c (agent_open): Ditto. * configure.ac (GPG_AGENT_INFO_NAME): Remove. * g10/server.c (gpg_server): Do not print the AgentInfo comment. * g13/server.c (g13_server): Ditto. * sm/server.c (gpgsm_server): Ditto. * tools/gpgconf.c (main): Simplify by removing non standard socket support. -- The indented fix to allow using a different socket than the one in the gnupg home directory is to change Libassuan to check whether the socket files exists as a regualr file with a special keyword to redirect to another socket file name.
* First changes for future use of NTBTLS.Werner Koch2014-10-023-34/+112
| | | | | | | | | | | | | | * configure.ac (NEED_NTBTLS_ABI, NEED_NTBTLS_VERSION): New. (HTTP_USE_NTBTLS): New. Prefer over GNUTLS. * m4/ntbtls.m4: New. * m4/Makefile.am (EXTRA_DIST): Add new file. * common/http.c: Add conditionals to eventually use NTBTLS. -- This is only the configure stuff. If you have NTBTLS installed GNUTLS will not be used but there won't be any https support either :-(. This patch is used to have a real world test bench for the forthcoming library.
* common: Do not build maintainer modules in non-maintainer mode.Werner Koch2014-09-182-1/+9
| | | | | | * common/Makefile.am (module_maint_tests): Use only in maintainer mode. (t_common_cflags): New.
* common: Remove superfluous statements.Werner Koch2014-09-182-12/+3
| | | | | | | | | | * common/exechelp-posix.c: Remove weak pragmas. * common/sexputil.c (make_canon_sexp_from_rsa_pk): Remove double const. -- We do not use Pth anymore and thus there is no more need for the weak pragmas.
* gpg: Use algorithm id 22 for EdDSA.Werner Koch2014-09-121-2/+2
| | | | | | | | | * common/openpgpdefs.h (PUBKEY_ALGO_EDDSA): Change to 22. * g10/keygen.c (ask_curve): Reword the Curve25519 warning note. -- In the hope that the IETF will eventually assign 22 for EdDSA using the draft-koch-eddsa-for-openpgp-01 specs we start using this number.
* dirmngr: Fix the ks_fetch command for the http scheme.Werner Koch2014-09-101-3/+8
| | | | | | | | | | * common/http.c (http_session_ref): Allow for NULL arg. -- We always test for a an existing session and thus passing NULL as session object should be allowed. Reported-by: Jens Lechtenboerger
* gpg: Fix export of NIST ECC keys.Werner Koch2014-09-021-72/+60
| | | | | | | | | | | | * common/openpgp-oid.c (struct oidtable): New. (openpgp_curve_to_oid): Rewrite and allow OID as input. (openpgp_oid_to_curve): Make use of the new table. -- Due to the previous change we now usually store the OID with the private key and not the name. Thus during import we do not anymore need to map the name to an oid but can use the oid directly. We fix that by extending openpgp_curve_to_oid to allow an oidstr as input.
* Switch to the libgpg-error provided estream.Werner Koch2014-08-2620-7034/+69
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14. (GPGRT_ENABLE_ES_MACROS): Define. (estream_INIT): Remove. * m4/estream.m4: Remove. * common/estream-printf.c, common/estream-printf.h: Remove. * common/estream.c, common/estream.h: Remove. * common/init.c (_init_common_subsystems): Call gpgrt initialization.
* estream: Change license from GPL to LPGL.Werner Koch2014-08-174-24/+24
| | | | | | | | | | | | | * common/estream-printf.c, common/estream-printf.h: Change license. * common/estream.c, common/estream.h: Ditto. -- g10 Code is the sole copyright holder of Libestream and thus as CEO I have the rights to to change the license. This copy here in GnuPG is currently the most current one thus the change is recorded in this repository. This change is also deemed valid for all older versions. Signed-off-by: Werner Koch <[email protected]>
* common: Fix typo in header inclusion protection macro.Werner Koch2014-08-111-1/+1
| | | | | -- GnuPG-bug-id: 1669
* tests: Fix end-of-all-ticks test for Western locales.Werner Koch2014-07-031-0/+16
| | | | | | | | | | * common/t-timestuff.c (test_timegm): Use timegm if available. (main): Set TX to UTC if timegm is not available. -- On OpenBSD 5.3 i386 that test failed due to the use of mktime. Reported-by: Claus Assmann
* estream: Fix minor glitch in "%.*s" format.Werner Koch2014-06-301-1/+3
| | | | | * common/estream-printf.c (pr_string): Take care of non-nul terminated strings.
* gpg: Create exported secret files and revocs with mode 700.Werner Koch2014-06-302-8/+12
| | | | | | | | | | | | | | | * common/iobuf.c (direct_open): Add arg MODE700. (iobuf_create): Ditto. * g10/openfile.c (open_outfile): Add arg RESTRICTEDPERM. Change call callers to pass 0 for it. * g10/revoke.c (gen_desig_revoke, gen_revoke): Here pass true for new arg. * g10/export.c (do_export): Pass true for new arg if SECRET is true. -- GnuPG-bug-id: 1653. Note that this works only if --output has been used.
* common: Minor code cleanup for a legacy OS.Werner Koch2014-06-301-8/+7
| | | | * common/iobuf.c (direct_open) [__riscos__]: Simply cpp conditionals.
* dirmngr: Use the homedir based socket also under W32.Werner Koch2014-06-271-4/+0
| | | | | * common/homedir.c (dirmngr_user_socket_name): Use same code for all platforms.
* http: Print human readable GNUTLS status.Werner Koch2014-06-131-1/+27
| | | | | * common/http.c (send_gnutls_bye): Take care of EAGAIN et al. (http_verify_server_credentials): Print a human readable status.
* w32: Fix build problem with dirmngr.Werner Koch2014-06-101-1/+1
| | | | | * dirmngr/ks-engine-hkp.c (EAI_SYSTEM) [W32]: Add replacement constant.
* gpg: Fix bug parsing a zero length user id.Werner Koch2014-06-021-2/+17
| | | | | | | | | | | | | | | | | * g10/getkey.c (get_user_id): Do not call xmalloc with 0. * common/xmalloc.c (xmalloc, xcalloc): Take extra precaution not to pass 0 to the arguments. -- The problem did not occur in 1.x because over there the xmalloc makes sure to allocate at least one byte. With 2.x for most calls the xmalloc of Libgcrypt is used and Libgcrypt returns an error insteead of silent allocating a byte. Thus gpg 2.x bailed out with an "Fatal: out of core while allocating 0 bytes". The extra code in xmalloc.c is for more robustness for the other xmalloc calls.
* http: Add callback to help logging of server certificates.Werner Koch2014-05-192-20/+38
| | | | | | * common/http.c (http_session_s): Add field cert_log_cb. (http_session_set_log_cb): New. (http_verify_server_credentials): Call callback.
* http: Allow overriding of the Host header.Werner Koch2014-05-162-23/+45
| | | | | | | | | | | | | * common/http.c (http_open): Add arg httphost. (http_open_document): Pass NULL for httphost. (send_request): Add arg httphost. If given, use HTTPHOST instead of SERVER. Use https with a proxy if requested. (http_verify_server_credentials): Do not stop at the first error message. * dirmngr/ocsp.c (do_ocsp_request): Adjust call to http_open. * keyserver/curl-shim.c (curl_easy_perform): Ditto. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. * dirmngr/ks-engine-hkp.c (ks_hkp_help): Ditto.
* w32: Make make_absfilename work with drive letters.Werner Koch2014-05-141-1/+3
| | | | * common/stringhelp.c (do_make_filename) [HAVE_DRIVE_LETTERS]: Fix.
* Make more use of *_NAME macros.Werner Koch2014-05-081-1/+1
| | | | | | | | | * configure.ac (GPG_DISP_NAME, GPGSM_DISP_NAME): New. (GPG_AGENT_DISP_NAME, SCDAEMON_DISP_NAME): New. (DIRMNGR_DISP_NAME, G13_DISP_NAME): New. (GPGCONF_DISP_NAME): New. (SCDAEMON_SOCK_NAME): New. * common/argparse.c (show_help): Map description string.
* Make -jN work again.Werner Koch2014-05-071-1/+4
| | | | | | * common/Makefile.am ($(PROGRAMS)): New rule (t_http_LDADD): Use libcommontls.a without directory prefix. * dirmngr/Makefile.am ($(PROGRAMS)): New rule.
* gpg: Finish experimental support for Ed25519.Werner Koch2014-05-071-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | * agent/cvt-openpgp.c (try_do_unprotect_arg_s): Add field "curve". (get_keygrip): Add and use arg CURVE. (convert_secret_key): Ditto. (convert_transfer_key): Ditto. (get_npkey_nskey): New. (prepare_unprotect): Replace gcrypt functions by get_npkey_nskey. Allow opaque MPIs. (do_unprotect): Use CURVE instead of parameters. (convert_from_openpgp_main): Ditto. (convert_to_openpgp): Simplify. * g10/import.c (one_mpi_from_pkey): Remove. (transfer_secret_keys): Rewrite to use the curve instead of the parameters. * g10/parse-packet.c (parse_key): Mark protected MPIs with USER1 flag. * common/openpgp-oid.c (openpgp_curve_to_oid): Allow the use of "NIST P-256" et al. * g10/keygen.c (ask_curve): Add arg ALGO. (generate_keypair): Rewrite the ECC key logic. * tests/openpgp/ecc.test: Provide the "ecc" passphrase.
* http: Add reference counting to the session object.Werner Koch2014-05-053-47/+100
| | | | | | | | | | | | | | | | | * common/http.c (http_session_t): Add field "refcount". (_my_socket_new, _my_socket_ref, _my_socket_unref): Add debug code. (send_request, my_npth_read, my_npth_write): Use SOCK object for the transport ptr. (http_session_release): Factor all code out to ... (session_unref): here. Deref SOCK. (http_session_new): Init refcount and transport ptr. (http_session_ref): New. Ref and unref all assignments. -- Having the reference counted session objects makes it easier for the application to pass around only an estream. Without that the application would need to implement an es_onclose machinery for the session object.
* http: Add HTTP_FLAG_FORCE_TLS and http_get_tls_info.Werner Koch2014-05-023-43/+178
| | | | | | | | | | | * common/http.c (http_parse_uri): Factor code out to ... (parse_uri): here. Add arg FORCE_TLS. (do_parse_uri): Ditto. Implement flag. (http_get_tls_info): New. (http_register_tls_ca): Allow clearing of the list. (send_request): Use a default verification function. * common/http.h (HTTP_FLAG_FORCE_TLS): New. * common/t-http.c (main): Add several command line options.
* common: Fix test for openpgp_oid_is_ed25519.Werner Koch2014-05-021-1/+6
| | | | | * common/t-openpgp-oid.c (test_openpgp_oid_is_ed25519): Add correct value.
* http: Revamp TLS API.Werner Koch2014-05-025-217/+739
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (NEED_GNUTLS_VERSION): New. (HTTP_USE_GNUTLS, LIBGNUTLS_CFLAGS, LIBGNUTLS_LIBS): New ac_subst. * common/http.h (http_session_t): New. * common/http.c: Remove compatibility for gnutls < 3.0. (http_session_s): New. (cookie_s): Replace gnutls_session_t by http_session_t. (tls_callback, tls_ca_certlist): New variables. (my_socket_unref): Add preclose args. (my_npth_read, my_npth_write): New. (make_header_line): Fix bug using int* instead of char*. (http_register_tls_callback): New. (http_register_tls_ca): New. (http_session_new): New. (http_session_release): New. (http_get_header_names): New. (escape_data): Add hack to escape in forms mode. (send_request) [HTTP_USE_GNUTLS]: Support SNI. (send_request) [HTTP_USE_GNUTLS]: Fix use of make_header_line. (send_gnutls_bye): New. (cookie_close): Make use of preclose feature. (http_verify_server_credentials): New. (main) [TEST]: Remove test code. * common/t-http.c: New. * common/tls-ca.pem: New. * common/Makefile.am (tls_sources): New. Move http code to here. (libcommontls_a_SOURCES): New. (libcommontlsnpth_a_SOURCES): New. (EXTRA_DIST): Add tls-ca.pem (module_maint_tests): Add t-http. (t_http_SOURCES, t_http_CFLAGS, t_http_LDADD): New. * dirmngr/Makefile.am (dirmngr_LDADD): Add libcommontlsnpth. -- This new TLS API for http.c is much more flexible than the crude old hack.
* common: Cleanup the use of USE_NPTH and HAVE_NPTH macros.Werner Koch2014-05-027-54/+37
| | | | | | | | | | | | | | | | | * configure.ac (HAVE_NPTH): New ac_define. * common/estream.c: Use USE_NPTH instead of HAVE_NPTH. * common/http.c: Ditto. Replace remaining calls to pth by npth calls. (connect_server): Remove useless _(). * common/exechelp-posix.c, common/exechelp-w32.c * common/exechelp-w32ce.c: Use HAVE_PTH to include npth.h. * common/init.c (_init_common_subsystems): Remove call to pth_init. * common/sysutils.c (gnupg_sleep): Use npth_sleep. * scd/ccid-driver.c (my_sleep): Ditto. -- USE_NPTH is used in case were we may build with and without nPth. The missing definition HAVE_NPTH didn't allowed us to build outher sources with nPTh support.
* estream: Implement "samethread" mode keyword.Werner Koch2014-04-301-54/+107
| | | | | | | | | | | | | | | | | | | * src/estream.c (estream_internal): Add field SAMETHREAD. (init_stream_lock, lock_stream, trylock_stream, unlock_stream): Use it. (parse_mode): Add arg SAMETHREAD and parse that keyword. (es_initialize): Rename to ... (init_stream_obj): this. Add arg SAMETHREAD. (es_create): Add arg SAMETHREAD. Call init_stream_lock after init_stream_obj. (doreadline): Call es_create with samethread flag. (es_fopen, es_mopen, es_fopenmem, es_fopencookie, do_fdopen) (do_fpopen, do_w32open): Implement "samethread" keyword. (es_freopen): Take samthread flag from old stream. (es_tmpfile): Call es)_create w/o samethread. -- Note: Unfortunately es_tmpfile has no mode arg so that we can't use samethread.
* estream: Fix deadlock in es_fileno.Werner Koch2014-04-301-1/+1
| | | | * src/estream.c (es_fileno_unlocked): Call the unlocked functions.
* estream: Add debug code to the lock functions.Werner Koch2014-04-301-3/+39
| | | | * common/estream.c (dbg_lock_0, dbg_lock_1, dbg_lock_1): New.
* estream: Replace locking macros by functions.Werner Koch2014-04-301-148/+186
| | | | | | | * common/estream.c: Replace most macros. -- The macros were too hard to read and actually blew up the source.
* estream: Migrate from Pth to nPth.Werner Koch2014-04-301-23/+22
| | | | | | -- Actually the mutex stuff was never used since we switched to nPth.
* gpg: Pass --homedir to gpg-agent.Werner Koch2014-04-222-14/+46
| | | | | | | | | | | | | | | * agent/gpg-agent.c (main): Make sure homedir is absolute. * common/asshelp.c (lock_spawning): Create lock file with an absolute name. (start_new_gpg_agent): Use an absolute name for the socket and pass option --homedir to the agent. (start_new_dirmngr): Use an absolute name for the --homedir. -- This patch makes gpg's --homedir option behave again like in older versions. This is done by starting a new agent for each different home directory. Note that this assumes --use-standard-socket is used which is the default for 2.1.
* common: Add functions make_absfilename and make_absfilename_try.Werner Koch2014-04-223-2/+174
| | | | | | * common/stringhelp.c (do_make_filename): Add modes 2 and 3. (make_absfilename): New. (make_absfilename_try): New.
* common: Add function gnupg_getcwd.Werner Koch2014-04-222-0/+31
| | | | | | * tools/gpg-connect-agent.c (gnu_getcwd): Move to ... * common/sysutils.c (gnupg_getcwd): .. here. * tools/gpg-connect-agent.c (get_var_ext): Use gnupg_getcwd.
* common: Add z-base-32 encoder.Werner Koch2014-04-174-2/+235
| | | | | | | * common/zb32.c: New. * common/t-zb32.c: New. * common/Makefile.am (common_sources): Add zb82.c (module_tests): Add t-zb32.
* Two minor code cleanups and one NULL deref on error fix.Werner Koch2014-04-161-1/+1
| | | | | | | | | | * common/estream.c (es_freopen): Remove useless check for STREAM. * kbx/keybox-blob.c (_keybox_create_x509_blob): Remove useless check for BLOB. * tools/sockprox.c (run_proxy): Do not fclose(NULL). -- Found by Hans-Christoph Steiner with cppcheck.
* dirmngr: Fix compiler warning.Werner Koch2014-04-081-0/+2
| | | | | | | | | | * common/mischelp.h (JNLIB_GCC_HAVE_PUSH_PRAGMA): New. * dirmngr/dirmngr.c (handle_tick): Factor time check out to ... (time_for_housekeeping_p): new. -- I am not sure whether that y2038 hack is really useful but it might make me smile in my retirement.
* g10: EdDSA support.NIIBE Yutaka2014-04-081-1/+1
| | | | | | * g10/keyid.c (keygrip_from_pk): Compute keygrip of EdDSA key. * g10/keygen.c (generate_subkeypair): Ed25519 is for EdDSA. * common/openpgp-oid.c (oid_ed25519): Update.
* Change some keyedit functions to allow printing to arbitrary streams.Werner Koch2014-03-272-35/+85
| | | | | | | | | | | * common/ttyio.c (tty_print_string): Add optional arg FP. Change all callers. (tty_print_utf8_string2): Ditto. * g10/keyedit.c (show_prefs): Ditto. (show_key_with_all_names_colon): Ditto. (show_names): Ditto. * g10/keylist.c (print_revokers): Ditto. (print_fingerprint): Ditto.
* agent: Cleanups to prepare implementation of Ed25519.Werner Koch2014-03-221-38/+103
| | | | | | | | | | | | * agent/cvt-openpgp.c: Remove. (convert_to_openpgp): Use gcry_sexp_extract_param. * agent/findkey.c (is_eddsa): New. (agent_is_dsa_key, agent_is_eddsa_key): Check whether ecc means EdDSA. * agent/pksign.c (agent_pksign_do): Add args OVERRIDEDATA and OVERRIDEDATALEN. * common/ssh-utils.c (is_eddsa): New. (get_fingerprint): Take care or EdDSA.
* common: New function elapsed_time_string.Werner Koch2014-03-182-0/+41
| | | | * common/gettime.c (elapsed_time_string): New.
* dirmngr: Make use of IPv4 and IPV6 more explicit.Werner Koch2014-03-142-6/+12
| | | | | | | | | * common/http.c (connect_server): Handle the new flags. * common/http.h (HTTP_FLAG_IGNORE_IPv4, HTTP_FLAG_IGNORE_IPv4): New. * dirmngr/ks-engine-hkp.c (map_host): Add arg r_httpflags. (make_host_part): Ditto. (send_request): Add arg httpflags. (ks_hkp_search, ks_hkp_get, ks_hkp_put): Handle httpflags.
* gpg: Print the actual used keyserver address.Werner Koch2014-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | * dirmngr/ks-engine-hkp.c (ks_hkp_search, ks_hkp_get): Print SOURCE status lines. * g10/call-dirmngr.c (ks_status_parm_s): New. (ks_search_parm_s): Add field stparm. (ks_status_cb): New. (ks_search_data_cb): Send source to the data callback. (gpg_dirmngr_ks_search): Change callback prototope to include the SPECIAL arg. Adjust all users. Use ks_status_cb. (gpg_dirmngr_ks_get): Add arg r_source and use ks_status_cb. * g10/keyserver.c (search_line_handler): Adjust callback and print "data source" disgnostic. (keyserver_get): Print data source diagnostic. -- It has often been requested that the actually used IP of a keyservers is shown in with gpg --recv-key and --search-key. This is helpful if the keyserver is actually a pool of keyservers. This patch does this.
* dirmngr: Default to a user socket name and enable autostart.Werner Koch2014-03-143-12/+67
| | | | | | | | | | | | | | | * common/homedir.c (dirmngr_socket_name): Rename to dirmngr_sys_socket_name. (dirmngr_user_socket_name): New. * common/asshelp.c (start_new_dirmngr): Handle sys and user dirmngr socket. * dirmngr/dirmngr.c (main): Ditto. * dirmngr/server.c (cmd_getinfo): Ditto. * sm/server.c (gpgsm_server): Ditto. * dirmngr/dirmngr-client.c (start_dirmngr): Likewise. * tools/gpgconf.c (main): Print "dirmngr-sys-socket" with --list-dirs. * configure.ac (USE_DIRMNGR_AUTO_START): Set by default.
* gpg: Add option --dirmngr-program.Werner Koch2014-03-121-0/+6
| | | | | | | | | | | * g10/gpg.c: Add option --dirmngr-program. * g10/options.h (struct opt): Add field dirmngr_program. * g10/call-dirmngr.c (create_context): Use new var. * dirmngr/dirmngr.c: Include gc-opt-flags.h. (main): Remove GC_OPT_FLAG_*. * tools/gpgconf-comp.c (GC_OPT_FLAG_NO_CHANGE): Move macro to ... * common/gc-opt-flags.h: here.
* http: Add a flag to the URL parser indicating a literal v6 address.Werner Koch2014-03-122-0/+3
| | | | | * common/http.h (struct parsed_uri_t): Add field v6lit. * common/http.c (do_parse_uri): Set v6lit.
* Use attribute __gnu_printf__ also in estream header files.Werner Koch2014-03-072-10/+18
| | | | | * common/estream-printf.h: Use attribute gnu_printf. * common/estream.h: Ditto.