1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-29 02:22:45 +02:00
Commit Graph

5132 Commits

Author SHA1 Message Date
Neal H. Walfield
0143d5c1ca common: Check parameters more rigorously.
* g10/parse-packet.c (dbg_copy_all_packets): Check that OUT is not
NULL.
(copy_all_packets): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-21 14:21:00 +02:00
Neal H. Walfield
48e792cc95 common: Don't continuing processing on error.
* g10/parse-packet.c (dbg_parse_packet): Also return if parse returns
an error.
(parse_packet): Likewise.
(dbg_search_packet): Likewise.
(search_packet): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-21 14:20:54 +02:00
Neal H. Walfield
73af66a0aa common: Better respect the packet's length when reading it.
* g10/parse-packet.c (parse_signature): Make sure PKTLEN doesn't
underflow.  Be more careful that a read doesn't read more data than
PKTLEN says is available.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-21 14:20:43 +02:00
Werner Koch
b8adfc4186
doc: Remove C++ style comments and update HACKING.
--
2015-08-20 17:42:55 +02:00
Werner Koch
0d5a4138f2
po: Add lost translation of validity strings.
* po/POTFILES.in (trust.c): Add missing file.
* po/de.po: Changed German validity strings.
* doc/help.de.txt: Ditto.
--

Note that I replaced "uneingeschränkt" in de.po to "ultimativ" to
make the output better readable.
2015-08-20 16:58:30 +02:00
Neal H. Walfield
0add91ae1c g10/parse-packet.c:parse: Try harder to not ignore an EOF.
* g10/parse-packet.c (parse): Be more robust: make sure to process any
EOF.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:31 +02:00
Neal H. Walfield
24a72dffa7 g10/parse-packet.c: Replace literal with symbolic expression.
* g10/parse-packet.c (dump_hex_line): Use sizeof rather than the
buffer's size.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:30 +02:00
Neal H. Walfield
026feff4a8 Add documentation for g10/parse-packet.c.
* g10/packet.h: Add documentation for functions defined in
parse-packet.c.
* g10/parse-packet.c: Improve comments for many functions.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:29 +02:00
Neal H. Walfield
c46e8bfe9a g10/packet.h: Remove unused argument from enum_sig_subpkt.
* g10/packet.h (enum_sig_subpkt): Remove argument RET_N.  Update
callers.
* g10/parse-packet.c (enum_sig_subpkt): Remove argument RET_N.

