aboutsummaryrefslogtreecommitdiffstats
path: root/g10 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Sanitize diagnostic with the original file name.Werner Koch2018-06-081-1/+5
| | | | | | | | | | | | | | | * g10/mainproc.c (proc_plaintext): Sanitize verbose output. -- This fixes a forgotten sanitation of user supplied data in a verbose mode diagnostic. The mention CVE is about using this to inject status-fd lines into the stderr output. Other harm good as well be done. Note that GPGME based applications are not affected because GPGME does not fold status output into stderr. CVE-id: CVE-2018-12020 GnuPG-bug-id: 4012 (cherry picked from commit 13f135c7a252cc46cff96e75968d92b6dc8dce1b)
* g10: Push compress filter only if compressed.NIIBE Yutaka2018-04-131-5/+8
| | | | | | | | | | | | | | | * g10/compress.c (handle_compressed): Fix memory leak. -- (backport from STABLE-BRANCH-2-2 commit: c31abf84659dbda5503dd9f3aa3449520bcd1b84) All other calls of push_compress_filter checks ALGO, so, do it here, too. GnuPG-bug-id: 3898 Signed-off-by: NIIBE Yutaka <[email protected]>
* g10: Fix regexp sanitization.NIIBE Yutaka2017-12-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | * g10/trustdb.c (sanitize_regexp): Only escape operators. -- Backport from master commit: ccf3ba92087e79abdeaa0208795829b431c6f201 To sanitize a regular expression, quoting by backslash should be only done for defined characters. POSIX defines 12 characters including dot and backslash. Quoting other characters is wrong, in two ways; It may build an operator like: \b, \s, \w when using GNU library. Case ignored match doesn't work, because quoting lower letter means literally and no much to upper letter. GnuPG-bug-id: 2923 Co-authored-by: Damien Goutte-Gattat <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Avoid check gpg --version during make distcheck.Werner Koch2017-07-191-0/+9
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* indent: Fix indentation of an if block.Werner Koch2017-07-191-18/+18
| | | | --
* gpg: Fix memory leak.NIIBE Yutaka2017-07-071-0/+1
| | | | | | | | | | | * g10/textfilter.c (copy_clearsig_text): Free the buffer. -- Signed-off-by: NIIBE Yutaka <[email protected]> (backport from master commit: 6b9a89e4c7d6f19de62e0a908a8d80c98bf99819)
* g10: Fix secmem leak.Ineiev2017-05-101-12/+12
| | | | | | | | | | | | | | * g10/keygen.c (proc_parameter_file): Fix secmem leak. -- proc_parameter_file adds certain parameters to the list in the PARA argument; however, these new entries are leaked because they are added to head, while the PARA list is released by the caller of proc_parameter_file. GnuPG-bug-id: 1371 Signed-off-by: Ineiev <[email protected]>
* gpg: Fix exporting of zero length user ID packets.Werner Koch2017-03-301-1/+6
| | | | | | | | | | | | | | * g10/build-packet.c (do_user_id): Avoid indeterminate length header. -- We are able to import such user ids but when exporting them the exported data could not be imported again because the parser bails out on invalid keyrings. This is now fixed and should be backported. Note that in 1.4 and 2.0 this is only an issue for attribute packets. In 2.1 user IDs were also affected.a Signed-off-by: Werner Koch <[email protected]>
* gpg: Add dummy option --with-subkey-fingerprint.Werner Koch2016-08-171-0/+5
| | | | | | * g10/gpg.c (opts): Add dummy option. Signed-off-by: Werner Koch <[email protected]>
* gpg: Avoid publishing the GnuPG version by defaultDaniel Kahn Gillmor2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (main): initialize opt.emit_version to 0 * doc/gpg.texi: document different default for --emit-version -- The version of GnuPG in use is not particularly helpful. It is not cryptographically verifiable, and it doesn't distinguish between significant version differences like 2.0.x and 2.1.x. Additionally, it leaks metadata that can be used to distinguish users from one another, and can potentially be used to target specific attacks if there are known behaviors that differ between major versions. It's probably better to take the more parsimonious approach to metadata production by default. (backport of master commit c9387e41db7520d176edd3d6613b85875bdeb32c) Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix spelling: "occured" should be "occurred"Daniel Kahn Gillmor2016-08-042-2/+2
| | | | | | | | * checks/armor.test, cipher/des.c, g10/ccid-driver.c, g10/pkclist.c, util/regcomp.c, util/regex_internal.c: correct the spelling of "occured" to "occurred" Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* g10: Fix checking key for signature validation.NIIBE Yutaka2016-08-041-2/+2
| | | | | | | | | | | | * g10/sig-check.c (signature_check2): Not only subkey, but also primary key should have flags.valid=1. -- (backport of master commit 6f284e6ed63f514b15fe610f490ffcefc87a2164) Signed-off-by: NIIBE Yutaka <[email protected]>
* gpgv: Tweak default options for extra security.NIIBE Yutaka2016-07-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | * g10/gpgv.c (main): Set opt.no_sig _cache, so that it doesn't depend on cached status. Similarly, set opt.flags.require_cross_cert for backsig validation for subkey signature. -- (backport of master commit e32c575e0f3704e7563048eea6d26844bdfc494b) It is common that an organization distributes binary keyrings with signature cache (Tag 12, Trust Packet) and people use gpgv to validate signature with such keyrings. In such a use case, it is possible that the key validation itself is skipped. For the purpose of gpgv validation of signatures, we should not depend on signature cache in keyrings (if any), but we should validate the key by its self signature for primary key, and back signature for subkey. Signed-off-by: NIIBE Yutaka <[email protected]>
* g10: Fix keysize with --expert.NIIBE Yutaka2016-07-061-2/+2
| | | | | | | | | * g10/keygen.c (ask_keysize): It's 768 only for DSA. -- GnuPG-bug-id: 2238 Signed-off-by: NIIBE Yutaka <[email protected]>
* g10: Fix --list-packets.NIIBE Yutaka2016-06-284-5/+4
| | | | | | | | | | | | | | | | | | * g10/gpg.c (main): Call set_packet_list_mode after assignment of opt.list_packets. * g10/mainproc.c (do_proc_packets): Don't stop processing with --list-packets as the comment says. * g10/options.h (list_packets): Fix the comment. * g10/parse-packet.c: Fix the condition for opt.list_packets. -- (backport from 2.0 commit 4f336ed780cc2783395f3ff2b12b3ebb8e097f7b which is backport of master commit 52f65281f9743c42a48bf5a3354c9ab0ecdb681a) Debian-bug-id: 828109 Signed-off-by: NIIBE Yutaka <[email protected]>
* g10: Fix another race condition for trustdb access.Niibe Yutaka2016-06-151-2/+5
| | | | | | | | | | | | | | | * g10/tdbio.c (create_version_record): Call create_hashtable to always make hashtable, together with the version record. (get_trusthashrec): Remove call to create_hashtable. -- GnuPG-bug-id: 1675 Thanks to Scott Moser to reproducible script and patience. Signed-off-by: NIIBE Yutaka <[email protected]> (backport from master commit 35a3ce2acf78a95fecbccfd8db0560cca24232df)
* g10: Make sure to have the directory for trustdb.NIIBE Yutaka2016-02-121-45/+52
| | | | | | | | | | | | | | | | * g10/tdbio.c (tdbio_set_dbname): Return earlier if !CREATE. Check the directory and create it if none before calling take_write_lock. -- Thanks to Marc Deslauriers for the bug report and his patch. GnuPG-bug-id: 2246 Signed-off-by: NIIBE Yutaka <[email protected]> (backport from master commit 2f3e42047d17313eeb38d354048f343158402a8d)
* g10: Fix iobuf API of filter function for alignment.NIIBE Yutaka2016-01-2610-11/+11
| | | | | | | | | | | | | | | | | | | | | * include/iobuf.h (struct iobuf_struct): Remove DESC. * util/iobuf.c (iobuf_desc): New. (print_chain, iobuf_close, iobuf_open, iobuf_fdopen, iobuf_sockopen) (iobuf_create, iobuf_append, iobuf_openrw, iobuf_ioctl) (iobuf_push_filter2, pop_filter, underflow): Use iobuf_desc. (file_filter, sock_filter, block_filter): Fill the description. * g10/armor.c, g10/cipher.c, g10/compress-bz2.c, g10/compress.c, g10/encode.c, g10/encr-data.c, g10/mdfilter.c, g10/pipemode.c, g10/progress.c, g10/textfilter.c: Likewise. -- Newer GCC warns against possible alignment difference of pointers. This change can silence those warnings. Signed-off-by: NIIBE Yutaka <[email protected]> (backported from 2.1 commit 3f52c7da3940ec06572270d511000dc7fe9c27d2)
* w32: Avoid warning when using newer mingw versions.Werner Koch2015-12-191-1/+1
| | | | | | * g10/tdbio.c (ftruncate): Do not define if already defined. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add option --weak-digest to gpg and gpgv.Daniel Kahn Gillmor2015-12-196-15/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/options.h: Add weak_digests linked list to opts. * g10/main.h: Declare weakhash linked list struct and additional_weak_digest() function to insert newly-declared weak digests into opts. * g10/misc.c: (additional_weak_digest): New function. (print_digest_algo_note): Check for deprecated digests. * g10/sig-check.c: (do_check): Reject all weak digests. * g10/gpg.c: Add --weak-digest option to gpg. * doc/gpg.texi: Document gpg --weak-digest option. * g10/gpgv.c: Add --weak-digest option to gpgv. * doc/gpgv.texi: Document gpgv --weak-digest option. -- gpg and gpgv treat signatures made over MD5 as unreliable, unless the user supplies --allow-weak-digests to gpg. Signatures over any other digest are considered acceptable. Despite SHA-1 being a mandatory-to-implement digest algorithm in RFC 4880, the collision-resistance of SHA-1 is weaker than anyone would like it to be. Some operators of high-value targets that depend on OpenPGP signatures may wish to require their signers to use a stronger digest algorithm than SHA1, even if the OpenPGP ecosystem at large cannot deprecate SHA1 entirely today. This changeset adds a new "--weak-digest DIGEST" option for both gpg and gpgv, which makes it straightforward for anyone to treat any signature or certification made over the specified digest as unreliable. This option can be supplied multiple times if the operator wishes to deprecate multiple digest algorithms, and will be ignored completely if the operator supplies --allow-weak-digests (as before). MD5 is always considered weak, regardless of any further --weak-digest options supplied. Signed-off-by: Daniel Kahn Gillmor <[email protected]> (this is a rough cherry-pick of applying the following commits to STABLE-BRANCH-1-4: 76afaed65e3b0ddfa4923cb577ada43217dd4b18 b98939812abf6c643c752ce7c325f98039a1a9e2 91015d021b3dcbe21ad0e580a4f34c523abf9e72 )
* gpg: Reject signatures made with MD5.Werner Koch2015-12-193-0/+24
| | | | | | | | | | | | | | * g10/gpg.c: Add option --allow-weak-digest-algos. (main): Set option also in PGP2 mode. * g10/options.h (struct opt): Add flags.allow_weak_digest_algos. * g10/sig-check.c (do_check): Reject MD5 signatures. * tests/openpgp/gpg.conf.tmpl: Add allow_weak_digest_algos. -- (cherry picked from commit f90cfe6b66269de0154d810c5cee1fe9a5af475c) Resolved conflicts: g10/gpg.c - adjust. tests/openpgp/defs.inc - no changes
* gpg: Change default cipher for --symmetric from CAST5 to AES-128.Werner Koch2015-12-172-7/+10
| | | | | | | | | | | * g10/main.h (DEFAULT_CIPHER_ALGO): Change to AES or CAST5 or 3DES depending on configure options. * g10/gpg.c (main): Set opt.s2k_cipher_algo to DEFAULT_CIPHER_ALGO. -- (cherry picked from commit 57df1121c18b004dd763b35eabf7b51fc9e8ec38) Signed-off-by: Werner Koch <[email protected]>
* Pass DBUS_SESSION_BUS_ADDRESS for gnome3Daniel Kahn Gillmor2015-12-171-0/+9
| | | | | | | | * g10/passphrase.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.
* gpg: Avoid cluttering stdout with trustdb info in verbose mode.Werner Koch2015-11-201-1/+1
| | | | | | | | | | | | | | | | * g10/trustdb.c (validate_keys): Call dump_key_array only in debug mode. -- I guess that is a left-over from an early attempt to output information on the trustdb for use by other tools. Maybe related to the former --list-trust-path command. Sending it to stdout is probably useful so we do this now only in debug mode. Signed-off-by: Werner Koch <[email protected]> Backported to STABLE-BRANCH-1-4 from b03a2647299a6c8764a2574590cbaccdff9e497d by dkg
* gpg: Silence a compiler warning.Werner Koch2015-10-011-4/+4
| | | | | | | | | | * g10/parse-packet.c (enum_sig_subpkt): Replace hack. -- GCC 5 failure reported by Kevin Locke <[email protected]> (backport from master commit 6a0c3fa19cfcdd590b96691e8a8ffb48fb5e0ec4)
* Obsolete option --no-sig-create-check.Werner Koch2015-09-013-8/+6
| | | | | | | | | * cipher/rsa.c (rsa_sign): Verify after sign. * g10/gpg.c (opts): Make --no-sig-create-check a NOP. * g10/options.h (opt): Remove field "no_sig_create_check". * g10/sign.c (do_sign): Do check only for DSA. Signed-off-by: Werner Koch <[email protected]>
* g10: Fix a race condition initially creating trustdb.NIIBE Yutaka2015-06-161-3/+3
| | | | * g10/tdbio.c (take_write_lock, tdbio_set_dbname): Fix message.
* g10: Fix a race condition initially creating trustdb.NIIBE Yutaka2015-06-151-65/+56
| | | | | | | | | | | | | * g10/tdbio.c (take_write_lock, release_write_lock): New. (put_record_into_cache, tdbio_sync, tdbio_end_transaction): Use new lock functions. (tdbio_set_dbname): Fix the race. (open_db): Don't call dotlock_create. -- (backported from 2.1 commit fe5c6edaed78839303d67e01e141cfc6b5de9aec) GnuPG-bug-id: 1675
* g10: detects public key encryption packet error properly.NIIBE Yutaka2015-05-191-3/+3
| | | | | | | | | g10/mainproc.c (proc_pubkey_enc): Only allow relevant algorithms for encryption. -- (backported from 2.1 commit c771963140cad7c1c25349bcde27e427effc0058)
* g10: Improve handling of no corresponding public key.NIIBE Yutaka2015-05-191-0/+12
| | | | | | | | | | | | | | | * g10/getkey.c (get_seckey): Return G10ERR_NO_PUBKEY when it's not exact match. -- In the situation of corrupted .gnupg/ where only private subkey is available but no corresponding public key of the subkey, the code returned public primary key which caused mysterious error (for a user). This fix detects an error earlier. GnuPG-bug-id: 1422 Debian-Bug-Id: #638619
* g10: fix cmp_public_key and cmp_secret_keys.NIIBE Yutaka2015-04-301-8/+14
| | | | | | | | | | | | * g10/free-packet.c (cmp_public_keys, cmp_secret_keys): Compare opaque data at the first entry of the array when it's unknown algo. * mpi/mpi-cmp.c (mpi_cmp): Backport libgcrypt 1.5.0's semantics. -- (backported from 2.0 commit 43429c7869152f301157e4b24790b3801dce0f0a) GnuPG-bug-id: 1962
* gpg: Fix DoS while parsing mangled secret key packets.Werner Koch2015-04-051-7/+43
| | | | | | | | | | | | | | | * g10/parse-packet.c (parse_key): Check PKTLEN before calling mpi_read et al. -- Due to the missing length checks PKTLEN may turn negative. Because PKTLEN is an unsigned int the malloc in read_rest would try to malloc a too large number and terminate the process with "error reading rest of packet: Cannot allocate memory". Reported-by: Hanno Böck. Signed-off-by: Werner Koch <[email protected]> (backported from 2.0 commit 0aac920f23fd07e152fdb7385299c92bb9a4ade3)
* gpg: Remove left-over debug message.Werner Koch2015-03-281-3/+0
| | | | * g10/armor.c (check_input): Remove log_debug.
* Release 1.4.19.gnupg-1.4.19Werner Koch2015-02-271-3/+2
|
* Switch to a hash and CERT record based PKA system.Werner Koch2015-02-263-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * util/pka.c: Rewrite. (get_pka_info): Add arg fprbuflen. Change callers to pass this. * util/strgutil.c (ascii_strlwr): New. * configure.ac: Remove option --disable-dns-pka. (USE_DNS_PKA): Remove ac_define. * g10/getkey.c (parse_auto_key_locate): Always include PKA. -- Note that although PKA is now always build, it will only work if support for looking up via DNS has not been disabled. The new PKA only works with the IPGP DNS certtype and shall be used only to retrieve the fingerprint and optional the key for the first time. Due to the security problems with DNSSEC the former assumption to validate the key using DNSSEC is not anymore justified. Instead an additional layer (e.g. Trust-On-First-Use) needs to be implemented to track change to the key. Having a solid way of getting a key matching a mail address is however a must have. More work needs to go into a redefinition of the --verify-options pka-lookups and pka-trust-increase. The auto-key-locate mechanism should also be able to continue key fetching with another method once the fingerprint has been retrieved with PKA. Signed-off-by: Werner Koch <[email protected]> This is a backport from master. (backported from commit 2fc27c8696f5cf2ddf3212397ea49bff115d617b)
* Move two functions from g10/ to util/.Werner Koch2015-02-262-50/+0
| | | | | | | * g10/misc.c (has_invalid_email_chars, is_valid_mailbox): Move to ... * util/strgutil.c: here. Signed-off-by: Werner Koch <[email protected]>
* Allow requesting only an IPGP certtype with dns_cert().Werner Koch2015-02-261-1/+1
| | | | | | * util/cert.c (get_cert): Add arg want_ipgp. Change callers. Signed-off-by: Werner Koch <[email protected]>
* Protect against NULL return of mpi_get_opaque.Werner Koch2015-02-231-5/+12
| | | | | | | | | | | * g10/seckey-cert.c (do_check): Call BUG for NULL return of get_opaque. -- This is the suggested addition from commit 6f03218. We better run into an fatal error than into a segv. Signed-off-by: Werner Koch <[email protected]>
* gpg: Fix segv due to NULL value stored as opaque MPIDaniel Kahn Gillmor2015-02-232-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/build-packet.c (do_secret_key): Check for NULL return from gcry_mpi_get_opaque. * g10/keyid.c (hash_public_key): Ditto. -- This is a backport of 76c8122adfed0f0f443cce7bda702ba2b39661b3 from master to the STABLE-BRANCH-1-4 On the STABLE-BRANCH-1-4, we may also want to patch g10/seckey-cert.c, but that has not been done in this patch. This fix extends commmit 0835d2f44ef62eab51fce6a927908f544e01cf8f. gpg2 --export --no-default-keyring --keyring TESTDATA With TESTDATA being below after unpacking. -----BEGIN PGP ARMORED FILE----- mBMEhdkMmS8BcX8F//8F5voEhQAQmBMEnAAAZwAAo4D/f/8EhQAAAIAEnP8EhQAQ iBMEnP8AAAAABf8jIID///8EhQYQmBMEnIUAEIgTBKT/AAAAAAUAACCA/f//BIUA EJgTBJx/AP8ABPPzBJx/AP8ABPPz =2yE0 -----END PGP ARMORED FILE----- Reported-by: Jodie Cunningham [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Remove an unused variable.Werner Koch2015-02-231-1/+0
| | | | | | | * g10/import.c (import): Remove need_armor. [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Print better diagnostics for keyserver operations.Werner Koch2015-02-235-22/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | * g10/armor.c (parse_key_failed_line): New. (check_input): Watch out for gpgkeys_ error lines. * g10/filter.h (armor_filter_context_t): Add field key_failed_code. * g10/import.c (import): Add arg r_gpgkeys_err. (import_keys_internal): Ditto. (import_keys_stream): Ditto. * g10/keyserver.c (keyserver_errstr): New. (keyserver_spawn): Detect "KEY " lines while sending. Get gpgkeys_err while receiving keys. (keyserver_work): Add kludge for better error messages. -- GnuPG-bug-id: 1832 Note that these changes can be backported to 1.4 but they don't make sense for 2.1 due to the removal of the keyserver helpers. The error reporting could be improved even more but given that this is an old GnuPG branch it is not justified to put too much effort into it. Signed-off-by: Werner Koch <[email protected]> [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-2311-96/+78
| | | | | | | | | | | | | | | | | | | * include/host2net.h (buf16_to_ulong, buf16_to_uint): New. (buf16_to_ushort, buf16_to_u16): New. (buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New. -- This fixes sign extension on shift problems. Hanno Böck found a case with an invalid read due to this problem. To fix that almost all uses of "<< 24" and "<< 8" are changed by this patch to use an inline function from host2net.h. (back ported from commit 2183683bd633818dd031b090b5530951de76f392) Signed-off-by: Werner Koch <[email protected]> [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: Change remaining http links to gnupg.org to httpsWerner Koch2015-02-232-3/+3
| | | | | | | | -- GnuPG-bug-id: 1830 [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Prevent an invalid memory read using a garbled keyring.Werner Koch2015-02-231-3/+21
| | | | | | | | | | | | | | | | | | | | | | | * g10/keyring.c (keyring_get_keyblock): Whitelist allowed packet types. -- The keyring DB code did not reject packets which don't belong into a keyring. If for example the keyblock contains a literal data packet it is expected that the processing code stops at the data packet and reads from the input stream which is referenced from the data packets. Obviously the keyring processing code does not and cannot do that. However, when exporting this messes up the IOBUF and leads to an invalid read of sizeof (int). We now skip all packets which are not allowed in a keyring. Reported-by: Hanno Böck <[email protected]> (back ported from commit f0f71a721ccd7ab9e40b8b6b028b59632c0cc648) [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Fix a NULL-deref in export due to invalid packet lengths.Werner Koch2015-02-231-1/+2
| | | | | | | | | | | | | * g10/build-packet.c (write_fake_data): Take care of a NULL stored as opaque MPI. -- Reported-by: Hanno Böck <[email protected]> (back ported from commit 0835d2f44ef62eab51fce6a927908f544e01cf8f) [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Fix a NULL-deref due to empty ring trust packets.Werner Koch2015-02-231-3/+7
| | | | | | | | | | | | | * g10/parse-packet.c (parse_trust): Always allocate a packet. -- Reported-by: Hanno Böck <[email protected]> Signed-off-by: Werner Koch <[email protected]> (back ported from commit 39978487863066e59bb657f5fe4e8baab510da7e) [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Limit the size of key packets to a sensible value.Werner Koch2015-02-231-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/parse-packet.c (MAX_KEY_PACKET_LENGTH): New. (MAX_UID_PACKET_LENGTH): New. (MAX_COMMENT_PACKET_LENGTH): New. (MAX_ATTR_PACKET_LENGTH): New. (parse_key): Limit the size of a key packet to 256k. (parse_user_id): Use macro for the packet size limit. (parse_attribute): Ditto. (parse_comment): Ditto. -- Without that it is possible to force gpg to allocate large amounts of memory by using a bad encoded MPI. This would be an too easy DoS. Another way to mitigate would be to change the MPI read function to allocate memory dynamically while reading the MPI. However, that complicates and possibly slows down the code. A too large key packet is in any case a sign for broken data and thus gpg should not use it. Reported-by: Hanno Böck GnuPG-bug-id: 1823 Signed-off-by: Werner Koch <[email protected]> (back ported from commit 382ba4b137b42d5f25a7e256bb7c053ee5ac7b64) [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Allow predefined names as answer to the keygen.algo prompt.Werner Koch2015-02-231-11/+13
| | | | | | | | | | | * g10/keygen.c (ask_algo): Add list of strings. -- Signed-off-by: Werner Koch <[email protected]> (backported from commit b1d5ed6ac842469afcb84868d0f6641dc286a6c7) [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Print a warning if the subkey expiration may not be what you want.Werner Koch2015-02-231-0/+58
| | | | | | | | | | | | | | | * g10/keyedit.c (subkey_expire_warning): New. keyedit_menu): Call it when needed. -- GnuPG-bug-id: 1715 The heuristic to detect a problem is not very advanced but it should catch the most common cases. (backported from commit ae3d1bbb65b65cf3c57bb14886be120f5e31635d) [dkg: rebased to STABLE-BRANCH-1-4] Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Fix possible read of unallocated memoryWerner Koch2015-01-131-4/+7
| | | | | | | | | | | | | | | | | * g10/parse-packet.c (can_handle_critical): Check content length before calling can_handle_critical_notation. -- The problem was found by Jan Bee and gniibe proposed the used fix. Thanks. This bug can't be exploited: Only if the announced length of the notation is 21 or 32 a memcmp against fixed strings using that length would be done. The compared data is followed by the actual signature and thus it is highly likely that not even read of unallocated memory will happen. Nevertheless such a bug needs to be fixed. Signed-off-by: Werner Koch <[email protected]>