1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-09 23:39:51 +02:00
Commit Graph

1450 Commits

Author SHA1 Message Date
Werner Koch
d81de224ec
w32: Use --enable-gpg2-is-gpg by default.
* autogen.rc: Add option also for plain Windows.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-04-21 09:18:29 +02:00
Werner Koch
d02de6c0a4
gpg: Improve UID selction of --quick-sign-key.
* g10/keyedit.c (keyedit_quick_sign): Improve UID selection and print
error for non-found userids.
--

GnuPG-bug-id: 2315
2016-04-19 17:57:21 +02:00
Werner Koch
085b19fc9a
gpg: Avoid debug like output at start of --edit-key.
* g10/keyedit.c (check_all_keysigs): Print info only after something
has been modified.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-04-19 17:57:21 +02:00
Justus Winter
02cf1357dd g10: Fix exporting secret keys of certain sizes.
* g10/build-packet.c (do_key): Do not use the header length specified
by the public key packet from the keyring, but let 'write_header2'
compute the required length.
--
Specifically exporting RSA keys of length 1024 failed, as the encoded
public key packet requires 141 bytes a length that fits into one byte,
but the secret key is significantly larger, making the export fail.

GnuPG-bug-id: 2307
Signed-off-by: Justus Winter <justus@g10code.com>
2016-04-07 13:55:42 +02:00
Justus Winter
71040f48ef g10: Fix typo.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-04-07 13:51:26 +02:00
Justus Winter
76ca869197 Revert "g10: Support armored keyrings in gpgv."
This reverts commit abb352de51.
2016-04-06 11:34:11 +02:00
Werner Koch
f45ed07a0f
build: Fix for: Build gpgcompose only in maintainer mode
* g10/Makefile.am (noinst_PROGRAMS): Always add module_tests.
--

Fixes-commit: 4b5341d
2016-04-05 15:24:56 +02:00
Werner Koch
4b5341dc33
build: Build gpgcompose only in maintainer mode
* g10/Makefile.am (noinst_PROGRAMS): Add gpgcompose only in maintainer
mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-04-05 11:18:45 +02:00
Werner Koch
7b58a1118d
gpg: Replace use of "gpg2" by GPG_NAME
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-04-05 11:11:11 +02:00
Werner Koch
96bcd4220f
Now build "gpg" binary but install as "gpg2"
* configure.ac (USE_GPG2_HACK): New ac_define am_conditional.
* common/homedir.c (gnupg_module_name): Replace use of macro
NAME_OF_INSTALLED_GPG.
* g10/keygen.c (generate_keypair): Ditto.
* g10/Makefile.am (bin_PROGRAMS): Remove.
(noinst_PROGRAMS): Add gpg or gpg2 and gpgv or gpg2.
(gpg2_hack_list): New.
(use_gpg2_hack): New.
(gpg2_SOURCES): Rename to gpg_SOURCES.
(gpgv2_SOURCES): Rename to gpgv_SOURCES.
(gpg2_LDADD): Rename to gpg_LDADD.
(gpgv2_LDADD): Rename to gpgv_LDADD.
(gpg2_LDFLAGS): Rename to gpg_LDFLAGS.
(gpgv2_LDFLAGS): Rename to gpgv2_LDFLAGS.
(install-exec-hook): Remove WinCE specific rules and add new rules.
(uninstall-local): Uninstall gpg/gpg2 and gpgv/gpgv2.
* tests/openpgp/Makefile.am (required_pgms): s/gpg2/gpg/.
* tests/openpgp/defs.inc: Ditto.
* tests/openpgp/gpgtar.test: Ditto.
* tests/openpgp/mkdemodirs: Ditto.
* tests/openpgp/signdemokey: Ditto.

* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Remove obsolete
--enable-mailto, add --enable-gpg2-is-gpg.
--

Although we need to duplicate some automake generated code this method
allows to easily switch the name of the installed target using the
configure option "--enable-gpg2-is-gpg".

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-04-04 18:40:25 +02:00
Justus Winter
abb352de51 g10: Support armored keyrings in gpgv.
* doc/gpgv.texi: Document the feature.
* g10/Makefile.am (gpgv2_SOURCES): Add dearmor.c.
* g10/dearmor.c (dearmor_file): Add sink argument.
* g10/gpg.c (main): Adapt accordingly.
* g10/gpgv.c (make_temp_dir): New function.
(main): De-armor keyrings.
* g10/main.h (dearmor_file): Adapt prototype.