--
Remove the RET_N argument, because it is unused and because it is
meaningless: it's not clear whether it is an offset into SIG->HASHED
or SIG->UNHASHED.

Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:29 +02:00
Neal H. Walfield
c271feb536 g10/parse-packet.c:mpi_read: Detect EOF and correct boundary conditions.
* g10/parse-packet.c (mpi_read): Improve documentation.  Correctly
handle an EOF.  On overflow, correctly return the number of bytes read
from the pipeline.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:28 +02:00
Neal H. Walfield
49f922286f common/iobuf.c: Make control flow more obvious.
* 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 <neal@g10code.com>.
2015-08-20 14:16:27 +02:00
Neal H. Walfield
c5da750cf3 common/iobuf.c: Add some sanity checks to catch programmer bugs.
* 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 <neal@g10code.com>.
2015-08-20 14:16:27 +02:00
Neal H. Walfield
e291b631c3 common/iobuf.c:iobuf_write_temp: Elide redundant code.
* common/iobuf.c (iobuf_write_temp): Don't repeat iobuf_flush_temp.
Use it directly.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:26 +02:00
Neal H. Walfield
a6d4bca3b5 common/iobuf.c: Have iobuf_writestr use iobuf_write, not iobuf_writebyte
* common/iobuf.c (iobuf_write): Don't write a byte at a time.  Use
iobuf_write.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:26 +02:00
Neal H. Walfield
1bfd1e4324 common/iobuf: Improve documentation and code comments.
common/iobuf.h: Improve documentation and code comments.
common/iobuf.c: Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:25 +02:00
Neal H. Walfield
0d40c4e83f common/iobuf.c: Adjust buffer size of filters in front of temp filters.
* 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 <neal@g10code.com>.
2015-08-20 14:16:25 +02:00
Neal H. Walfield
827cc922d8 common/iobuf.c: Buffered data should not be processed by new filters.
* 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 <neal@g10code.com>.
2015-08-20 14:16:24 +02:00
Neal H. Walfield
616181f3c7 common/iobuf.c: Flush the pipeline in iobuf_temp_to_buffer.
* 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 <neal@g10code.com>.
2015-08-20 14:16:23 +02:00
Neal H. Walfield
15ae99f887 common/iobuf.c: Combine iobuf_open, iobuf_create and iobuf_openrw.
* 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 <neal@g10code.com>.
2015-08-20 14:16:23 +02:00
Neal H. Walfield
8402815d8e common/iobuf.h: Remove iobuf_open_fd_or_name.
* 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 <neal@g10code.com>.
2015-08-20 14:16:22 +02:00
Neal H. Walfield
6d49a2b669 common/iobuf.c: Rename iobuf_flush and make it a static function.
* 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 <neal@g10code.com>.
2015-08-20 14:16:21 +02:00
Neal H. Walfield
1f94646a86 common/iobuf.c: Don't abort freeing a pipeline if freeing a filter fails
* 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 <neal@g10code.com>.
2015-08-20 14:16:21 +02:00
Neal H. Walfield
a250f73783 common/iobuf.c: Improve iobuf_peek.
* 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 <neal@g10code.com>.
2015-08-20 14:16:20 +02:00
Neal H. Walfield
c7ad36eb0d common/iobuf.c: When requested, fill the buffer even if it is not empty.
* common/iobuf.c (underflow): Don't require that the buffer be empty.
When called, fill any available space.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:20 +02:00
Neal H. Walfield
e76c75d872 common/t-iobuf.c: Add a test case for multiple EOFs.
common/t-iobuf.c (main): Add a test case for multiple EOFs in an INPUT
pipeline.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:19 +02:00
Neal H. Walfield
4e32c602f5 common/iobuf.c: Better respect boundary conditions in iobuf_read_line.
* 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 <neal@g10code.com>.
2015-08-20 14:16:19 +02:00
Neal H. Walfield
fa9fda23c2 common/iobuf.c: Fix filter type for iobuf_temp_with_content.
* 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 <neal@g10code.com>.
2015-08-20 14:16:18 +02:00
Neal H. Walfield
75fd86bbd1 common/iobuf.h: Remove unimplemented prototypes.
* common/iobuf.h (iobuf_unread): Remove unimplemented prototype.
(iobuf_clear_eof): Likewise.
(iobuf_append): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:17 +02:00
Neal H. Walfield
679acc671e common/iobuf.c: Refactor code to not need the desc field.
* 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 <neal@g10code.com>.
2015-08-20 14:16:17 +02:00
Neal H. Walfield
12fc56bcb5 common/iobuf.h: Clarify semantics of nofast. Simplify implementation.
* 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 <neal@g10code.com>.
2015-08-20 14:16:16 +02:00
Neal H. Walfield
e8c0b6abf8 common/iobuf.c: Remove dead code (directfp).
* common/iobuf.h (struct iobuf_struct): Remove field directfp.  Remove
all uses of it.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:16 +02:00
Neal H. Walfield
f05d60b381 common/iobuf.c: Remove dead code (opaque).
* common/iobuf.h (struct iobuf_struct): Remove field opaque.  Remove
all uses of it.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
2015-08-20 14:16:15 +02:00
Neal H. Walfield
c06eabac8e common/iobuf.h: Replace further use of literals with symbolic constants.
* 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 <neal@g10code.com>.
2015-08-20 14:16:14 +02:00
Werner Koch
91357b7722
gpg: Avoid linking to Libksba
* kbx/keybox.h (KEYBOX_WITH_X509): Do not define.
* sm/Makefile.am (AM_CPPFLAGS): Define it here.
(common_libs): Change to libkeybox509.a
* g10/Makefile.am (AM_CFLAGS): remove KSBA_CFLAGS.
(gpg2_LDADD, gpgv2_LDADD): Remove KSBA_LIBS
* kbx/Makefile.am (noinst_LIBRARIES): Add libkeybox509.a.
(libkeybox509_a_SOURCES): New.
(libkeybox_a_CFLAGS): New.
(libkeybox509_a_CFLAGS): New.
(kbxutil_CFLAGS): New.
* kbx/keybox-search.c (has_keygrip) [!KEYBOX_WITH_X509]: Declare args
as unused.
--

