summaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common,gpg,sm: Initialize compliance module.Justus Winter2017-06-072-0/+65
| | | | | | | | | | * common/compliance.c (gnupg_initialize_compliance): New function. * common/compliance.h (gnupg_initialize_compliance): New prototype. * g10/gpg.c (main): Use the new function. * sm/gpgsm.c (main): Likewise. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* common,gpg: Move the compliance option printer.Justus Winter2017-06-072-0/+21
| | | | | | | | | | | | | | * common/compliance.c (gnupg_compliance_option_string): New function. * common/compliance.h (gnupg_compliance_option_string): New prototype. * g10/encrypt.c (write_pubkey_enc_from_list): Update callsite. * g10/gpg.c (main): Likewise. * g10/keyedit.c (keyedit_menu): Likewise. * g10/pkclist.c (build_pk_list): Likewise. * g10/main.h (compliance_option_string): Remove prototype. * g10/misc.c (compliance_option_string): Remove function. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* common,gpg,sm: Move the compliance option parser.Justus Winter2017-06-072-0/+44
| | | | | | | | | | | | | | * common/compliance.c (gnupg_parse_compliance_option): New function. * common/compliance.h (struct gnupg_compliance_option): New type. (gnupg_parse_compliance_option): New prototype. * g10/gpg.c (parse_compliance_option): Remove function. (compliance_options): New variable. (main): Adapt callsite. * sm/gpgsm.c (main): Use the new common function. * sm/gpgsm.h (opt): New field 'compliance'. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* common,g10: Fix typos.Justus Winter2017-06-061-3/+3
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Report compliance with CO_DE_VS.Justus Winter2017-06-013-3/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_compliant): Add DSA with certain parameters. (gnupg_cipher_is_compliant): New function. (gnupg_digest_is_compliant): Likewise. * common/compliance.h (gnupg_cipher_is_compliant): New prototype. (gnupg_digest_is_compliant): Likewise. * common/status.h (STATUS_DECRYPTION_COMPLIANCE_MODE): New status. (STATUS_VERIFICATION_COMPLIANCE_MODE): Likewise. * doc/DETAILS: Document the new status lines. * g10/mainproc.c (proc_encrypted): Compute compliance with CO_DE_VS and report that using the new status line. (check_sig_and_print): Likewise. * sm/decrypt.c (gpgsm_decrypt): Likewise. * sm/verify.c (gpgsm_verify): Likewise. -- When decrypting data and verifying signatures, report whether the operations are in compliance with the criteria for data classified as VS-NfD. This information will be picked up by the frontend and presented to the user. GnuPG-bug-id: 3059 Signed-off-by: Justus Winter <justus@g10code.com>
* common: Improve checking for compliance with CO_DE_VS.Justus Winter2017-06-011-1/+3
| | | | | | | * common/compliance.c (gnupg_pk_is_compliant): Only certain RSA key sizes are compliant. Signed-off-by: Justus Winter <justus@g10code.com>
* gpg,common: Move the compliance framework.Justus Winter2017-06-013-1/+193
| | | | | | | | | | | | | | * common/Makefile.am (common_sources): Add new files. * common/compliance.c: New file. Move 'gnupg_pk_is_compliant' here, and tweak it to not rely on types private to gpg. * common/compliance.h: New file. Move the compliance enum here. * g10/keylist.c (print_compliance_flags): Adapt callsite. * g10/main.h (gnupg_pk_is_compliant): Remove prototype. * g10/misc.c (gnupg_pk_is_compliant): Remove function. * g10/options.h (opt): Use the new compliance enum. * sm/keylist.c (print_compliance_flags): Use the common functions. Signed-off-by: Justus Winter <justus@g10code.com>
* common: Correctly render SHA256-based ssh fingerprints.Justus Winter2017-05-242-14/+158
| | | | | | | | | | | | | | * common/ssh-utils.c (dummy_realloc): New function. (dummy_free): Likewise. (get_fingerprint): Prepend the fingerprint with the name of the digest algorithm. Correctly render SHA256-based ssh fingerprints. * common/t-ssh-utils.c (sample_keys): Add SHA256 hashes for the keys. (main): Add an option to dump the keys to gather fingerprints, also print the SHA256 fingerprint for keys given as arguments, and check the SHA256 fingerprints of the test keys. GnuPG-bug-id: 2106 Signed-off-by: Justus Winter <justus@g10code.com>
* common: Support different digest algorithms for ssh fingerprints.Justus Winter2017-05-243-32/+37
| | | | | | | | | | | | | | | | * common/ssh-utils.c (get_fingerprint): Add and honor 'algo' parameter. (ssh_get_fingerprint{,_string}): Likewise. * common/ssh-utils.h (ssh_get_fingerprint{,_string}): Update prototypes. * common/t-ssh-utils.c (main): Adapt accordingly. * agent/command-ssh.c (agent_raw_key_from_file): Likewise. (ssh_identity_register): Likewise. * agent/command.c (do_one_keyinfo): Likewise. * agent/findkey.c (modify_description): Likewise. -- This lays the foundation to support other algorithms. GnuPG-bug-id: 2106 Signed-off-by: Justus Winter <justus@g10code.com>
* common: Let format_text return an error.Werner Koch2017-05-152-16/+25
| | | | | | | | | | | | | | | * common/stringhelp.c (format_text): Return NULL on error. * common/t-stringhelp.c (test_format_text): Adjust for change. * g10/gpgcompose.c (show_help): Abort on out of core. * g10/tofu.c (ask_about_binding): Abort on format_text error. (show_statistics): Ditto. (show_warning): Ditto. -- For better re-usability function in common/ shot better not use xmalloc functions. Signed-off-by: Werner Koch <wk@gnupg.org>
* tests: Make it possible to run all tests using our infrastructure.Justus Winter2017-05-112-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (TESTS_ENVIRONMENT): New variable. (check-all): New phony target to run all tests. * tests/gpgme/gpgme-defs.scm (have-gpgme?): New function that tests whether the GPGME test suite is available instead of exiting the process. * tests/gpgscm/init.scm (export): New macro. * tests/gpgscm/tests.scm (run-tests): New function. (load-tests): Likewise. * tests/gpgme/run-tests.scm: Simplify and move the parsing of the list of tests to 'all-tests.scm'. * tests/gpgsm/run-tests.scm: Likewise. * tests/migrations/run-tests.scm: Likewise. * tests/openpgp/run-tests.scm: Likewise. * tests/gpgme/Makefile.am: To select the tests to run, use the variable 'TESTS'. This harmonizes the interface with the automake test suite. * tests/gpgsm/Makefile.am: Likewise. * tests/migrations/Makefile.am: Likewise. * tests/openpgp/Makefile.am: Likewise. * tests/openpgp/README: Likewise. * agent/all-tests.scm: New file. * common/all-tests.scm: Likewise. * g10/all-tests.scm: Likewise. * g13/all-tests.scm: Likewise. * tests/gpgme/all-tests.scm: Likewise. * tests/gpgsm/all-tests.scm: Likewise. * tests/migrations/all-tests.scm: Likewise. * tests/openpgp/all-tests.scm: Likewise. * tests/run-tests.scm: Likewise. -- This change allows us to run all tests in parallel and write one XML report capturing the results of every test. It also lays the foundation to parametrize test suites. Signed-off-by: Justus Winter <justus@g10code.com>
* g10, sm, dirmngr, common: Add comment for fall through.NIIBE Yutaka2017-05-101-0/+1
| | | | | | | | | | | | | | | * common/b64dec.c (b64dec_proc): Comment to clarify. * dirmngr/cdblib.c (cdb_make_put): Use same pattern to clarify. * dirmngr/dirmngr-client.c (read_pem_certificate): Likewise. * dirmngr/ks-engine-hkp.c (ks_hkp_get): Likewise. * g10/armor.c (unarmor_pump): Likewise. * g10/gpg.c (main): Likewise. * g10/import.c (read_block): Likewise. * g10/keygen.c (make_backsig): Likewise. * g10/pkclist.c (check_signatures_trust): Likewise. * sm/gpgsm.c (main): Likewise. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-2813-15/+15
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common, g10: Fix enumeration types.NIIBE Yutaka2017-04-131-4/+8
| | | | | | | | | | | | | | | | * common/openpgpdefs.h (CIPHER_ALGO_PRIVATE10, PUBKEY_ALGO_PRIVATE10) (DIGEST_ALGO_PRIVATE10, COMPRESS_ALGO_PRIVATE10): New. * g10/misc.c (map_pk_gcry_to_openpgp): Add type conversion. (map_cipher_openpgp_to_gcry, openpgp_cipher_algo_name) (openpgp_pk_test_algo2, map_md_openpgp_to_gcry) (pubkey_get_npkey): Add default handling. -- Compilers may emit code assuming the maximum value of enum type. According to OpenPGP specification, there are cases for private uses. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common: Simplify format_text.NIIBE Yutaka2017-04-123-7/+6
| | | | | | | | | | | * common/stringhelp.c (format_text): Don't allow IN_PLACE formatting. * common/stringhelp.h: Change the API with no IN_PLACE. * common/t-stringhelp.c (test_format_text): Follow the change. * g10/gpgcompose.c (show_help): Likewise. * g10/tofu.c (format_conflict_msg_part1, ask_about_binding) (show_statistics, show_warning): Likewise. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common: Portability fix for logging.c.NIIBE Yutaka2017-04-111-4/+8
| | | | | | | * common/logging.c (S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH): Avoid duplicated definition. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common: Avoid undefined behavior.Justus Winter2017-03-301-1/+1
| | | | | | | * common/iobuf.c (iobuf_read_line): Do not consider 'length' if 'buffer' is NULL. Signed-off-by: Justus Winter <justus@g10code.com>
* common: Fix connecting to the agent.Justus Winter2017-03-271-0/+2
| | | | | | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Fix error handling. -- Prior to 26086b36 the non-existance of the socket directory was considered an error if a non-default home directory is used. Since 26086b36 we now create the directory on demand, but the function still returned the fallback path. This made the agent bind the socket in the socket directory, and the client trying to connect to the socket in the home directory. Fixes-commit: 26086b362ff47d21b1abefaf674a6464bf0a8921 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Improve check for already compressed packets.Werner Koch2017-03-241-6/+57
| | | | | | | | | | | | | | * common/miscellaneous.c (is_openpgp_compressed_packet): New. (is_file_compressed): Rerad 2 more bytes and call new function. -- Note that this does not yet allow to detect compressed data piped to gpg. This requires a proper read-ahead in iobuf.c which is complicated due to the auto-removal of filter functions. Thus such an read-ahead needs to be done in the I/O backend of iobuf. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Implicitly do a gpgconf --create-socketdir.Werner Koch2017-03-231-7/+18
| | | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal): Create the sub-directory. -- Although there is no auto cleanup (yet) this should be helpful. Let's see whether possibly leaving stale directories around is better than running into trouble when --create-socketdir was not used. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix warning for portability.NIIBE Yutaka2017-03-071-0/+1
| | | | | | | | * common/localename.c (do_nl_locale_name): We don't use CATEGORY. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common,tools: Always escape newlines when escaping data.Justus Winter2017-03-021-1/+9
| | | | | | | | | | * common/stringhelp.c (do_percent_escape): Always escape newlines. * tools/gpgconf-comp.c (gc_percent_escape): Likewise. -- Newlines always pose a problem for a line-based communication format. GnuPG-bug-id: 2387 Signed-off-by: Justus Winter <justus@g10code.com>
* build: Add kludge for "make distcheck" in a release build.Werner Koch2017-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * configure.ac: New option --enable-gnupg-builddir-envvar. (ENABLE_GNUPG_BUILDDIR_ENVVAR): New ac_define. * common/homedir.c (gnupg_set_builddir_from_env): Consider ENABLE_GNUPG_BUILDDIR_ENVVAR. * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Rename to ... (AM_DISTCHECK_CONFIGURE_FLAGS): this to be future proof. Add option --enable-gnupg-builddir-envvar. -- Our regression test suite makes use of the envvar GNUPG_BUILDDIR. Now the code in gnupg for evaluating this envvar is only included in a development version (that is one with a "-betaNNN" suffix). For a real release the envvar is not considered. However during a "make distcheck" a "make check" is done for the build directory. Without defining that envar we would try to run binaries in the install directory ("_inst" sub-directory) which are not yet installed at that time. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Allow creating keys using an existing ECC key.Werner Koch2017-03-012-50/+21
| | | | | | | | | | | * 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 <wk@gnupg.org>
* w32: Make pipes really pollable.Werner Koch2017-02-282-2/+15
| | | | | | | | | | | | | | | | | | | * common/exectool.c (gnupg_exec_tool_stream) [W32]: Use _get_osfhandle to print the fd for the command line. * common/exechelp-w32.c (create_pipe_and_estream): Use es_sysopen so that the streams are actually pollable. -- This addresses two bugs: - Using the "-&@INEXTRA@" kludges requires that we pass the value of the handle on the command line and not the libc fd. - gpgrt_poll requires the use of the ReadFile/WriteFile backend which is currently only used when the stream has been created with gpgrt_sysopen. Signed-off-by: Werner Koch <wk@gnupg.org>
* Clarify text of LGPLv2+/GPLv2+ licensed files.Werner Koch2017-02-2425-50/+50
| | | | --
* gpg: Emit new status DECRYPTION_KEYWerner Koch2017-02-231-0/+1
| | | | | | | * common/status.h (STATUS_DECRYPTION_KEY): New. * g10/pubkey-enc.c (get_it): Emit that status. Signed-off-by: Werner Koch <wk@gnupg.org>
* Clean up word replication.Yuri Chornoivan2017-02-2113-16/+16
| | | | | | | | | -- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* common: New function log_logv_with_prefix.Werner Koch2017-02-202-11/+27
| | | | | | | | | * common/logging.c (do_logv): Add arg 'prefmt' and print it. Chnage call callers to pass NULL. (log_logv_with_prefix): New. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Rename remaining symbols in ksba-io-support.Werner Koch2017-02-162-20/+26
| | | | | | | | | | | | | | | | | | * common/ksba-io-support.c (gpgsm_reader_eof_seen): Rename to ... (gnupg_ksba_reader_eof_seen): this. Change all callers. (gpgsm_destroy_reader): Rename to ... (gnupg_ksba_destroy_reader): this. Change all callers. (gpgsm_finish_writer): Rename to ... (gnupg_ksba_finish_writer): this. Change all callers. (gpgsm_destroy_writer): Rename to ... (gnupg_ksba_destroy_writer): this. Change all callers. * common/ksba-io-support.c (struct base64_context_s): Rename to ... (gnupg_ksba_io_s): this. * common/ksba-io-support.h (base64_context_s): Ditto. (Base64Context): Rename this typedef to ... (gnupg_ksba_io_t): this. Change all users. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Remove gpgsm dependencies from ksba-io-support.Werner Koch2017-02-162-35/+104
| | | | | | | | | | | | | | | | | * common/ksba-io-support.c: Include ksba-io-support.h instead of ../sm/gpgsm.h. Include util.h. (writer_cb_parm_s): Remove const from 'pem_name'. (gpgsm_destroy_writer): Free 'pem_name'. (gpgsm_create_reader): Rename to ... (gnupg_ksba_create_reader): this. Replace args CTRL and ALLOW_MULTI_PEM by a new arg FLAGS. Change the code to evaluate FLAGS. Change all callers to pass the FLAGS. (gpgsm_create_writer): Rename to ... (gnupg_ksba_create_writer): this. Replace arg CTRL by new arg FLAGS. Add arg PEM_NAME. Evaluate FLAGS. Store a copy of PEM_NAME. Change all callers to pass the FLAGS and PEM_NAME. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Change license of ksba-io-support.cWerner Koch2017-02-161-6/+17
| | | | | | | | | | | * common/ksba-io-support.c: Change from GPLv3+ to LGPLv3+/GPLv2+. -- According to the sm/ChangeLog-2011 and the git log all code has been written by me or g10 Code employees. Also changed the copyright notices so that the file can be sued separately. Signed-off-by: Werner Koch <wk@gnupg.org>
* sm,common: Move ksba reader and writer support to common/.Werner Koch2017-02-163-1/+736
| | | | | | | | | | * sm/base64.c: Rename to ... * common/ksba-io-support.c: this. * common/ksba-io-support.h: New. * common/Makefile.am (common_sources): Add new files. * sm/Makefile.am (gpgsm_SOURCES): Remove base64.c Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Avoid warning about implicit declaration of gnupg_fd_valid.Daniel Kahn Gillmor2017-02-081-0/+1
| | | | | | | | | | | | | | | * common/logging.c: Add #include "sysutils.h". -- Without this, we see: logging.c:573:9: warning: implicit declaration of function \ ‘gnupg_fd_valid’ [-Wimplicit-function-declaration] if (! gnupg_fd_valid (fd)) ^~~~~~~~~~~~~~ Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* gpg,common: Make sure that all fd given are valid.Justus Winter2017-02-083-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/sysutils.c (gnupg_fd_valid): New function. * common/sysutils.h (gnupg_fd_valid): New declaration. * common/logging.c (log_set_file): Use the new function. * g10/cpr.c (set_status_fd): Likewise. * g10/gpg.c (main): Likewise. * g10/keylist.c (read_sessionkey_from_fd): Likewise. * g10/passphrase.c (set_attrib_fd): Likewise. * tests/openpgp/Makefile.am (XTESTS): Add the new test. * tests/openpgp/issue2941.scm: New file. -- Consider a situation where the user passes "--status-fd 3" but file descriptor 3 is not open. During the course of executing the rest of the commands, it's possible that gpg itself will open some files, and file descriptor 3 will get allocated. In this situation, the status information will be appended directly to whatever file happens to have landed on fd 3 (the trustdb? the keyring?). This is a potential data destruction issue for all writable file descriptor options: --status-fd --attribute-fd --logger-fd It's also a potential issue for readable file descriptor options, but the risk is merely weird behavior, and not data corruption: --override-session-key-fd --passphrase-fd --command-fd Fixes this by checking whether the fd is valid early on before using it. GnuPG-bug-id: 2941 Signed-off-by: Justus Winter <justus@g10code.com>
* Update copyright notices for 2017.Werner Koch2017-01-232-3/+3
| | | | | | | | -- Also some http:// -> https:// fixes. Signed-off-by: Werner Koch <wk@gnupg.org>
* Fix format string errors and some missing error case initialization.Werner Koch2017-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.c (do_logv): Remove extra parentheses in comparison. * dirmngr/dns-stuff.c (resolve_addr_libdns): Init RES so that dns_res_close is given a defined value in the error case. * dirmngr/http.c (cookie_read, cookie_write) [HTTP_USE_NTBTLS]: Fix format string char. * dirmngr/ks-engine-hkp.c (ks_hkp_help): Remove duplicate "const". * dirmngr/ks-engine-http.c (ks_http_help): Ditto. * dirmngr/ks-engine-kdns.c (ks_kdns_help): Ditto. * dirmngr/ks-engine-ldap.c (ks_ldap_help): Ditto. * scd/app-p15.c (send_keypairinfo, do_getattr): Fix format string char. * tools/gpgconf-comp.c (gpg_agent_runtime_change): Init PID for the error case. (scdaemon_runtime_change): Ditto. (dirmngr_runtime_change): Ditto. * tools/gpgconf.c (query_swdb): Init VALUE_SIZE_UL. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix buffer copy code again.Werner Koch2017-01-191-20/+14
| | | | | | | | | | | | * common/exectool.c (my_error_from_errno): Remove. (copy_buffer_do_copy): Do without var RC. (copy_buffer_flush): Ditto. Use ERRNO instead of es_write return code. (gnupg_exec_tool): Correctly return errors from es_read. -- Fixes-commit: 55c9212a2338bf0b07c8cf3a69bcedaa28d48d43 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Allow to freeze faked system time.Damien Goutte-Gattat2017-01-191-1/+1
| | | | | | | | | | | | | | | | * g10/gpg.c (main): If the parameter for --faked-system-time ends with a '!', freeze time at the specified point. * common/gettime.c (gnupg_set_time): Allow to freeze the time at an arbitrary time instead of only the current time. * doc/gpg.texi: Update documentation for --faked-system-time. -- This patch allows the user to modify the behavior of the --faked-system-time option: by appending a '!' to the parameter, time in GnuPG will be frozen at the specified time, instead of advancing normally from that time onward. Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
* common: Clarify use of vars in buffer copy code.Werner Koch2017-01-191-16/+26
| | | | | | | | | | | | | | | * common/exectool.c (my_error_from_errno): New. (copy_buffer_do_copy): Use separate vars for errno values and gpg-error values for clarity. s/assert/log_assert/. (copy_buffer_flush): Ditto. (gnupg_exec_tool_stream): Use gpg_err_code when testing. -- NB: It is surprising that es_write seems not to set ERRNO but only returns the ERRNO value. Need to check whether this is really the case. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix flushing copy buffers.Justus Winter2017-01-181-7/+19
| | | | | | | | | * common/exectool.c (copy_buffer_flush): Write and flush the data, but do not hide EAGAIN from the caller. (gnupg_exec_tool_stream): Retry on EAGAIN. GnuPG-bug-id: 2425 Signed-off-by: Justus Winter <justus@g10code.com>
* common: Remove unused function tty_print_string.Werner Koch2017-01-172-83/+46
| | | | | | | | * common/ttyio.c (tty_print_string): Rename to ... (do_print_string): this. Make local. Simplify FP case by using print_utf8_buffer. Change caller. Signed-off-by: Werner Koch <wk@gnupg.org>
* tests: Fix t-gettime for a time_t of 64 and a long of 32 bit.Werner Koch2017-01-121-4/+13
| | | | | | | | | | | | * configure.ac (AC_CHECK_HEADERS): Add stdint.h. * common/t-gettime.c: Include stdint.h. (UINTMAX_C): Define replacement. (test_isotime2epoch): Use UINTMAX_C for the >32 bit constants. -- This is for example the case on 32 bit OpenBSD. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: New function log_debug_with_string.Werner Koch2017-01-112-37/+106
| | | | | | | | | | | | | | | * common/logging.c (do_logv): Factor some code out to ... (print_prefix): new. (log_logv): Add arg EXTRASTRING and print it. Change all callers to pass NULL for it. (log_debug_with_string): New. Uses EXTRASTRING. -- This function can be used to print a human readable buffer in addition to a log message to the log stream. This function will keep all lines together and prefix them with ">> ". Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Avoid unnecessary ambiguity in argparse.Daniel Kahn Gillmor2017-01-111-1/+3
| | | | | | | | | | | | | * common/argparse.c (find_long_option): Avoid unnecessary ambiguity. -- If two struct ARGPARSE_OPTS share a prefix in their long_opt name, but have the exact same short_opt and flags, they are aliases and not distinct options. Avoid reporting this as an ambiguity, so that (for example) both --clearsign and --clear-sign can be invoked as --clear. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Debian-Bug-Id: 850475
* common: Fix fallback code.Justus Winter2017-01-102-2/+2
| | | | | | | | * common/logging.c (_log_assert): Fix the variant for compilers that do not support __FUNCTION__. * common/logging.h (_log_assert): Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* agent,w32: Fix annoying output to DebugView.Werner Koch2017-01-061-5/+8
| | | | | | | | | * agent/gpg-agent.c (startup_fd_list): Do not define for W32. (main) [W32]: Do not call get_all_open_fds. -- GnuPG-bug-id: 2267 Signed-off-by: Werner Koch <wk@gnupg.org>
* Silence two -Wlogical-op warnings.Werner Koch2017-01-051-2/+2
| | | | | | | | * common/tlv.c (parse_ber_header): Avoid compiler warning about a duplicate condition. * tools/gpgtar-create.c (pattern_valid_p): Likewise. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Turn assertions into expressions.Justus Winter2017-01-021-8/+8
| | | | | | | * common/logging.h (log_assert): Turn this into an expression so it can be used in expressions. Signed-off-by: Justus Winter <justus@g10code.com>
* Replace use of variable-length-arrays.Werner Koch2017-01-021-2/+4
| | | | | | | | | | | | | * common/t-iobuf.c (main): Replace variable-length-array. * g10/gpgcompose.c (mksubpkt_callback): Ditto. (encrypted): Ditto. * g10/t-stutter.c (log_hexdump): Ditto. (oracle_test): Ditto. * g10/tofu.c (get_policy): Ditto. Use "%zu" for size_t. * scd/app-openpgp.c (ecc_writekey): Replace variable-length-array. Check for zero length OID_LEN. Signed-off-by: Werner Koch <wk@gnupg.org>