GnuPG-bug-id: 2290
Signed-off-by: Justus Winter <justus@g10code.com>
2016-04-04 17:53:03 +02:00
Justus Winter
b74185b6ea g10: Remove option --always-trust if compiled without trust models.
* g10/gpg.c (opts): Remove option --always-trust if compiled without
trust models.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-04-01 14:57:27 +02:00
Justus Winter
8be9dab2dd g10: Use gpg-error abstraction of sched_yield.
* g10/tofu.c (begin_transaction): Use 'gpgrt_yield'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-03-31 17:23:31 +02:00
Werner Koch
e2c5781788
gpg: Fix NULL-segv for missing tofu DB.
* g10/tofu.c (opendb): Guard call to timeout function.
--

GnuPG-bug-id: 2294

Fix not tested but is pretty obvious.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-03-29 13:30:19 +02:00
Werner Koch
fc30c079a3
gpg: Improve message when asking for key capabilities.
* g10/keygen.c (ask_key_flags): Improve message.
--

Because the curve is only selected after the capabilities are queried
we do not know whether ECDSA or EdDSA will eventually be used.  When
printing the possible capabilities we now use print "ECDSA/EdDSA" for
the algorithm.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-03-22 20:24:52 +01:00
Werner Koch
7f919063d3
gpg: Remove the extra prompt for Curve25519.
* g10/keygen.c (MY_USE_ECDSADH): New macro local to ask_curve.
(ask_curve): Use a fixed table of curve names and reserve a slot for
Curve448.  Simplify CurveNNNN/EdNNNN switching.
(ask_curve): Remove the Curve25519 is non-standard prompt.
--

Given that ECC generation is only available in export mode and that
gpg will in any case support our current ed2559/cv25519 definition the
extra prompt does not make anymore sense.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-03-22 19:55:25 +01:00
Werner Koch
af9a4afbf0
gpg: Silence trustdb computation with --quiet.
* g10/trustdb.c (validate_keys): Do not print log_info stuff in quiet
mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-03-19 14:43:28 +01:00
NIIBE Yutaka
b752d2c937 g10: Add const qualifier.
* g10/gpgcompose.c (show_help): Those are strings not to be modified.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-03-16 11:52:41 +09:00
Werner Koch
60b34f96f4
gpg: Do not rely on a certain evaluation order.
* g10/keyedit.c (print_and_check_one_sig): Call check_key_signature
before derefing IS_SELFSIG.
--

Fixes-commit: 5fbd80579a
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-03-15 09:22:24 +01:00
Werner Koch
834b84c0ee
scd: Add manufacturer id 0x000a
* g10/card-util.c (get_manufacturer): Add it.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-03-14 17:51:43 +01:00
Kevin J. McCarthy
4f578cb2fc g10: Silence message if --quiet is given.
* g10/getkey.c (parse_def_secret_key): Silence message if --quiet is
given.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-03-10 12:41:06 +01:00
Neal H. Walfield
b17577eac6 gpg: Add a new test.
* g10/Makefile.am (EXTRA_DIST): Add t-stutter-data.asc.
(module_tests): Add t-stutter.
(t_stutter_SOURCES): New variable.
(t_stutter_LDADD): New variable.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>

Add a test to check that the Mister and Zuccerato attack described in
"An Attack on CFB Mode Encryption As Used by OpenPGP" works.
2016-03-08 14:08:49 +01:00
Justus Winter
1e4b782300 g10: Drop superfluous declaration.
* g10/main.h (disable_core_dumps): Drop declaration.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-03-04 13:33:04 +01:00
Justus Winter
40f6529cee g10: Guard code against errors.
* g10/keygen.c (do_generate_keypair): Check for errors, in which case
'pri_psk' is NULL.

