gnupg/tests
Werner Koch 7661d2fbc6
sm: Another partly rewrite of minip12.c
* sm/minip12.c (struct tlv_ctx_s): Add origbuffer and origbufsize.
Remove pop_count.  Rename offset to length.
(dump_tag_info, _dump_tag_info): Rewrite.
(dump_tlv_ctx, _dump_tlv_ctx): Rewrite.
(tlv_new): Init origbuffer.
(_tlv_peek): Add arg ti.
(tlv_peek): New.
(tlv_peek_null): New.
(_tlv_push): Rewrite.
(_tlv_pop): Rewrite.
(tlv_next): New macro.  Move old code to ...
(_tlv_next): this.  Add arg lno.  Pop remaining end tags.
(tlv_popped): Remove.
(tlv_expect_object): Handle ndef.
(tlv_expect_octet_string): Ditto.
(parse_bag_encrypted_data): Use nesting level to control the inner
loop.
(parse_shrouded_key_bag): Likewise.
(parse_bag_data): Handle surplus octet strings.
(p12_parse): Ditto.

* sm/minip12.c (decrypt_block): Strip the padding.
(tlv_expect_top_sequence): Remove.  Replace callers by
tlv_expect_sequence.

* tests/cms/samplekeys/t6752-ov-user-ff.p12: New sample key.
* tests/cms/samplekeys/Description-p12: Add its description
--

This patch improves the BER parser by simplifying it.  Now tlv_next
pops off and thus closes all containers regardless on whether they are
length bounded or ndef.  tlv_set_pending is now always used to undo
the effect of a tlv_next in a loop condition which was terminated by a
nesting level change.

Instead of using the length as seen in the decrypted container we now
remove the padding and let the BER parser do its work.  This might
have a negative effect on pkcs#12 objects which are not correctly
padded but we don't have any example of such broken objects.

GnuPG-bug-id: 6752
2023-10-24 09:33:35 +02:00
..
cms sm: Another partly rewrite of minip12.c 2023-10-24 09:33:35 +02:00
extrasamples Added sample certificates. 2006-05-16 09:54:41 +00:00
fake-pinentries docs: Point to https://dev.gnupg.org/ . 2017-05-18 15:05:57 -04:00
gpgme tests: Fix tests/gpgme for in-source-tree builds. 2022-12-21 10:52:24 +09:00
gpgscm tests: Fix to support --enable-all-tests and variants. 2022-11-24 15:57:25 +09:00
migrations tests: Fix to support --enable-all-tests and variants. 2022-11-24 15:57:25 +09:00
openpgp tests: Fix missing test message. 2022-12-16 12:02:35 +01:00
pkits tests: More fix for semihosted environment. 2022-12-01 17:09:45 +09:00
tpm2dtests tests:tpm2dtests: Modify tests with SWTPM and relax the condition. 2023-10-06 09:56:09 +09:00
ChangeLog-2011 Generate the ChangeLog from commit logs. 2011-12-01 11:09:02 +01:00
Makefile.am tests: New way to make use of gpgconf.ctl in tests. 2021-10-12 14:30:13 +02:00
asschk.c all: fix spelling and typos 2018-10-24 15:56:18 -04:00
gpgconf.ctl.in tests: Restrict the use of gpgconf.ctl to make check. 2022-09-14 12:05:21 +02:00
run-tests.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00