1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00
Werner Koch 690fd61a0c
sm: More improvements for PKCS#12 parsing for latest IVBB changes.
* common/tlv.h (TLV_PARSER_FLAG_T5793): New.
(tlv_parser_new): New macro.  Rename function with an underscore.
(tlv_next_with_flag): New.
* common/tlv-parser.c (struct tlv_parser_s): Remove const from buffer.
Add fields crammed, lasttlv, and origoff.  Remove bufferlist ands ist
definition.
(dump_to_file): New but disabled debug helper.
(parse_tag): Print more info on error.
(_tlv_parser_new): Add args lasttlv and LNO.  Take a copy of the data.
(_tlv_parser_release): Free the copy of the buffer and return the
recorded TLV object from tlv_parser_new.
(_tlv_peek, tlv_parser_peek, _tlv_parser_peek_null): Remove.
(_tlv_push): Record crammed length.
(_tlv_pop): Restore crammed length.
(_tlv_parser_next): Add arg flags.  More debug output.  Handle cramming
here.  Take care of cramming here.
(tlv_expect_object): Simplify to adjust for changes in _tlv_parser_next.
(tlv_expect_octet_string): Remove arg encapsulates.  Adjust for
changes in _tlv_parser_next.  Change all allers.
(tlv_expect_null): New.
(cram_octet_string): Rewrite.
(need_octet_string_cramming): Remove.

* sm/minip12.c (dump_to_file): New.  Enablein debug mode and if a
envvar ist set.  Replace all explict but disabled dumping to call this
function.
(parse_bag_encrypted_data): Replace tlv_peek_null and a peeking for an
optional SET by non-peeking code.
(parse_cert_bag): Ditto.
(parse_shrouded_key_bag): Replace tlv_peek_null by non-peeking code.
(parse_bag_encrypted_data): Use the new TLV_PARSER_FLAG_T5793 to
enable the Mozilla workaround.
(parse_bag_encrypted_data): Replace the 'renewed_tlv' code by the new
tlv_parser_release semantics.
(parse_shrouded_key_bag): Ditto.
(parse_shrouded_key_bag): Create a new context instead of using the
former encapsulated mechanism for tlv_expect_octet_string.
(parse_bag_data): Ditto.
(p12_parse): Ditto.
--

GnuPG-bug-id: 7213

Fixing this took way too long; I should have earlier explained the
code to a co-hacker to find the problem myself in my code by this.
2024-08-06 17:51:01 +02:00
..
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2015-10-28 10:20:17 +01:00
2024-05-31 12:28:32 +02:00
2021-10-06 10:35:51 +02:00
2020-02-18 18:07:46 -05:00
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2015-11-17 12:50:22 +01:00
2024-02-15 14:40:33 +09:00
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2024-04-23 11:09:40 +02:00
2021-12-20 19:34:34 +01:00
2021-12-20 19:34:34 +01:00
2024-05-31 12:28:32 +02:00
2018-10-25 16:53:05 -04:00
2018-10-25 16:53:05 -04:00
2019-04-16 13:24:10 +09:00
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2019-07-12 12:11:26 +09:00
2020-02-18 18:07:46 -05:00
2016-03-02 14:27:30 +01:00
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2018-10-24 15:56:18 -04:00
2024-02-10 14:26:55 +01:00
2024-05-31 12:28:32 +02:00
2019-10-01 10:32:31 +02:00
2024-05-31 12:28:32 +02:00
2020-02-18 18:07:46 -05:00
2020-02-18 18:07:46 -05:00
2020-02-18 18:07:46 -05:00
2022-09-14 15:42:03 +09:00
2022-04-06 13:28:15 +09:00
2022-08-02 14:35:38 +02:00
2024-05-31 12:28:32 +02:00
2024-05-31 12:28:32 +02:00
2022-08-02 14:35:38 +02:00
2022-08-02 14:35:38 +02:00
2017-02-21 13:11:46 -05:00

Common functionality used by all modules of GnuPG.