Fixes-commit: bf9d1248
Signed-off-by: Justus Winter <justus@g10code.com>
2016-03-04 13:29:45 +01:00
Neal H. Walfield
d040628ddf gpg: Add new program gpgcompose.
* g10/packet.h: Include "util.h".
* g10/encrypt.c (encrypt_seskey): Don't mark as static.
* g10/gpgcompose.c: New file.
* g10/Makefile.am (noinst_PROGRAMS): Add gpgcompose.
(gpg2_SOURCES): Split everything but gpg.c into...
(gpg_sources): ... this new variable.
(gpgcompose_SOURCES): New variable.
(gpgcompose_LDADD): Likewise.
(gpgcompose_LDFLAGS): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-03-02 20:36:19 +01:00
Neal H. Walfield
605276ef8c gpg: More robustly detect valid non-armored OpenPGP messages.
* g10/armor.c (is_armored): More robustly detect valid non-armored
OpenPGP messages.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-03-02 20:36:18 +01:00
Neal H. Walfield
7eac4942b5 gpg: Split write_pubkey_enc_from_list.
* g10/encrypt.c (write_pubkey_enc_from_list): Split the body of this
function out into...
(write_pubkey_enc): ... this new function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-03-02 20:36:15 +01:00
Neal H. Walfield
2fdb950471 gpg: Allow the caller to write the contents of a plaintext packet.
* g10/build-packet.c (do_plaintext): Change the semantics such that if
PT->BUF is NULL, it is the caller's responsibility to write the
content (and disable partial body length mode, if appropriate).

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-03-02 20:36:14 +01:00
Neal H. Walfield
1a62458614 gpg: Add a new function for creating binary notations.
* g10/build-packet.c (blob_to_notation): New function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-03-02 20:36:13 +01:00
Neal H. Walfield
fd2d00ccf5 gpg: Refactor the printing of binary notations.
* g10/build-packet.c (sig_to_notation): Break printing of binary
notations into...
(notation_value_to_human_readable_string): ... this new function.
Provide a small preview of the binary data substituting non-printable
characters with '?'.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-03-02 20:36:12 +01:00
Justus Winter
e77c85577d common: Consolidate Assuan server argument handling.
* common/Makefile.am (common_sources): Add new files.
* common/server-help.c: New file.
* common/server-help.h: Likewise.
* agent/command.c: Drop argument handling primitives in favor of using
the consolidated ones.
* dirmngr/server.c: Likewise.
* g10/server.c: Likewise.
* g13/server.c: Likewise.
* scd/command.c: Likewise.
* sm/server.c: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-03-02 14:14:33 +01:00
Werner Koch
2de0d41219
gpg: Prettify a 2 octet hex output.
* g10/sig-check.c (check_key_signature2): Wrap line and use %02x.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-02-26 11:41:18 +01:00
Neal H. Walfield
87515e3929 gpg: Show debugging info if a sig with an unsupported sig class is used.
* g10/sig-check.c (check_key_signature2): If SIG->CLASS is
unsupported, show some debugging information.  Don't use BUG to fail.
Just return GPG_ERR_BAD_SIGNATURE.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-25 21:25:27 +01:00
Neal H. Walfield
960f5e26f2 gpg: More carefully encode a packet's length.
* g10/build-packet.c (write_header2): Make sure the length bits are
cleared.  Fail if HDRLEN is set and the specified length can't be
encoded in the available space.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-25 21:20:32 +01:00
Neal H. Walfield
105a5629c7 gpg: Avoid directly twiddling bits.
* g10/build-packet.c (do_plaintext): Use ctb_new_format_p to check the
packet's format.
(write_header2): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-25 21:16:41 +01:00
Neal H. Walfield
b7b4a1bdd9 gpg: Improve documentation and comments related to OpenPGP packets.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-25 21:08:56 +01:00
Neal H. Walfield
c9636a1acc gpg: Add some asserts.
* g10/build-packet.c (ctb_new_format_p): New function.
(ctb_pkttype): New function.
(do_user_id): Add some asserts.
(do_key): Likewise.
(do_symkey_enc): Likewise.
(do_pubkey_enc): Likewise.
(do_plaintext): Likewise.
(do_encrypted): Likewise.
(do_encrypted_mdc): Likewise.
(do_compressed): Likewise.
(do_signature): Likewise.
(do_signature): Likewise.
(write_header2): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-25 15:24:25 +01:00
Neal H. Walfield
512bc72e1f gpg: Avoid an unnecessary copy.
* g10/build-packet.c (sig_to_notation): Avoid an unnecessary copy of
the data: the size of the packet is fixed.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-25 14:51:55 +01:00
Neal H. Walfield
33ac735a78 gpg: Use higher-level functions.
* g10/build-packet.c (do_symkey_enc): Use iobuf_write instead of
iobuf_put in a loop.  Use iobuf_copy instead of iobuf_read and
iobuf_write in a loop.  Move the memory wiping from here...
* common/iobuf.c (iobuf_copy): ... to here.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-23 21:10:51 +01:00
Neal H. Walfield
903466e124 common: More accurately name function.
* common/iobuf.c (iobuf_set_partial_block_mode): Rename from this...
(iobuf_set_partial_body_length_mode): ... to this.  Update callers.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-23 20:49:47 +01:00
Neal H. Walfield
2d1d795481 gpg: Systematically detect and fix signatures that are out of order.
* g10/keyedit.c (sig_comparison): New function.
(fix_key_signature_order): Merge functionality into...
(check_all_keysigs): ... this function.  Rewrite to eliminate
duplicates and use a systematic approach to detecting and moving
signatures that are out of order instead of a heuristic.
(fix_keyblock): Don't call fix_key_signature_order.  Call
check_all_keysigs instead after collapsing the uids.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
GnuPG-bug-id: 2236
2016-02-19 16:38:27 +01:00
Neal H. Walfield
44cdb9d73f gpg: Split check_key_signature2.
* g10/sig-check.c (hash_uid_node): Rename from this...
(hash_uid_packet): ... to this.  Take a PKT_user_id instead of a
KBNODE.
(check_key_signature2): Split the basic signature checking
functionality into...
(check_signature_over_key_or_uid): ... this new function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-19 16:38:26 +01:00
Neal H. Walfield
5fbd80579a gpg: Split print_and_check_one_sig.
* g10/keyedit.c (print_and_check_one_sig): Split the print
functionality into...
(print_one_sig): ... this new function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-19 16:13:03 +01:00
Neal H. Walfield
ac5aea9545 gpg: Split the function check_signature_end.
* g10/sig-check.c (check_signature_end): Break the basic signature
check into...
(check_signature_end_simple): ... this new function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-19 16:13:02 +01:00
Neal H. Walfield
10671c3a4c gpg: Use format_keyid rather than manually formatting the keyid.
* g10/keyedit.c (menu_addrevoker): Use format_keyid rather than
manually formatting the keyid.
* g10/keygen.c (card_write_key_to_backup_file): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-19 16:13:02 +01:00
Neal H. Walfield
bf9d1248c8 gpg: Initialize the primary key when generating a key.
* g10/keygen.c (do_generate_keypair): Initialize
pri_psk->flags.primary, pri_psk->keyid and pri_psk->main_keyid.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-02-19 16:13:01 +01:00
Neal H. Walfield
c45633a571 gpg: Add accessor & utility functions for pk->keyid and pk->main_keyid.
* g10/keydb.h (keyid_cmp): New function.
* g10/keyid.c (pk_keyid): New function.
(pk_main_keyid): New function.
(keyid_copy): New function.
(pk_keyid_str): New function.
* g10/packet.h (PKT_public_key): Update comments for main_keyid and
keyid.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>

