summaryrefslogtreecommitdiff
path: root/lib/libssl/bs_cbb.c
AgeCommit message (Collapse)Author
2017-03-10Switch CBB to use recallocarray() - this ensures that we do not leakJoel Sing
secrets via realloc(). ok inoguchi@
2015-09-01Make it always safe to call CBB_cleanup() providing that CBB_init() orJoel Sing
CBB_init_fixed() have been attempted. ok doug@
2015-06-18Extend the input types for CBB_add_*() to help catch bugs.Doug Hogan
While the previous types were correct, they can silently accept bad data via truncation or signed conversion. We now take size_t as input for CBB_add_u*() and do a range check. discussed with deraadt@ input + ok jsing@ miod@
2015-06-13Split up the logic in CBB_flush to separately handle the lengths.Doug Hogan
Also, add comments about assuming short-form. ok miod@, tweak + ok jsing@
2015-06-13Explain the ASN.1 restriction that requires extra logic for encoding.Doug Hogan
ok miod@ jsing@
2015-06-13When initial capacity is 0, always use NULL buffer.Doug Hogan
malloc(0) is implementation defined and there's no reason to introduce that ambiguity here. Added a few cosmetic changes in sizeof and free. ok miod@ jsing@
2015-04-29Call CBB_add_space() rather than reimplementing it.Doug Hogan
ok jsing@
2015-04-29Rename cbb_buffer_add_u to cbb_add_u and remove redundant code.Doug Hogan
All of cbb_buffer_add_u's callers first call CBB_flush and send cbb->base. cbb_add_u() now has that common code in one place. ok jsing@
2015-04-29Added len_len error checking for internal cbb_buffer_add_u().Doug Hogan
ok jsing@
2015-02-07Don't allow tag number 31 in CBB_add_asn1().Doug Hogan
Tag 31 is invalid for a short form identifier octet (single byte). KNF a little more. Based on BoringSSL commit 5ba305643f55d37a3e45e8388a36d50c1b2d4ff5 ok miod@
2015-02-07Only call free in CBB_init().Doug Hogan
CBB_init_fixed() should not call free because it can lead to use after free or double free bugs. The caller should be responsible for creating and destroying the buffer. From BoringSSL commit a84f06fc1eee6ea25ce040675fbad72c532afece miod agrees with the reasoning ok jsing@, beck@
2015-02-06KNF bytestring files.Doug Hogan
I checked that this doesn't change anything. Compiled with clang using -Wno-pointer-sign -g0 to reduce the differences. Only difference in the asm is due to assert(0) line number changes in bs_cbs.c and bs_cbb.c. miod is ok with the general process.
2015-02-06Remove accidental, commented out code.Doug Hogan
This was to test a patch for upstream.
2015-02-06Import BoringSSL's crypto bytestring and crypto bytebuilder APIs.Doug Hogan
This is imported with as few changes as possible for the initial commit. I removed OPENSSL_EXPORT, replaced OPENSSL_malloc() etc with malloc() and changed a few header includes. BoringSSL has this as part of their public API. We're leaving it internal to libssl for now. Based on BoringSSL's CBB/CBS API as of commit c5cc15b4f5b1d6e9b9112cb8d30205a638aa2c54. input + ok jsing@, miod@