aboutsummaryrefslogtreecommitdiffstats
path: root/g10 (unfollow)
Commit message (Collapse)AuthorFilesLines
2014-06-30Limit keysize for unattended key generation to useful values.Werner Koch1-2/+10
* g10/keygen.c (gen_elg): Enforce keysize 1024 to 4096. (gen_rsa): Enforce keysize 1024 to 4096. (gen_dsa): Enforce keysize 768 to 3072. -- It was possible to create 16k RSA keys in batch mode. In addition to the silliness of such keys, they have the major drawback that GnuPG, with its limited amount of specially secured memory areas, the use of such keys may lead to an "out of secure memory" condition.
2014-06-30Make screening of keyserver result work with multi-key commands.Werner Koch1-23/+45
* g10/keyserver.c (ks_retrieval_filter_arg_s): new. (keyserver_retrieval_filter): Use new struct and check all descriptions. (keyserver_spawn): Pass filter arg suing the new struct. -- This is a fix for commit 52303043. The old code did only work for a single key. It failed as soon as several keys are specified ("gpg --refresh-keys" or "gpg --recv-key A B C").
2014-06-23Fix syntax error introduced with 60bd6488Werner Koch1-3/+4
* g10/apdu.c (pcsc_dword_t): Fix syntax error.
2014-06-23Screen keyserver responses.Stefan Tomanek3-39/+116
* g10/main.h: Typedef import_filter for filter callbacks. * g10/import.c (import): Add filter callbacks to param list. (import_one): Ditto. (import_secret_one): Ditto. (import_keys_internal): Ditto. (import_keys_stream): Ditto. * g10/keyserver.c (keyserver_retrieval_filter): New. (keyserver_spawn): Pass filter to import_keys_stream() -- These changes introduces import functions that apply a constraining filter to imported keys. These filters can verify the fingerprints of the keys returned before importing them into the keyring, ensuring that the keys fetched from the keyserver are in fact those selected by the user beforehand. Signed-off-by: Stefan Tomanek <[email protected]> Re-indention and minor changes by wk.
2014-06-23Print hash algorithm in sig recordsWerner Koch1-6/+2
* g10/keylist.c (list_keyblock_colon): Print field 16. -- We have this info already in gnupg-2 and it is easy to add it to 1.4. Debian-bug-id: 672658 Patch written and tested by Daniel Leidert. See above.
2014-06-23Remove useless diagnostic in MDC verification.Werner Koch1-6/+4
* g10/encr-data.c (decrypt_data): Do not distinguish between a bad MDC packet header and a bad MDC. -- The separate diagnostic was introduced for debugging a problems. For explaining an MDC error a single error message is easier to understand.
2014-06-23PC/SC cleanup.Werner Koch1-43/+56
* g10/apdu.c (pcsc_dword_t): New. It was named as DWORD (double-word) when a word was 16-bit. (struct reader_table_s): Fixes for types. (struct pcsc_readerstate_s) [__APPLE__]: Enable #pragma pack(1). Throughout: Fixes for types. -- GnuPG-bug-id: 1358 This is a backport of commit ae22d629b6028aa994ff09f012e1cb029575eeae.
2014-06-23gpg: Use more specific reason codes for INV_RECP.Werner Koch1-5/+13
* g10/pkclist.c (build_pk_list): Use more specific reasons codes for INV_RECP. -- GnuPG-bug-id: 1650 Note that this patch is a bit more limited than the one in 2.1.
2014-06-20gpg: Avoid infinite loop in uncompressing garbled packets.Werner Koch1-9/+12
* g10/compress.c (do_uncompress): Limit the number of extra FF bytes. -- A packet like (a3 01 5b ff) leads to an infinite loop. Using --max-output won't help if it is a partial packet. This patch actually fixes a regression introduced on 1999-05-31 (c34c6769). Actually it would be sufficient to stuff just one extra 0xff byte. Given that this problem popped up only after 15 years, I feel safer to allow for a very few FF bytes. Thanks to Olivier Levillain and Florian Maury for their detailed report.
2014-03-06gpg: Need to init the trustdb for import.Werner Koch1-0/+1
* g10/trustdb.c (clear_ownertrusts): Init trustdb. -- This is actually a hack to fix a bug introduced with commit 2528178. Debian uses it and thus we should do too. GnuPG-bug-id: 1622
2013-12-11Change --show-session-key to print the session key earlier.Werner Koch2-10/+11
* g10/mainproc.c (proc_encrypted): Move show_session_key code to ... * g10/decrypt-data.c (decrypt_data): here. -- This feature can be used to return the session key for just a part of a file. For example to downloading just the first 32k of a huge file, decrypting that incomplete part and while ignoring all the errors break out the session key. The session key may then be used on the server to decrypt the entire file without the need to have the private key on the server. This is the same feature as commit 101a54add351ff62793cbfbf3877787c4791f833 for 2.1 and commit 3ae90ff28c500967cb90b1176299d2ca01ef450f for 2.0. GnuPG-bug-id: 1389 Signed-off-by: Werner Koch <[email protected]>
2013-12-10Update config.{guess,sub} and some copyright notices.Werner Koch1-0/+1
* scripts/config.guess, scripts/config.sub: Update to version 2013-11-29. Signed-off-by: Werner Koch <[email protected]>
2013-12-03Use blinding for the RSA secret operation.Werner Koch1-0/+1
* cipher/random.c (randomize_mpi): New. * g10/gpgv.c (randomize_mpi): New stub. * cipher/rsa.c (USE_BLINDING): Define macro. (secret): Implement blinding. -- GPG 1.x has never used any protection against timing attacks on the RSA secret operation. The rationale for this has been that there was no way to mount a remote timing attack on GnuPG. With the turning up of Acoustic Cryptanalysis (http://cs.tau.ac.il/~tromer/acoustic) this assumption no longer holds true and thus we need to do do something about it. Blinding seems to be a suitable mitigation to the threat of key extraction. It does not help against distinguishing used keys, though. Note that GPG 2.x uses Libgcrypt which does blinding by default. The performance penalty is negligible: Modifying the core pubkey_sign or pubkey_decrypt function to run 100 times in a loop, the entire execution times for signing or decrypting a small message using a 4K RSA key on a Thinkpad X220 are Without blinding: 5.2s (8.9s) With blinding: 5.6s (9.3s) The numbers in parentheses give the values without the recently implemented k-ary exponentiation code. Thus for the next release the user will actually experience faster signing and decryption. A drawback of blinding is that we need random numbers even for decryption (albeit at low quality). Signed-off-by: Werner Koch <[email protected]> CVE-id: CVE-2013-4576
2013-11-27gpg: Change armor Version header to emit only the major version.Werner Koch3-22/+42
* g10/options.h (opt): Rename field no_version to emit_version. * g10/gpg.c (main): Init opt.emit_vesion to 1. Change --emit-version to bump up opt.emit_version. * g10/armor.c (armor_filter): Implement different --emit-version values. -- GnuPG-bug-id: 1572 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit e951782e937ce290be0d89d83e84b3daea997587) Resolved conflicts: NEWS g10/armor.c g10/gpg.c
2013-10-18Print the keyid for key packets with --list-packets.Werner Koch1-1/+11
* g10/parse-packet.c (parse_key): Add keyid printing. -- This is backport from GnuPG-2. Note that the --list-packets command is for debugging only and not part iof the stable API. Signed-off-by: Werner Koch <[email protected]>
2013-10-11gpg: Do not require a trustdb with --always-trust.Werner Koch4-93/+129
* g10/tdbio.c (tdbio_set_dbname): Add arg R_NOFILE. * g10/trustdb.c (trustdb_args): Add field no_trustdb. (init_trustdb): Set that field. (revalidation_mark): Take care of a nonexistent trustdb file. (read_trust_options): Ditto. (get_ownertrust): Ditto. (get_min_ownertrust): Ditto. (update_ownertrust): Ditto. (update_min_ownertrust): Ditto. (clear_ownertrusts): Ditto. (cache_disabled_value): Ditto. (check_trustdb_stale): Ditto. (get_validity): Ditto. * g10/gpg.c (main): Do not create a trustdb with most commands for trust-model always. -- This slightly changes the semantics of most commands in that they won't create a trustdb if --trust-model=always is used. It just does not make sense to create a trustdb if there is no need for it. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 1a0eeaacd1bf09fe5125dbc3f56016bc20f3512e) Resolved conflicts: g10/gpg.c g10/tdbio.h g10/trustdb.c (indentation fixes)
2013-10-04gpg: Print a "not found" message for an unknown key in --key-edit.Werner Koch1-0/+4
* g10/keyedit.c (keyedit_menu): Print message. -- GnuPG-bug-id: 1420 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 0bf54e60d31389812d05c3fd29bece876204561d)
2013-10-04gpg: Protect against rogue keyservers sending secret keys.Werner Koch3-8/+20
* g10/options.h (IMPORT_NO_SECKEY): New. * g10/keyserver.c (keyserver_spawn, keyserver_import_cert): Set new flag. * g10/import.c (import_secret_one): Deny import if flag is set. -- By modifying a keyserver or a DNS record to send a secret key, an attacker could trick a user into signing using a different key and user id. The trust model should protect against such rogue keys but we better make sure that secret keys are never received from remote sources. Suggested-by: Stefan Tomanek Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit e7abed3448c1c1a4e756c12f95b665b517d22ebe) Resolved conflicts: g10/options.h
2013-10-04gpg: Allow setting of all zero key flagsDaniel Kahn Gillmor1-3/+0
* g10/keygen.c (do_add_key_flags): Do not check for empty key flags. (cherry picked from commit b693ec02c467696bf9d7324dd081e279f9965151) (cherry picked from commit dd868acb0d13a9f119c0536777350a6c237a66a1)
2013-10-04gpg: Distinguish between missing and cleared key flags.Werner Koch1-1/+7
* include/cipher.h (PUBKEY_USAGE_NONE): New. * g10/getkey.c (parse_key_usage): Set new flag. -- We do not want to use the default capabilities (derived from the algorithm) if any key flags are given in a signature. Thus if key flags are used in any way, the default key capabilities are never used. This allows to create a key with key flags set to all zero so it can't be used. This better reflects common sense. (cherry picked from commit 4bde12206c5bf199dc6e12a74af8da4558ba41bf) (cherry picked from commit 0a805ed1604ef3e9b27f3e22a936a2d439300e9f) Resolved conflicts: include/cipher.h
2013-10-02gpg: Fix bug with deeply nested compressed packets.Werner Koch1-9/+43
* g10/mainproc.c (MAX_NESTING_DEPTH): New. (proc_compressed): Return an error code. (check_nesting): New. (do_proc_packets): Check packet nesting depth. Handle errors from check_compressed. Signed-off-by: Werner Koch <[email protected]>
2013-08-30gpg: Use 2048 as the default keysize in batch mode.Werner Koch1-3/+3
* g10/keygen.c (gen_elg, gen_dsa, gen_rsa): Set default keysize to 2048. Signed-off-by: Werner Koch <[email protected]>
2013-08-02gpg: No need to create a trustdb when encrypting with --always-trust.Werner Koch1-0/+6
* g10/gpg.c (main): Special case setup_trustdb for --encrypt. -- (back ported from commit 498b9a95dc65c43240835d64cc92d8fb43014d53) Signed-off-by: Werner Koch <[email protected]>
2013-07-25Prepare for a forthcoming new algorithm id.Werner Koch1-0/+1
* include/cipher.h (PUBKEY_ALGO_ECC): New. * g10/keyid.c (pubkey_letter): Add letter 'C'. -- ID 22 will be used for generic ECC, i.e. one which can be used for ECDSA and ECDH. The only support in 1.4 will pretty printing the algorithm id.
2013-07-16gpg: fix previous changeNIIBE Yutaka1-1/+1
* g10/gpgv.c: Fix void dotlock_remove_lockfiles.
2013-07-12gpg: signal handling fixNIIBE Yutaka3-4/+4
* include/dotlock.h (dotlock_remove_lockfiles_reclaim): New. (dotlock_destroy, dotlock_remove_lockfiles): Add a flag to reclaim memory or not. * util/dotlock.c (dotlock_create): Use dotlock_remove_lockfiles_reclaim for atexit. (dotlock_destroy_unix, dotlock_destroy) (dotlock_remove_lockfiles): Add a reclaim flag. (dotlock_remove_lockfiles_reclaim): New. * g10/signal.c (got_fatal_signal): Disable flag of reclaim memory to avoid non-async-face call. * g10/keydb.c (maybe_create_keyring): Follow the API change. * g10/gpgv.c: Follow the API change. -- signal handler got_fatal_signal should not call non-async-signal-safe functions. When malloc is interrupted by a signal, it screws up. This issue is reported: https://bugs.g10code.com/gnupg/issue1515 http://bugs.debian.org/399904
2013-01-11Fix honoring --cert-digest-algo when recreating a certChristian Aistleitner1-0/+1
* g10/sign.c (update_keysig_packet): Override original signature's digest algo in hashed data.
2012-12-20gpg: Suppress "public key already present" in quiet mode.Werner Koch1-4/+6
* g10/pkclist.c (build_pk_list): Print two diagnostics only in non-quiet mode. -- (back-ported from commit 8325d616593187ff227853de0295e3269b96edcb)
2012-12-20Import only packets which are allowed in a keyblock.Werner Koch1-1/+22
* g10/import.c (valid_keyblock_packet): New. (read_block): Store only valid packets. -- A corrupted key, which for example included a mangled public key encrypted packet, used to corrupt the keyring. This change skips all packets which are not allowed in a keyblock. GnuPG-bug-id: 1455
2012-12-19Remove trailing white space from some filesWerner Koch1-18/+18
--
2012-12-15Fix potential heap corruption in "gpg -v --version"Werner Koch1-43/+39
* g10/gpg.c (build_list): Rewrite to cope with buffer overflow in certain locales. * util/membuf.c (put_membuf_str): New. (get_membuf): Make LEN optional. -- This fixes an obvious bug in locales where the translated string is longer than the original. The bug could be exhibited by using LANG=ru_RU.utf8 gpg -v --version. En passant we also removed the trailing white space on continued lines. Reported-by: Dmitry V. Levin" <ldv at altlinux.org>
2012-12-13Card: Fix the process of writing key or generating key.NIIBE Yutaka1-2/+2
* g10/app-openpgp.c (store_fpr): Flush KEY-FPR and KEY-TIME. -- (cherry picked from commit e7dca3e83ebd6df0a7ea55e97c3cd6e91be90af5)
2012-11-29The keyserver search menu should honor --keyid-formatDavid Shaw1-5/+11
* keyserver.c (print_keyrec): Honor --keyid-format when getting back full fingerprints from the keyserver (the comment in the code was correct, the code was not).
2012-11-08Create off-line card encryption key with the right size.Werner Koch1-1/+16
* g10/keygen.c (gen_card_key_with_backup): Get the size of the key from the card. -- Formerly the off-line encryption key was created with a fixed length of 1024 bit. With this change the key is created as expected. GnuPG-bug-id: 1230
2012-11-08Support the not anymore patented IDEA cipher algorithm.Werner Koch10-196/+107
* cipher/idea.c: New. Take from Libgcrypt master and adjust for direct use in GnuPG. * cipher/idea-stub.c: Remove. * cipher/Makefile.am: Add idea.c and remove idea-stub.c rules. * configure.ac: Remove idea-stub code. * g10/gpg.c (check_permissions): Remove code path for ITEM==2. (main): Make --load-extension a dummy option. * g10/keygen.c (keygen_set_std_prefs): Include IDEA only in PGP2 compatibility mode. * g10/misc.c (idea_cipher_warn): Remove. Also remove all callers. * g10/seckey-cert.c (do_check): Remove emitting of STATUS_RSA_OR_IDEA. * g10/status.c (get_status_string): Remove STATUS_RSA_OR_IDEA. * g10/status.h (STATUS_RSA_OR_IDEA): Remove. -- To keep the number of actually used algorithms low, we support IDEA only in a basically read-only way (unless --pgp2 is used during key generation). It does not make sense to suggest the use of this old 64 bit blocksize algorithm. However, there is old data available where it might be helpful to have IDEA available.
2012-08-24Fix typos spotted during translationsWerner Koch2-4/+4
* g10/gpg.c: uppercase after Syntax * util/secmem.c (print_warn): Update URL.
2012-08-24Actually show translators comments in PO filesDavid Prévot4-9/+8
-- Note that strings marked for gettext need to immediately follow a TRANSLATOR comment block.
2012-04-29With --quiet do not print reading passphrase from fd message.Werner Koch1-53/+53
Fix for bug#1403. * g10/passphrase.c (read_passphrase_from_fd): Act on --quiet.
2012-02-01Honor --cert-digest-algo when recreating a cert.David Shaw1-3/+8
* g10/sign.c (update_keysig_packet): Honor --cert-digest-algo when recreating a cert. This is used by various things in --edit-key like setpref, primary, etc. Suggested by Christian Aistleitner.
2012-01-20Changes to --min-cert-level should cause a trustdb rebuild (issue 1366)David Shaw6-16/+31
* g10/gpgv.c, g10/trustdb.c (read_trust_options): Add min_cert_level * g10/trustdb.c (check_trustdb_stale): Request a rebuild if pending_check_trustdb is true (set when we detect a trustdb parameter has changed). * g10/keylist.c (public_key_list): Use 'l' in the "tru" with-colons listing for min_cert_level not matching. * g10/tdbio.c (tdbio_update_version_record, create_version_record, tdbio_db_matches_options, tdbio_dump_record, tdbio_read_record, tdbio_write_record): Add a byte for min_cert_level in the tdbio version record.
2012-01-13Add a DECRYPTION_INFO status.Werner Koch3-17/+29
* g10/status.h (STATUS_DECRYPTION_INFO): New. * g10/status.c (get_status_string): Add new status string. * g10/encr-data.c: Include status.h. (decrypt_data): Print STATUS_DECRYPTION_INFO. -- This is backport of commit 5667e33. DECRYPTION_INFO <mdc_method> <sym_algo> Print information about the symmetric encryption algorithm and the MDC method. This will be emitted even if the decryption fails.
2012-01-12gpg: Remove unused fields from a trust data structure.Werner Koch1-4/+1
The functions tdbio_read_record and tdbio_write_record control the actual on-disk format. Thus there is no need to keep reserved fields in the internal data structure. * g10/tdbio.h (struct trust_record): Remove reserved fields.
2012-01-10Allow use of a standard space separated fingerprint.Werner Koch1-7/+47
We allow a single or a double space in the middle of the fingerprint to help with c+p fingerprints from an HTML pages which are not being enclosed in a "pre" tag. * g10/getkey.c (classify_user_id): Check for space separated GPG fingerprint. -- This is a backport of commit 957fe72 and 372fb4f.
2012-01-10Replace file locking by the new portable dotlock code.Werner Koch6-147/+148
* include/dotlock.h: New. From current gnupg master. * util/dotlock.c: Ditto. Include util.h. The major changes done in master are: Factor Unix and W32 specific code out into specific functions. Define HAVE_POSIX_SYSTEM. Rearrange some functions. (disable_dotlock): Rename to dotlock_disable. (create_dotlock): Rename to dotlock_create and add a dummy arg. (destroy_dotlock): Rename to dotlock_destroy. (make_dotlock): Rename to dotlock_take. (release_dotlock): Rename to dotlock_release. (remove_lockfiles): Rename to dotlock_remove_lockfiles.
2012-01-10Update copyright years.Werner Koch1-1/+1
* util/argparse.c (default_strusage): Update printed copyright year.
2011-12-02Rename all ChangeLog files to ChangeLog-2011.Werner Koch1-2/+9
* ChangeLog: New file.
2011-09-12On VMS use --batch by default if in batch mode.Werner Koch2-0/+18
This problem was identified and solved by Steven M. Schweda. Note that the vms specific code is not part of this repository. See http://antinode.info/dec/sw/gnupg.html for the VMS port.
2011-08-09Removed some set but unused vars.Werner Koch5-94/+93
2011-08-09Fix bug#1307Werner Koch3-98/+102
This is a backport of the fixes for 2.0. There is only one real bug, the other changes are for clarity and for more picky compilers.
2011-07-22Print the decoded iteration count witn --list-packets.Werner Koch2-13/+20
Fixes bug#1355.