Before accessing pk->keyid, it is necessary to call keyid_from_pk (pk,
NULL) to ensure that pk->keyid is valid.  Because it is easy to forget
to do this, these accessor functions take care of it.
2016-02-19 16:13:00 +01:00
Daniel Kahn Gillmor
813df2fe66
gpg: Clean up dangling agent_open and agent_closed declarations.
* g10/keydb.h: Remove agent_open, agent_close declarations/
* g10/migrate.c: #include <unistd.h> for access()

--
agent_open() is only defined statically in common/simple-pw-query.c,
it is neither used nor referenced anywhere else.  agent_close doesn't
exist anywhere.  The removal of these declarations removes an
unecessary inclusion of libassuan.h.

migrate.c was relying on keydb.h -> libassuan.h -> unistd.h for the
declaration of access(), so we now handle that explicitly instead.
2016-02-18 12:11:16 +01:00
Neal H. Walfield
2f02ed75a9 gpg: Make ASCII armor decoding more robust to encoding errors.
* g10/armor.c (radix64_read): If the = is followed by the string "3D",
check if the following four characters are valid radix 64 and are
followed by a new line.  If so, warn and ignore the '3D'.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
GnuPG-bug-id: 2250
2016-02-16 13:09:32 +01:00
NIIBE Yutaka
ea9cfcfbf7 common, g10: Fix indentation to silence GCC-6.
* common/iobuf.c (iobuf_ioctl): Fix.
* g10/encrypt.c (encrypt_filter): Likewise.
* g10/keyring.c (prepare_search): Likewise.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-02-15 11:05:29 +09:00