There is no real need to link to Libksba in gpg.

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-08-17 16:17:19 +02:00
Ben Kibbey
bba74cdd95 Fix pinentry loopback and passphrase contraints.
* agent/command.c (cmd_get_passphrase): Don't repeat passphrase for
pinentry loopback mode.
* agent/genkey.c (check_passphrase_constraints): Immediately return when
pinentry mode is loopback.

--
Fixes endless loop when inquiring a passphrase with
pinentry-mode=loopback that may not satisfy passphrase contraints.
2015-08-16 16:12:46 -04:00
Ben Kibbey
93f5295df5 Fix sending INQUIRE_MAXLEN for symmetric data.
* g10/passphrase.c (passphrase_to_dek_ext): Write the status message.
2015-08-16 12:54:04 -04:00
Ben Kibbey
f126ca6156 Inform a user about inquire length limit.
* 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.
2015-08-15 17:14:13 -04:00
Ben Kibbey
233b5fedab Allow --gen-key to inquire a passphrase.
* g10/gpg.c (main): test for --command-fd during --gen-key parse.

When --command-fd is set then imply --batch to let gpg inquire a
passphrase rather than requiring a pinentry.
2015-08-15 17:14:13 -04:00
Werner Koch
0675a3bd45
Post release updates.
--
2015-08-11 16:13:39 +02:00
Werner Koch
b5e081973b
Release 2.1.7 2015-08-11 13:54:29 +02:00
Werner Koch
f89ecb45d4
po: Auto update.
--
2015-08-11 13:54:00 +02:00
Werner Koch
ee290b5870
po: Update German translation
--
2015-08-11 13:53:00 +02:00
Daniel Kahn Gillmor
79b90039a8
doc: Improve documentation of VALIDSIG
--
2015-08-11 12:14:20 +02:00
NIIBE Yutaka
8704c70108 agent: fix ECC key handling.
* agent/cvt-openpgp.c (get_keygrip, convert_secret_key)
(convert_transfer_key): CURVE is the name of curve.
2015-08-10 19:13:13 +09:00
Neal H. Walfield
c80643c5ec common/iobuf.c: Replace use of literals with symbolic constants.
* 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 <neal@g10code.com>.
2015-08-08 13:09:00 +02:00
Werner Koch
5b7a80b1ab
gpg: Allow gpgv to work with a trustedkeys.kbx file.
* g10/keydb.h (KEYDB_RESOURCE_FLAG_GPGVDEF): New.
* g10/keydb.c (keydb_add_resource): Take care of new flag.
* g10/gpgv.c (main): Use new flag.
--

GnuPG-bug-id: 2025
Signed-off-by: Werner Koch <wk@gnupg.org>
2015-08-07 15:53:56 +02:00
Werner Koch
a68c5c5c7f
agent: Add option --force to the DELETE_KEY command.
* agent/findkey.c (agent_delete_key): Add arg "force".
* agent/command.c (cmd_delete_key): Add option --force.

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-08-07 12:55:29 +02:00
Werner Koch
9f31ab3d21
common: Change alias for Curve25519 to "cv25519".
* 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 <wk@gnupg.org>
2015-08-07 09:37:49 +02:00
Werner Koch
fb754dc617
gpg: Remove duplicated printing of the curve name in "sub" lines.
* g10/keylist.c (list_keyblock_print): Do not print extra curve name.
--

This was cruft from the time before we changed to the new algo/size
string.

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-08-06 18:12:31 +02:00
Werner Koch
fbb6c25ab5
gpg: Add commands "fpr *" and "grip" to --edit-key.
* g10/keyedit.c (cmdGRIP): New.
(cmds): Add command "grip".
(keyedit_menu) <cmdFPR>: Print subkeys with argument "*".
(keyedit_menu) <cmdGRIP>: Print keygrip.
(show_key_and_fingerprint): Add arg "with_subkeys".
(show_key_and_grip): New.
* g10/keylist.c (print_fingerprint): Add mode 4.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2015-08-06 18:00:12 +02:00