aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.1 commit d901efcebaefaf6eae4a9b9aa8f0c2c055d3518a)
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-121-20/+21
| | | | | | | | | | | | | | | | * 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]>
* gpg: Fix a NULL-deref due to empty ring trust packets.Werner Koch2015-02-121-3/+5
| | | | | | | | | | * 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)
* gpg: Limit the size of key packets to a sensible value.Werner Koch2015-02-121-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* 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]>
* gpg: Fix use of uninit.value in listing sig subpkts.Werner Koch2014-11-241-1/+5
| | | | | | | | | | | | | | | * g10/parse-packet.c (dump_sig_subpkt): Print regex subpacket sanitized. -- We may not use "%s" to print an arbitrary buffer. At least "%.*s" should have been used. However, it is in general preferable to escape control characters while printf user data. Reported-by: Hanno Böck Signed-off-by: Werner Koch <[email protected]> (backported from commit 596ae9f5433ca3b0e01f7acbe06fd2e424c42ae8)
* gpg: Fix off-by-one read in the attribute subpacket parser.Werner Koch2014-11-241-0/+8
| | | | | | | | | | | * g10/parse-packet.c (parse_attribute_subpkts): Check that the attribute packet is large enough for the subpacket type. -- Reported-by: Hanno Böck Signed-off-by: Werner Koch <[email protected]> (backported from commit 0988764397f99db4efef1eabcdb8072d6159af76)
* gpg: Cap size of attribute packets at 16MB.Werner Koch2014-07-211-1/+12
| | | | | | | | | | | | | | | | | | * g10/parse-packet.c (parse_attribute): Avoid xmalloc failure and cap size of packet. -- Tavis Ormandy reported a fatal error for attribute packets with a zero length payload. This is due to a check in Libgcrypt's xmalloc which rejects a malloc(0) instead of silently allocating 1 byte. The fix is obvious. In addition we cap the size of attribute packets similar to what we do with user id packets. OpenPGP keys are not the proper way to store movies. Resolved conflicts: g10/parse-packet.c - indentation. Use plain fprintf.
* gpg: Graceful skip reading of corrupt MPIs.Werner Koch2014-06-021-5/+17
| | | | | | | | | | * g10/parse-packet.c (mpi_read): Change error message on overflow. -- This gets gpg 2.x in sync to what gpg 1.4 does. No need to die for a broken MPI. GnuPG-bug-id: 1593
* Print the decoded iteration count with --list-packets.Werner Koch2011-07-221-20/+22
| | | | Fixes bug#1355.
* Backport bug fix. Fixes bug#1240. Werner Koch2010-06-181-2/+10
|
* Fixed a bunch of little bugs as reported by Fabian Keil.Werner Koch2009-06-241-1/+1
| | | | | Still one problem left; marked with a gcc #warning.
* Preparing for 2.0.12.gnupg-2.0.12Werner Koch2009-06-171-2/+2
|
* Fix a signal cleanup problem.Werner Koch2009-05-261-3/+13
| | | | | Fix zero length MPI reading.
* Print keyid in gpg --list-packets.Werner Koch2009-05-131-0/+10
| | | | | | Add some not yet code to app-nks.c Changed batch mode expiration time computation
* Marked all unused args on non-W32 platforms.Werner Koch2008-10-201-36/+51
|
* Fix bug #931Werner Koch2008-09-251-16/+26
|
* Adjust for the changed Camellia draft.Werner Koch2008-04-181-10/+4
| | | | | | W32 gettext changes. Comment and typo fixes.
* Fix bug 894.Werner Koch2008-03-251-1/+2
| | | | | | Change default keyserver. Allow key protection with Camellia.
* Support DSA2.Werner Koch2007-12-121-2/+4
| | | | | | Support Camellia for testing. More audit stuff.
* Changed to GPLv3.Werner Koch2007-07-041-4/+2
| | | | | Removed intl/.
* * parse-packet.c (parse_marker): New. Enforce that the markerDavid Shaw2007-04-061-22/+58
| | | | | | contains 'P', 'G', 'P', and nothing but. (parse): Call it here. (skip_packet): No longer need to handle marker packets here.
* From STABLE-BRANCH-1-4David Shaw2007-03-101-1/+1
| | | | | | | | * parse-packet.c (parse_signature): It's hex. * getkey.c (merge_selfsigs_subkey): Avoid listing the contents of a backsig when list mode is on. Noted by Timo Schulz.
* Fix for Debian bug 402592Werner Koch2007-02-041-3/+13
|
* * parse-packet.c (read_protected_v3_mpi): Make sure to stopWerner Koch2007-01-151-2/+2
| | | | | | | | reading even for corrupted packets. * keygen.c (generate_user_id): Need to allocate one byte more. Reported by Felix von Leitner.
* Fixed that nasty 64 bit but.Werner Koch2006-11-101-10/+10
|
* * parse-packet.c (parse_symkeyenc): Show the unpacked as well as theDavid Shaw2006-10-131-1/+3
| | | | | | | | | packed s2k iteration count. * main.h, options.h, gpg.c (encode_s2k_iterations, main), passphrase.c (hash_passphrase): Add --s2k-count option to specify the number of s2k hash iterations.
* Fix for bug 537Werner Koch2006-10-021-1/+4
|
* Preparing a new releasegnupg-1.9.22Werner Koch2006-07-271-0/+14
|
* A couple of fixes. gpg2's key generation does now work.Werner Koch2006-06-301-9/+13
|
* Ported patches from 1.4.x Werner Koch2006-06-271-7/+31
|
* Continued with merging.Werner Koch2006-04-191-4/+3
| | | | | Still does not build.
* Merged with gpg 1.4.3 code. Werner Koch2006-04-191-503/+598
| | | | | The gpg part does not yet build.
* Merged most of David Shaw's changes in 1.3 since 2003-06-03.Werner Koch2003-09-231-19/+46
|
* * gpgsm.c (main): Add secmem features and set the random seed file.Werner Koch2003-07-291-9/+11
| | | | | | | | | | | | (gpgsm_exit): Update the random seed file and enable debug output. * g10.c (main): Add secmem features and set the random seed file. (g10_exit): Update the random seed file. * parse-packet.c (parse_signature,read_protected_v3_mpi) (parse_key): Fixed use of mpi_set_opaque. * keygen.c (gen_card_key): Ditto.
* * app-openpgp.c (store_fpr): Fixed fingerprint calculation.Werner Koch2003-07-011-15/+8
| | | | | | | | * keygen.c (gen_card_key): Obviously we should use the creation date received from SCDAEMON, so that the fingerprints will match. * sign.c (do_sign): Pass the serialno to the sign code. * keyid.c (serialno_and_fpr_from_sk): New.
* Key generation and signing using the OpenPGP card does rudimentary work.Werner Koch2003-06-271-1/+31
|
* Finished the bulk of changes for gnupg 1.9. This included switchingWerner Koch2003-06-181-130/+129
| | | | | | | | | | | to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works.
* This commit was manufactured by cvs2svn to create branchRepo Admin2003-06-051-0/+2281
| | | | 'GNUPG-1-9-BRANCH'.
* This commit was manufactured by cvs2svn to create branchRepo Admin2002-10-191-2260/+0
| | | | 'GNUPG-1-9-BRANCH'.
* * keylist.c (print_capabilities): Secret-parts-missing keys should showDavid Shaw2002-10-031-0/+1
| | | | | | | | | that fact in the capabilities, and only primary signing keys can certify other keys. * packet.h, parse_packet.c (parse_key): Add is_primary flag for public keys (it already exists for secret keys).
* * import.c (import_secret_one): Check for an illegal (>110) protectionDavid Shaw2002-10-021-0/+6
| | | | | | | | | | | | | | | | | | cipher when importing a secret key. * keylist.c (list_keyblock_print): Show a '#' for a secret-parts-missing key. * parse_packet.c (parse_key): Some comments. * revoke.c (gen_revoke): Remove some debugging code. * trustdb.c (verify_own_keys): Make trusted-key a non-deprecated option again. * seckey-cert.c (do_check): Don't give the IDEA warning unless the cipher in question is in fact IDEA.
* comment type fixWerner Koch2002-09-201-1/+1
|
* * g10.c, options.h: Removed option --emulate-checksum-bug.Werner Koch2002-09-111-12/+61
| | | | | | | | | | | | | | | * misc.c (checksum_u16_nobug): Removed. (checksum_u16): Removed the bug emulation. (checksum_mpi): Ditto. (checksum_mpi_counted_nbits): Removed and replaced all calls with checksum_mpi. * parse-packet.c (read_protected_v3_mpi): New. (parse_key): Use it here to store it as an opaque MPI. * seckey-cert.c (do_check): Changed the v3 unprotection to the new why to store these keys. (protect_secret_key): Likewise. * build-packet.c (do_secret_key): And changed the writing.
* Cleanups and minor fixes.Werner Koch2002-09-101-4/+8
|
* * pkclist.c (do_we_trust_pre): Changed the wording of a warning.Werner Koch2002-08-301-34/+42
| | | | | | | | | | | | | | | | * encode.c (encode_simple,encode_crypt): Use new style CTB for compressssed packets when using MDC. We need to do this so that concatenated messages are properly decrypted. Old style compression assumes that it is the last packet; given that we can't determine the length in advance, the uncompressor does not know where to start. Actually we should use the new CTB always but this would break PGP 2 compatibility. * parse-packet.c (parse): Special treatment for new style CTB compressed packets. * build-packet.c (do_mdc): Removed. Was not used. (do_encrypted_mdc): Count the version number and the MDC packet.
* * options.skel: Fix a few typos, clarify "group", and remove sample photoDavid Shaw2002-07-011-1/+2
| | | | | | | | viewers for Win32 since they are the defaults now. * parse-packet.c (make_attribute_uidname), keylist.c (dump_attribs): Fix two typecast warnings.
* Update head to match stable 1.0David Shaw2002-06-291-179/+569
|
* Add features packet and fixes MIPS3.Werner Koch2000-10-111-1/+8
|
* See ChangeLog: Fri Oct 6 14:29:16 CEST 2000 Werner KochWerner Koch2000-10-061-4/+6
|