DER writer: Add the possibility to abandon empty SEQUENCEs
authorRichard Levitte <levitte@openssl.org>
Sat, 2 May 2020 11:33:24 +0000 (13:33 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 14 May 2020 10:16:35 +0000 (12:16 +0200)
commit2275ff656c6d2043b40663686ec6627613d68318
treec5c725d578dbf3b4f5b694a85c116547d4d7229c
parent967cc3f9390740f76f6ef3c91f2aeceab1902b19
DER writer: Add the possibility to abandon empty SEQUENCEs

In some cases, a SEQUENCE that contains only optional fields may end
up empty.  In some cases, this may be represented by dropping the
SEQUENCE entirely from the encoded DER.

To do this, we detect the case where WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH
is used, and adapt accordingly.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11710)
crypto/der_writer.c