Lines Matching refs:cbb

311   CBB cbb;  in TEST()  local
312 ASSERT_TRUE(CBB_init(&cbb, 100)); in TEST()
313 CBB_cleanup(&cbb); in TEST()
323 bssl::ScopedCBB cbb; in TEST() local
324 ASSERT_TRUE(CBB_init(cbb.get(), 100)); in TEST()
325 cbb.Reset(); in TEST()
327 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
328 ASSERT_TRUE(CBB_add_u8(cbb.get(), 1)); in TEST()
329 ASSERT_TRUE(CBB_add_u16(cbb.get(), 0x203)); in TEST()
330 ASSERT_TRUE(CBB_add_u24(cbb.get(), 0x40506)); in TEST()
331 ASSERT_TRUE(CBB_add_u32(cbb.get(), 0x708090a)); in TEST()
332 ASSERT_TRUE(CBB_add_u64(cbb.get(), 0xb0c0d0e0f101112)); in TEST()
333 ASSERT_TRUE(CBB_add_bytes(cbb.get(), (const uint8_t *)"\x13\x14", 2)); in TEST()
334 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
341 bssl::ScopedCBB cbb; in TEST() local
346 ASSERT_TRUE(CBB_init_fixed(cbb.get(), NULL, 0)); in TEST()
347 ASSERT_TRUE(CBB_finish(cbb.get(), &out_buf, &out_size)); in TEST()
351 cbb.Reset(); in TEST()
352 ASSERT_TRUE(CBB_init_fixed(cbb.get(), buf, 1)); in TEST()
353 ASSERT_TRUE(CBB_add_u8(cbb.get(), 1)); in TEST()
354 ASSERT_TRUE(CBB_finish(cbb.get(), &out_buf, &out_size)); in TEST()
359 cbb.Reset(); in TEST()
360 ASSERT_TRUE(CBB_init_fixed(cbb.get(), buf, 1)); in TEST()
361 ASSERT_TRUE(CBB_add_u8(cbb.get(), 1)); in TEST()
362 EXPECT_FALSE(CBB_add_u8(cbb.get(), 2)); in TEST()
371 bssl::ScopedCBB cbb; in TEST() local
372 ASSERT_TRUE(CBB_init(cbb.get(), 16)); in TEST()
373 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &child)); in TEST()
377 ASSERT_TRUE(CBB_finish(cbb.get(), &out_buf, &out_size)); in TEST()
388 bssl::ScopedCBB cbb; in TEST() local
390 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
391 EXPECT_EQ(0u, CBB_len(cbb.get())); in TEST()
392 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &contents)); in TEST()
393 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &contents)); in TEST()
396 ASSERT_TRUE(CBB_flush(cbb.get())); in TEST()
397 EXPECT_EQ(3u, CBB_len(cbb.get())); in TEST()
398 ASSERT_TRUE(CBB_add_u16_length_prefixed(cbb.get(), &contents)); in TEST()
400 ASSERT_TRUE(CBB_add_u24_length_prefixed(cbb.get(), &contents)); in TEST()
402 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &contents)); in TEST()
408 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
415 bssl::ScopedCBB cbb; in TEST() local
418 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
419 ASSERT_TRUE(CBB_add_u8(cbb.get(), 0xaa)); in TEST()
422 CBB_discard_child(cbb.get()); in TEST()
424 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &contents)); in TEST()
425 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &contents)); in TEST()
427 ASSERT_TRUE(CBB_add_u16_length_prefixed(cbb.get(), &contents)); in TEST()
429 ASSERT_TRUE(CBB_add_u24_length_prefixed(cbb.get(), &contents)); in TEST()
431 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &contents)); in TEST()
444 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
459 bssl::ScopedCBB cbb; in TEST() local
464 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
465 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &child)); in TEST()
467 ASSERT_TRUE(CBB_add_u8(cbb.get(), 2)); in TEST()
479 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
500 bssl::ScopedCBB cbb; in TEST() local
503 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
504 ASSERT_TRUE(CBB_add_asn1(cbb.get(), &contents, CBS_ASN1_SEQUENCE)); in TEST()
507 CBB_add_asn1(cbb.get(), &contents, in TEST()
511 CBB_add_asn1(cbb.get(), &contents, in TEST()
515 CBB_add_asn1(cbb.get(), &contents, in TEST()
519 CBB_add_asn1(cbb.get(), &contents, in TEST()
522 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
528 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
529 ASSERT_TRUE(CBB_add_asn1(cbb.get(), &contents, CBS_ASN1_SEQUENCE)); in TEST()
531 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
538 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
539 ASSERT_TRUE(CBB_add_asn1(cbb.get(), &contents, CBS_ASN1_SEQUENCE)); in TEST()
541 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
548 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
549 ASSERT_TRUE(CBB_add_asn1(cbb.get(), &contents, CBS_ASN1_SEQUENCE)); in TEST()
552 ASSERT_TRUE(CBB_finish(cbb.get(), &buf, &buf_len)); in TEST()
739 bssl::ScopedCBB cbb; in TEST() local
740 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
741 ASSERT_TRUE(CBB_add_asn1_uint64(cbb.get(), test->value)); in TEST()
742 ASSERT_TRUE(CBB_finish(cbb.get(), &out, &len)); in TEST()
758 CBB cbb; in TEST() local
759 CBB_zero(&cbb); in TEST()
761 CBB_cleanup(&cbb); in TEST()
768 bssl::ScopedCBB cbb; in TEST() local
769 ASSERT_TRUE(CBB_init_fixed(cbb.get(), buf, sizeof(buf))); in TEST()
771 EXPECT_FALSE(CBB_reserve(cbb.get(), &ptr, 11)); in TEST()
773 cbb.Reset(); in TEST()
774 ASSERT_TRUE(CBB_init_fixed(cbb.get(), buf, sizeof(buf))); in TEST()
776 ASSERT_TRUE(CBB_reserve(cbb.get(), &ptr, 10)); in TEST()
779 ASSERT_TRUE(CBB_did_write(cbb.get(), 5)); in TEST()
780 ASSERT_TRUE(CBB_finish(cbb.get(), NULL, &len)); in TEST()
788 bssl::ScopedCBB cbb; in TEST() local
791 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
792 ASSERT_TRUE(CBB_add_u8_length_prefixed(cbb.get(), &child)); in TEST()
794 ASSERT_FALSE(CBB_flush(cbb.get())); in TEST()
799 EXPECT_FALSE(CBB_add_u8(cbb.get(), 0)); in TEST()
800 EXPECT_FALSE(CBB_finish(cbb.get(), &ptr, &len)); in TEST()
803 cbb.Reset(); in TEST()
805 ASSERT_TRUE(CBB_init_fixed(cbb.get(), &buf, 1)); in TEST()
806 ASSERT_FALSE(CBB_add_bytes(cbb.get(), kZeros, sizeof(kZeros))); in TEST()
809 EXPECT_FALSE(CBB_add_u8(cbb.get(), 0)); in TEST()
810 EXPECT_FALSE(CBB_finish(cbb.get(), &ptr, &len)); in TEST()
813 cbb.Reset(); in TEST()
814 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
815 ASSERT_FALSE(CBB_add_u24(cbb.get(), 1u << 24)); in TEST()
818 EXPECT_FALSE(CBB_add_u8(cbb.get(), 0)); in TEST()
819 EXPECT_FALSE(CBB_finish(cbb.get(), &ptr, &len)); in TEST()
955 bssl::ScopedCBB cbb; in TEST() local
956 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
957 ASSERT_TRUE(CBB_add_asn1_oid_from_text(cbb.get(), t.text, strlen(t.text))); in TEST()
960 ASSERT_TRUE(CBB_finish(cbb.get(), &out, &len)); in TEST()
973 bssl::ScopedCBB cbb; in TEST() local
974 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
975 EXPECT_FALSE(CBB_add_asn1_oid_from_text(cbb.get(), t, strlen(t))); in TEST()
1022 bssl::ScopedCBB cbb; in TEST() local
1024 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
1025 ASSERT_TRUE(CBB_add_asn1(cbb.get(), &child, CBS_ASN1_SET)); in TEST()
1035 ASSERT_TRUE(CBB_flush(cbb.get())); in TEST()
1036 EXPECT_EQ(0x31, CBB_data(cbb.get())[0]); in TEST()
1048 bssl::ScopedCBB cbb; in TEST() local
1050 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
1051 ASSERT_TRUE(CBB_add_asn1(cbb.get(), &child, CBS_ASN1_SET)); in TEST()
1229 bssl::ScopedCBB cbb; in TEST() local
1230 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
1232 ASSERT_TRUE(t.encode(cbb.get(), u)); in TEST()
1234 EXPECT_EQ(Bytes(t.in), Bytes(CBB_data(cbb.get()), CBB_len(cbb.get()))); in TEST()
1251 bssl::ScopedCBB cbb; in TEST() local
1252 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
1255 EXPECT_FALSE(cbb_add_utf8(cbb.get(), v)); in TEST()
1256 EXPECT_FALSE(cbb_add_latin1(cbb.get(), v)); in TEST()
1257 EXPECT_FALSE(cbb_add_ucs2_be(cbb.get(), v)); in TEST()
1258 EXPECT_FALSE(cbb_add_utf32_be(cbb.get(), v)); in TEST()
1262 EXPECT_FALSE(cbb_add_latin1(cbb.get(), 0x100)); in TEST()
1263 EXPECT_FALSE(cbb_add_ucs2_be(cbb.get(), 0x10000)); in TEST()