Home GnuPG
Diffusion GnuPG c1f78634ec39

sm: Improve the octet string cramming for pkcs#12

Description

sm: Improve the octet string cramming for pkcs#12

* sm/minip12.c (need_octet_string_cramming): New.
(tlv_expect_object, tlv_expect_octet_string): Run the test before
cramming.
* sm/minip12.c (ENABLE_DER_STRUCT_DUMPING): New but undefined macro
for debug purposes.
(bag_decrypted_data_p, bag_data_p): Use macro to allow dumping.

This bug was exhibited by importing a gpgsm exported EC certificate.

We use an extra test instead of retrying to allow retruning an error
from malloc failure. And well, for easier reading of the code.

Details

Provenance
wernerAuthored on Oct 5 2023, 10:02 AM
Parents
rG68b7aff9ce34: agent: Fix agent_update_private_key.
Branches
Unknown
Tags
Unknown
Tasks
T6536: Extend P12 parser for ShroudedKeyBag inside a CertBag