Add CBB_add_u32.
It was missing. Writing NewSessionTicket will need it. Change-Id: I39de237894f2e8356bd6861da2b8a4d805dcd2d6 Reviewed-on: https://boringssl-review.googlesource.com/8439 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
a8288dcb78
commit
bb076e334c
@ -269,7 +269,7 @@ static bool TestGetOptionalASN1Bool() {
|
||||
}
|
||||
|
||||
static bool TestCBBBasic() {
|
||||
static const uint8_t kExpected[] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
static const uint8_t kExpected[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc};
|
||||
uint8_t *buf;
|
||||
size_t buf_len;
|
||||
CBB cbb;
|
||||
@ -285,7 +285,8 @@ static bool TestCBBBasic() {
|
||||
if (!CBB_add_u8(&cbb, 1) ||
|
||||
!CBB_add_u16(&cbb, 0x203) ||
|
||||
!CBB_add_u24(&cbb, 0x40506) ||
|
||||
!CBB_add_bytes(&cbb, (const uint8_t*) "\x07\x08", 2) ||
|
||||
!CBB_add_u32(&cbb, 0x708090a) ||
|
||||
!CBB_add_bytes(&cbb, (const uint8_t*) "\x0b\x0c", 2) ||
|
||||
!CBB_finish(&cbb, &buf, &buf_len)) {
|
||||
CBB_cleanup(&cbb);
|
||||
return false;
|
||||
|
@ -397,6 +397,14 @@ int CBB_add_u24(CBB *cbb, uint32_t value) {
|
||||
return cbb_buffer_add_u(cbb->base, value, 3);
|
||||
}
|
||||
|
||||
int CBB_add_u32(CBB *cbb, uint32_t value) {
|
||||
if (!CBB_flush(cbb)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cbb_buffer_add_u(cbb->base, value, 4);
|
||||
}
|
||||
|
||||
void CBB_discard_child(CBB *cbb) {
|
||||
if (cbb->child == NULL) {
|
||||
return;
|
||||
|
@ -377,6 +377,10 @@ OPENSSL_EXPORT int CBB_add_u16(CBB *cbb, uint16_t value);
|
||||
* returns one on success and zero otherwise. */
|
||||
OPENSSL_EXPORT int CBB_add_u24(CBB *cbb, uint32_t value);
|
||||
|
||||
/* CBB_add_u32 appends a 32-bit, big-endian number from |value| to |cbb|. It
|
||||
* returns one on success and zero otherwise. */
|
||||
OPENSSL_EXPORT int CBB_add_u32(CBB *cbb, uint32_t value);
|
||||
|
||||
/* CBB_discard_child discards the current unflushed child of |cbb|. Neither the
|
||||
* child's contents nor the length prefix will be included in the output. */
|
||||
OPENSSL_EXPORT void CBB_discard_child(CBB *cbb);
|
||||
|
Loading…
Reference in New Issue
Block a user