aboutsummaryrefslogtreecommitdiffstats
path: root/common (follow)
Commit message (Collapse)AuthorAgeFilesLines
* http: Add flag to force use of TOR (part 1)Werner Koch2015-09-183-1/+22
| | | | | | | | * common/http.h (HTTP_FLAG_FORCE_TOR): New. * common/http.c (http_raw_connect, send_request): Detect flag and return an error for now. Signed-off-by: Werner Koch <[email protected]>
* iobuf: Reduce verbosity of test.Neal H. Walfield2015-09-021-0/+2
| | | | | | | * common/t-iobuf.c (main): Reduce verbosity. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* iobuf: Add the IOBUF_INPUT_TEMP type to improve input temp handling.Neal H. Walfield2015-09-022-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/iobuf.h (enum iobuf_use): Add new member, IOBUF_INPUT_TEMP. * common/iobuf.c (iobuf_temp_with_content): Create the iobuf as an IOBUF_INPUT_TEMP, not an IOBUF_INPUT buffer. Assert that LENGTH == A->D.SIZE. (iobuf_push_filter2): If A is an IOBUF_INPUT_TEMP, then make the new filter an IOBUF_INPUT filter and set its buffer size to IOBUF_BUFFER_SIZE. (underflow): If A is an IOBUF_INPUT_TEMP, then just return EOF; don't remove already read data. (iobuf_seek): If A is an IOBUF_INPUT_TEMP, don't discard the buffered data. (iobuf_alloc): Allow USE == IOBUF_INPUT_TEMP. (pop_filter): Allow USE == IOBUF_INPUT_TEMP. (iobuf_peek): Allow USE == IOBUF_INPUT_TEMP. (iobuf_writebyte): Fail if USE == IOBUF_INPUT_TEMP. (iobuf_write): Fail if USE == IOBUF_INPUT_TEMP. (iobuf_writestr): Fail if USE == IOBUF_INPUT_TEMP. (iobuf_flush_temp): Fail if USE == IOBUF_INPUT_TEMP. -- Signed-off-by: Neal H. Walfield <[email protected]>. Introduce a new iobuf type, IOBUF_INPUT_TEMP. Use this for the iobuf created by iobuf_temp_with_content instead of IOBUF_INPUT. This was necessary so that seeking and peeking correctly work on this type of iobuf. In particular, seeking didn't work because we discarded the buffered data and peeking didn't work because we discarded data which was already read, which made seeking later impossible.
* iobuf: Rename IOBUF_TEMP to IOBUF_OUTPUT_TEMP.Neal H. Walfield2015-09-022-29/+38
| | | | | | | | * common/iobuf.h (enum iobuf_use): Rename IOBUF_TEMP to IOBUF_OUTPUT_TEMP. Update users. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* iobuf: Use a first-class enum.Neal H. Walfield2015-09-021-2/+2
| | | | | | | | * common/iobuf.h (enum iobuf_use): Name the IOBUF_OUTPUT, etc. enum. (struct iobuf_struct): Change the field use's type to it. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* iobuf: Fix test.Neal H. Walfield2015-09-021-9/+6
| | | | | | | | | * common/t-iobuf.c (content_filter): If there is nothing to read, don't forget to set *LEN to 0. (main): Fix checks. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common: Assume an utf-8 locale on iconv errors.Werner Koch2015-09-011-6/+4
| | | | | | * common/utf8conv.c (handle_iconv_error): Use utf-8 as fallback. Signed-off-by: Werner Koch <[email protected]>
* common: Fix regression in building argpase.c standalone.Werner Koch2015-09-011-0/+7
| | | | * common/argparse.c (is_native_utf8) [GNUPG_MAJOR_VERSION]: New.
* gpg: Print a new FAILURE status after most commands.Werner Koch2015-08-251-2/+3
| | | | | | | | | | | | | | | | | | * common/status.h (STATUS_FAILURE): New. * g10/cpr.c (write_status_failure): New. * g10/gpg.c (main): Call write_status_failure for all commands which print an error message here. * g10/call-agent.c (start_agent): Print an STATUS_ERROR if we can't set the pinentry mode. -- This status line can be used similar to the error code returned by commands send over the Assuan interface in gpgsm. We don't emit them in gpgsm because there we already have that Assuan interface to return proper error code. This change helps GPGME to return better error codes. Signed-off-by: Werner Koch <[email protected]>
* doc: Remove C++ style comments and update HACKING.Werner Koch2015-08-201-9/+9
| | | | --
* common/iobuf.c: Make control flow more obvious.Neal H. Walfield2015-08-201-73/+79
| | | | | | | | | | * common/iobuf.c (iobuf_read): Make control flow more obvious. (iobuf_get_filelength): Likewise. (iobuf_get_fd): Likewise. (iobuf_seek): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Add some sanity checks to catch programmer bugs.Neal H. Walfield2015-08-201-0/+42
| | | | | | | | | | | | | * common/iobuf.c (iobuf_alloc): Check that BUFSIZE is not 0. (iobuf_readbyte): Check that A is an input filter. Check that the amount of read data is at most the amount of buffered data. (iobuf_read): Check that A is an input filter. (iobuf_writebyte): Check that A is not an input filter. (iobuf_writestr): Check that A is not an input filter. (iobuf_flush_temp): Check that A is not an input filter. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c:iobuf_write_temp: Elide redundant code.Neal H. Walfield2015-08-201-4/+6
| | | | | | | | * common/iobuf.c (iobuf_write_temp): Don't repeat iobuf_flush_temp. Use it directly. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Have iobuf_writestr use iobuf_write, not iobuf_writebyteNeal H. Walfield2015-08-201-6/+1
| | | | | | | | * common/iobuf.c (iobuf_write): Don't write a byte at a time. Use iobuf_write. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf: Improve documentation and code comments.Neal H. Walfield2015-08-202-149/+530
| | | | | | | | common/iobuf.h: Improve documentation and code comments. common/iobuf.c: Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Adjust buffer size of filters in front of temp filters.Neal H. Walfield2015-08-201-2/+15
| | | | | | | | * common/iobuf.c (iobuf_push_filter2): If the head filter is a temp filter, use IOBUF_BUFFER_SIZE for the new filter. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Buffered data should not be processed by new filters.Neal H. Walfield2015-08-202-17/+116
| | | | | | | | | | | | * common/iobuf.c (iobuf_push_filter2): If the pipeline is an output or temp pipeline, the new filter shouldn't assume ownership of the old head's internal buffer: the data was written before the filter was added. * common/t-iobuf.c (double_filter): New function. (main): Add test cases for the above bug. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Flush the pipeline in iobuf_temp_to_buffer.Neal H. Walfield2015-08-201-1/+13
| | | | | | | | | * common/iobuf.c (iobuf_temp_to_buffer): Flush each filter in the pipeline and copy the data from the last (not the first) filter's internal buffer. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Combine iobuf_open, iobuf_create and iobuf_openrw.Neal H. Walfield2015-08-201-86/+55
| | | | | | | | | | * common/iobuf.c (do_open): New function, which is a generalization of iobuf_open, iobuf_Create, iobuf_openrw. (iobuf_open): Call do_open. (iobuf_create): Likewise. (iobuf_openrw): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Remove iobuf_open_fd_or_name.Neal H. Walfield2015-08-202-19/+0
| | | | | | | | * common/iobuf.h (iobuf_open_fd_or_name): Remove prototype. Replace use with either iobuf_open or iobuf_fdopen_nc, as appropriate. * common/iobuf.c (iobuf_open): Remove function. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Rename iobuf_flush and make it a static function.Neal H. Walfield2015-08-202-17/+25
| | | | | | | | | | | * common/iobuf.h (iobuf_flush): Remove prototype. * common/iobuf.c (filter_flush): New static prototype. (iobuf_flush): Rename... (filter_flush): ... to this. Make static. Simplify code. Update callers. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Don't abort freeing a pipeline if freeing a filter failsNeal H. Walfield2015-08-201-5/+13
| | | | | | | | | * common/iobuf.c (iobuf_cancel): Don't abort freeing a pipeline if freeing a filter fails. This needs to a memory leak. Instead, keep freeing and return the error code of the first filter that fails. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Improve iobuf_peek.Neal H. Walfield2015-08-201-17/+33
| | | | | | | | | | | * common/iobuf.c (underflow): Take additional parameter clear_pending_eof. If not set, don't clear a pending eof when returning EOF. Update callers. (iobuf_peek): Fill the internal buffer, if needed, to be able to better satisfy any request. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: When requested, fill the buffer even if it is not empty.Neal H. Walfield2015-08-201-46/+92
| | | | | | | | * common/iobuf.c (underflow): Don't require that the buffer be empty. When called, fill any available space. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/t-iobuf.c: Add a test case for multiple EOFs.Neal H. Walfield2015-08-201-0/+93
| | | | | | | | common/t-iobuf.c (main): Add a test case for multiple EOFs in an INPUT pipeline. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Better respect boundary conditions in iobuf_read_line.Neal H. Walfield2015-08-204-21/+234
| | | | | | | | | | | | * common/iobuf.c (iobuf_read_line): Be more careful with boundary conditions. * common/iobuf.h: Include <gpg-error.h>. * common/t-iobuf.c: New file. * common/Makefile.am (module_tests): Add t-iobuf. (t_mbox_util_LDADD): New variable. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Fix filter type for iobuf_temp_with_content.Neal H. Walfield2015-08-201-1/+1
| | | | | | | | | * common/iobuf.c (iobuf_temp_with_content): Set the filter type to IOBUF_INPUT, not IOBUF_TEMP, which is only for output filters that write into a dynamic buffer. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Remove unimplemented prototypes.Neal H. Walfield2015-08-201-3/+0
| | | | | | | | | * common/iobuf.h (iobuf_unread): Remove unimplemented prototype. (iobuf_clear_eof): Likewise. (iobuf_append): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Refactor code to not need the desc field.Neal H. Walfield2015-08-202-31/+29
| | | | | | | | | * common/iobuf.h (struct iobuf_struct): Remove field desc. * common/iobuf.c (iobuf_desc): New function. When a filter's description is needed, use this instead of the filter's desc field. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Clarify semantics of nofast. Simplify implementation.Neal H. Walfield2015-08-202-5/+9
| | | | | | | | * common/iobuf.h (struct iobuf_struct): Clarify semantics of nofast. Simplify use of nofast to implement just these semantics. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Remove dead code (directfp).Neal H. Walfield2015-08-202-65/+1
| | | | | | | | * common/iobuf.h (struct iobuf_struct): Remove field directfp. Remove all uses of it. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.c: Remove dead code (opaque).Neal H. Walfield2015-08-202-5/+1
| | | | | | | | * common/iobuf.h (struct iobuf_struct): Remove field opaque. Remove all uses of it. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common/iobuf.h: Replace further use of literals with symbolic constants.Neal H. Walfield2015-08-202-40/+44
| | | | | | | | | | | * common/iobuf.c: Move BLOCK_FILTER_INPUT, BLOCK_FILTER_OUTPUT_BLOCK_FILTER_TEMP from here... * common/iobuf.h: ... to here and rename to IOBUF_INPUT, IOBUF_OUTPUT and IOBUF_TEMP, respectively. Where appropriate, use these macros instead of a literal. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* Inform a user about inquire length limit.Ben Kibbey2015-08-151-1/+3
| | | | | | | | | | * common/status.h (INQUIRE_MAXLEN): New. * g10/call-agent.c (default_inquire_cb): Send STATUS_INQUIRE_MAXLEN. client when inquiring a passphrase over pinentry-loopback. -- This is to inform a user about the maximum length of a passphrase. The limit is the same that gpg-agent uses.
* common/iobuf.c: Replace use of literals with symbolic constants.Neal H. Walfield2015-08-081-22/+38
| | | | | | | | | | * common/iobuf.c (BLOCK_FILTER_INPUT): Define. Where appropriate, use this instead of a literal. (BLOCK_FILTER_OUTPUT): Likewise. (BLOCK_FILTER_TEMP): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>.
* common: Change alias for Curve25519 to "cv25519".Werner Koch2015-08-071-1/+1
| | | | | | | | | | | | | | | | * common/openpgp-oid.c (oidtable): Change alias. -- This is a cosmetic change so that common and expected common algorithms line up nicely in a keylisting. For example: pub ed25519/C68CE6D1ED0319C8 2015-08-06 uid [ultimate] Curve25519 Test 150806.1 sub cv25519/49238B9F0712C9BF 2015-08-06 sub rsa2048/8AEAF74014699D2C 2015-08-06 sub cv25519/8EC3776830B08736 2015-08-06 Signed-off-by: Werner Koch <[email protected]>
* Curve25519 support.NIIBE Yutaka2015-08-062-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | * 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-062-5/+5
| | | | | | | | | | | | | | | * 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.
* common,w32: Avoid unused var warning about msgcache.Werner Koch2015-07-281-6/+16
| | | | | | | | * common/i18n.c (USE_MSGCACHE): New. (msgcache) [!USE_MSGCACHE]: Do not define. (i18n_localegettext): Repalce #if conditions by USE_MSGCACHE. Signed-off-by: Werner Koch <[email protected]>
* w32: Try more places to find an installed Pinentry.Werner Koch2015-07-281-8/+33
| | | | | | | * common/homedir.c (get_default_pinentry_name): Re-implement to support several choices for Windows. Signed-off-by: Werner Koch <[email protected]>
* Replace GNUPG_GCC_A_ macros by GPGRT_ATTR_ macros.Werner Koch2015-07-268-66/+76
| | | | | | | | | | | | | * 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.
* Avoid a leading double slash in make_filename.Werner Koch2015-07-221-2/+14
| | | | * common/stringhelp.c (do_make_filename): Special case leading '/'.
* g10: Use canonical name for curve.NIIBE Yutaka2015-07-081-3/+3
| | | | | | | | * g10/import.c (transfer_secret_keys): Use canonical name. * common/openpgp-oid.c (openpgp_curve_to_oid): Return NULL on error. * g10/keyid.c (pubkey_string): Follow change of openpgp_curve_to_oid. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Ditto. * g10/parse-packet.c (parse_key): Ditto.
* common: Implement i18n_localegettext.Werner Koch2015-07-011-4/+104
| | | | | | | | | | | | | | | | * common/i18n.c (msg_cache_s, msg_cache_head_s): New. (msgcache): New. (i18n_localegettext): Implement locale dependent lookup. -- This is the second and final part of the change to use the gpg provided locale for Pinentry strings. It does not yet work on Windows, though. This commit should resolve Debian-bug-id: 788983 Signed-off-by: Werner Koch <[email protected]>
* Pass DBUS_SESSION_BUS_ADDRESS for gnome3Daniel Kahn Gillmor2015-06-301-0/+2
| | | | | | | | * common/session-env.c (stdenvnames): Add DBUS_SESSION_BUS_ADDRESS. -- pinentry-gnome3 talks to the gcr prompter via dbus. Without this environment variable, it can't find the correct session to talk to.
* Flag the L_() function with attribute format_arg.Werner Koch2015-06-302-1/+19
| | | | | | | | | | | | * 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]>
* agent: Use different translation func for Pinentry strings.Werner Koch2015-06-302-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * po/Makevars (XGETTEXT_OPTIONS): Add keyword "L_". * common/i18n.c (i18n_localegettext): New stub. * common/i18n.h: Expand the LunderscoreIMPL macro. * agent/agent.h (L_): New. (LunderscoreIMPL): New. * agent/call-pinentry.c (setup_qualitybar): Add arg ctrl anc change caller. * agent/findkey.c (try_unprotect_cb): Add local var ctrl. * agent/genkey.c (check_passphrase_constraints): Replace xtryasprintf by xtrystrdup to avoid gcc warning. Unfortinately this changes the string. (agent_ask_new_passphrase): Cleanup the use of initial_errtext. -- Static strings in gpg-agent need to be translated according to the locale set by the caller. This is required so that a gpg-agent can be started in one locale and a gpg can be run in another. If we don't do this the static strings (prompt, buttons) are not or in the wrong locale translated while dynamic strings (e.g. key description) uses the locale of gpg. This is only the first part of the change the actual local switching still needs to be implemented. Debian-bug-id: 788983 Signed-off-by: Werner Koch <[email protected]>
* common: Improve fucntion parse_debug_flag.Werner Koch2015-06-231-2/+13
| | | | | | | * common/miscellaneous.c (parse_debug_flag): Add hack not to call exit. Add "none" and "all" flags. Signed-off-by: Werner Koch <[email protected]>
* common: Add function parse_debug_flagWerner Koch2015-06-222-0/+89
| | | | | | | * common/miscellaneous.c (parse_debug_flag): New. * common/util.h (struct debug_flags_s): New. Signed-off-by: Werner Koch <[email protected]>
* common: Add function strtokenize.Werner Koch2015-06-223-0/+212
| | | | | | | | * common/stringhelp.c: Include assert.h. (strtokenize): New. * common/t-stringhelp.c (test_strtokenize): New. Signed-off-by: Werner Koch <[email protected]>