1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-10-31 20:08:43 +01:00
gnupg/tests/cms
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
..
samplekeys sm: Another partly rewrite of minip12.c 2023-10-24 09:33:35 +02:00
samplemsgs common: Allow for GCM decryption in de-vs mode. 2021-06-02 19:14:37 +02:00
32100C27173EF6E9C4E9A25D3D69F86D37A4F939 tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
567064FE6D14A17B2D811ABB407728BC558AA455 tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
all-tests.scm tests: Fix tests under cms. 2022-12-01 10:33:20 +09:00
cert_cci_sphinx_ca.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_test_wzs.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_test_zs.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_user02.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_user03.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_user04.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_user06.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_cci_user07.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_dfn_pca01.der tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_dfn_pca15.der tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_g10code_test1.der tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
cert_testpki_testpca.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
crl_testpki_testpca.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
decrypt.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
encrypt.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
export.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
gpgsm-defs.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
import.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
inittests tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
key_g10code_pete1.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
key_g10code_theo1.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
Makefile.am sm: Support more HMAC algos in the pkcs#12 parser. 2023-10-06 11:02:19 +02:00
plain-1.cms.asc tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
plain-2.cms.asc tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
plain-3.cms.asc tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
plain-large.cms.asc tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
run-tests.scm tests: Fix to support --enable-all-tests and variants. 2022-11-24 15:57:25 +09:00
runtest tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
setup.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
shell.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
sign.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
skey_g10code_test1.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
sm-sign+verify tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
sm-verify tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-1.dsig.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-1.osig-bad.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-1.osig-badusage.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-1.osig.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-1.txt tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-2.osig-bad.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-2.osig.pem tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-2.txt tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
text-3.txt tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00
verify.scm tests: Rename subdir gpgsm to cms and move sample dirs. 2021-05-31 21:51:45 +02:00