Add PKCS#12 parser.

This is cleaner than the OpenSSL code was, at least, but it's hardly
beautiful due to the "standard" that it's trying to implement. (See

The references from the PKCS#8 code to various ciphers have digests have
been made into function pointer references rather than NIDs so that the
linker will be able to drop RC2 code for binaries that don't call PKCS#8
or #12 functions.

A bug that crashed OpenSSL/BoringSSL when parsing a malformed PKCS#8
structure has been fixed too.


Change-Id: Iaa1039e04ed7877b90792835e8ce3ebc3b29f89e
Reviewed-by: Adam Langley <>
11 files changed