boringssl/include/openssl
David Benjamin ad9eee1628 Handle CBB_cleanup on child CBBs more gracefully.
Child and root CBBs share a type, but are different kinds of things. C++
programmers sometimes mistakenly believe they should use ScopedCBB for
everything. This mostly works because we NULL cbb->child->base on flush,
making CBB_cleanup a no-op. This zeroing also skips the assert in
CBB_cleanup. (If we ran it unconditionally, CBB_zero + CBB_cleanup would
not work.)

However, if a CBB operation fails and a function returns early, the
child CBB is not cleared. ScopedCBB will then call CBB_cleanup which
trips the assert but, in release build, misbehaves.

Run the assert unconditionally and, when the assert fails, still behave
well. To make this work with CBB_zero, negate is_top_level to is_child,
so a flushed child CBB and a (presumably) root CBB in the zero state are
distinguishable.

Update-Note: Code that was using CBB wrong may trip an assert in debug builds.
Change-Id: Ifea7759e1d0331f2e727c59bbafa355d70fb9dba
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35524
Reviewed-by: Adam Langley <agl@google.com>
2019-04-10 22:12:42 +00:00
..
aead.h Flatten EVP_AEAD_CTX 2018-10-22 23:12:57 +00:00
aes.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
arm_arch.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
asn1_mac.h
asn1.h Remove d2i_ASN1_UINTEGER. 2019-03-18 17:18:26 +00:00
asn1t.h Remove ASN1_template_(i2d,d2i). 2017-09-15 22:53:43 +00:00
base64.h Document alternative functions to BIO_f_base64. 2018-09-07 15:58:12 +00:00
base.h Add an interface for QUIC integration. 2018-10-31 20:38:10 +00:00
bio.h Fix d2i_*_bio on partial reads. 2018-12-05 22:05:28 +00:00
blowfish.h Fix some size_t to long casts. 2019-01-03 21:46:45 +00:00
bn.h Add some Node compatibility functions. 2019-01-25 16:50:30 +00:00
buf.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
buffer.h
bytestring.h Handle CBB_cleanup on child CBBs more gracefully. 2019-04-10 22:12:42 +00:00
cast.h Fix some size_t to long casts. 2019-01-03 21:46:45 +00:00
chacha.h Add chacha.h to the list of documented headers. 2017-10-12 15:27:34 +00:00
cipher.h Add EVP_CIPHER support for Blowfish and CAST to decrepit. 2019-01-03 21:34:46 +00:00
cmac.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
conf.h Undo recent changes to |X509V3_EXT_conf_nid|. 2018-10-17 21:05:45 +00:00
cpu.h Add test of assembly code dispatch. 2019-01-22 20:22:53 +00:00
crypto.h Add a pile of compatibility functions. 2018-08-13 23:13:26 +00:00
curve25519.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
des.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
dh.h Add missing bssl::UpRef overloads. 2018-09-14 16:45:54 +00:00
digest.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
dsa.h Add missing bssl::UpRef overloads. 2018-09-14 16:45:54 +00:00
dtls1.h
e_os2.h Add a stub e_os2.h header. 2018-05-08 01:32:14 +00:00
ec_key.h Add EC_KEY_key2buf for OpenSSL compatibility 2019-01-03 16:32:21 +00:00
ec.h Add a very roundabout EC keygen API. 2019-01-25 23:08:12 +00:00
ecdh.h Add ECDH_compute_key_fips inside the module. 2018-07-30 22:40:31 +00:00
ecdsa.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
engine.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
err.h Add some more compatibility functions. 2018-05-08 20:51:15 +00:00
evp.h Add a very roundabout EC keygen API. 2019-01-25 23:08:12 +00:00
ex_data.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
hkdf.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
hmac.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
hrss.h HRSS: flatten sample distribution. 2019-01-22 22:06:43 +00:00
is_boringssl.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
lhash.h Clear out a bunch of -Wextra-semi warnings. 2019-02-21 19:12:39 +00:00
md4.h Rename 'md' output parameter to 'out' and add bounds. 2019-04-08 18:19:01 +00:00
md5.h Rename 'md' output parameter to 'out' and add bounds. 2019-04-08 18:19:01 +00:00
mem.h silence unused variable warnings when using OPENSSL_clear_free 2019-03-04 19:55:29 +00:00
nid.h Add initial HRSS support. 2018-12-12 17:35:02 +00:00
obj_mac.h
obj.h Add some more compatibility functions. 2018-05-08 20:51:15 +00:00
objects.h
opensslconf.h Switch OPENSSL_VERSION_NUMBER to 1.1.0. 2017-09-29 04:51:27 +00:00
opensslv.h
ossl_typ.h
pem.h Fix undefined function pointer casts in IMPLEMENT_PEM_*. 2018-10-01 17:34:44 +00:00
pkcs7.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
pkcs8.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
pkcs12.h
poly1305.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
pool.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
rand.h Remove pooling of PRNG state. 2019-01-03 20:19:44 +00:00
rc4.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
ripemd.h Rename 'md' output parameter to 'out' and add bounds. 2019-04-08 18:19:01 +00:00
rsa.h Mark the |e| argument to |RSA_generate_key_ex| as const. 2018-11-14 15:57:25 +00:00
safestack.h
sha.h Rename 'md' output parameter to 'out' and add bounds. 2019-04-08 18:19:01 +00:00
span.h Remove stray semicolons. 2019-02-07 17:36:54 +00:00
srtp.h
ssl3.h Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
ssl.h Support get versions with get_{min,max}_proto_version for context 2019-03-27 12:46:26 +00:00
stack.h Clear out a bunch of -Wextra-semi warnings. 2019-02-21 19:12:39 +00:00
thread.h Rename OPENSSL_NO_THREADS, part 1. 2018-09-26 19:10:02 +00:00
tls1.h Implement server support for delegated credentials. 2019-01-24 20:06:58 +00:00
type_check.h Modernize OPENSSL_COMPILE_ASSERT, part 2. 2018-11-14 16:06:37 +00:00
x509_vfy.h Don't accept “SSL client” as a substitute for S/MIME in the Netscape cert type extension. 2018-08-06 21:52:28 +00:00
x509.h Push an error on sigalg mismatch in X509_verify. 2018-09-19 03:44:50 +00:00
x509v3.h Unexport and rename hex_to_string, string_to_hex, and name_cmp. 2018-11-27 00:08:39 +00:00