375124b162
CBS_asn1_ber_to_der currently uses heuristics because implicitly-tagged constructed strings in BER are ambiguous with implicitly-tagged sequences. It's not possible to convert BER to DER without knowing the schema. Fortunately, implicitly tagged strings don't appear often so instead split the job up: CBS_asn1_ber_to_der fixes indefinite-length elements and constructed strings it can see. Implicitly-tagged strings it leaves uncoverted, but they will only nest one level down (because BER kindly allows one to nest constructed strings arbitrarily!). CBS_get_asn1_implicit_string then performs the final concatenation at parse time. This isn't much more complex and lets us parse BER more accurately and also reject a number of mis-encoded values (e.g. constructed INTEGERs are not a thing) we'd previously let through. The downside is the post-conversion parsing code must be aware of this limitation of CBS_asn1_ber_to_der. Fortunately, there's only one implicitly-tagged string in our PKCS#12 code. (In the category of things that really really don't matter, but I had spare cycles and the old BER converter is weird.) Change-Id: Iebdd13b08559fa158b308ef83a5bb07bfdf80ae8 Reviewed-on: https://boringssl-review.googlesource.com/7052 Reviewed-by: Adam Langley <agl@google.com> |
||
---|---|---|
.. | ||
aes | ||
asn1 | ||
base64 | ||
bio | ||
bn | ||
buf | ||
bytestring | ||
chacha | ||
cipher | ||
cmac | ||
conf | ||
curve25519 | ||
des | ||
dh | ||
digest | ||
dsa | ||
ec | ||
ecdh | ||
ecdsa | ||
engine | ||
err | ||
evp | ||
hkdf | ||
hmac | ||
lhash | ||
md4 | ||
md5 | ||
modes | ||
obj | ||
pem | ||
perlasm | ||
pkcs8 | ||
poly1305 | ||
rand | ||
rc4 | ||
rsa | ||
sha | ||
stack | ||
test | ||
x509 | ||
x509v3 | ||
CMakeLists.txt | ||
constant_time_test.c | ||
cpu-arm-asm.S | ||
cpu-arm.c | ||
cpu-intel.c | ||
crypto.c | ||
directory_posix.c | ||
directory_win.c | ||
directory.h | ||
ex_data.c | ||
internal.h | ||
mem.c | ||
refcount_c11.c | ||
refcount_lock.c | ||
refcount_test.c | ||
thread_none.c | ||
thread_pthread.c | ||
thread_test.c | ||
thread_win.c | ||
thread.c | ||
time_support.c |