Home
last modified time | relevance | path

Searched refs:cbb (Results 1 – 25 of 94) sorted by relevance

1234

/external/boringssl/src/crypto/bytestring/
Dcbb.c27 void CBB_zero(CBB *cbb) { in CBB_zero() argument
28 OPENSSL_memset(cbb, 0, sizeof(CBB)); in CBB_zero()
31 static int cbb_init(CBB *cbb, uint8_t *buf, size_t cap) { in cbb_init() argument
46 cbb->base = base; in cbb_init()
47 cbb->is_top_level = 1; in cbb_init()
51 int CBB_init(CBB *cbb, size_t initial_capacity) { in CBB_init() argument
52 CBB_zero(cbb); in CBB_init()
59 if (!cbb_init(cbb, buf, initial_capacity)) { in CBB_init()
67 int CBB_init_fixed(CBB *cbb, uint8_t *buf, size_t len) { in CBB_init_fixed() argument
68 CBB_zero(cbb); in CBB_init_fixed()
[all …]
Dbytestring_test.cc311 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()
[all …]
Dunicode.c120 int cbb_add_utf8(CBB *cbb, uint32_t u) { in cbb_add_utf8() argument
125 return CBB_add_u8(cbb, (uint8_t)u); in cbb_add_utf8()
128 return CBB_add_u8(cbb, TOP_BITS(2) | (u >> 6)) && in cbb_add_utf8()
129 CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6))); in cbb_add_utf8()
132 return CBB_add_u8(cbb, TOP_BITS(3) | (u >> 12)) && in cbb_add_utf8()
133 CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 6) & BOTTOM_BITS(6))) && in cbb_add_utf8()
134 CBB_add_u8(cbb, TOP_BITS(1) | (u & BOTTOM_BITS(6))); in cbb_add_utf8()
137 return CBB_add_u8(cbb, TOP_BITS(4) | (u >> 18)) && in cbb_add_utf8()
138 CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 12) & BOTTOM_BITS(6))) && in cbb_add_utf8()
139 CBB_add_u8(cbb, TOP_BITS(1) | ((u >> 6) & BOTTOM_BITS(6))) && in cbb_add_utf8()
[all …]
Dinternal.h67 int CBB_finish_i2d(CBB *cbb, uint8_t **outp);
86 OPENSSL_EXPORT int cbb_add_utf8(CBB *cbb, uint32_t u);
87 OPENSSL_EXPORT int cbb_add_latin1(CBB *cbb, uint32_t u);
88 OPENSSL_EXPORT int cbb_add_ucs2_be(CBB *cbb, uint32_t u);
89 OPENSSL_EXPORT int cbb_add_utf32_be(CBB *cbb, uint32_t u);
Dasn1_compat.c28 int CBB_finish_i2d(CBB *cbb, uint8_t **outp) { in CBB_finish_i2d() argument
29 assert(cbb->base->can_resize); in CBB_finish_i2d()
33 if (!CBB_finish(cbb, &der, &der_len)) { in CBB_finish_i2d()
34 CBB_cleanup(cbb); in CBB_finish_i2d()
Dcbs.c588 CBB cbb; in CBS_asn1_oid_to_text() local
589 if (!CBB_init(&cbb, 32)) { in CBS_asn1_oid_to_text()
601 if (!CBB_add_bytes(&cbb, (const uint8_t *)"2.", 2) || in CBS_asn1_oid_to_text()
602 !add_decimal(&cbb, v - 80)) { in CBS_asn1_oid_to_text()
605 } else if (!add_decimal(&cbb, v / 40) || in CBS_asn1_oid_to_text()
606 !CBB_add_u8(&cbb, '.') || in CBS_asn1_oid_to_text()
607 !add_decimal(&cbb, v % 40)) { in CBS_asn1_oid_to_text()
613 !CBB_add_u8(&cbb, '.') || in CBS_asn1_oid_to_text()
614 !add_decimal(&cbb, v)) { in CBS_asn1_oid_to_text()
621 if (!CBB_add_u8(&cbb, '\0') || in CBS_asn1_oid_to_text()
[all …]
/external/boringssl/src/crypto/dsa/
Ddsa_asn1.c76 static int marshal_integer(CBB *cbb, BIGNUM *bn) { in marshal_integer() argument
82 return BN_marshal_asn1(cbb, bn); in marshal_integer()
102 int DSA_SIG_marshal(CBB *cbb, const DSA_SIG *sig) { in DSA_SIG_marshal() argument
104 if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) || in DSA_SIG_marshal()
107 !CBB_flush(cbb)) { in DSA_SIG_marshal()
133 int DSA_marshal_public_key(CBB *cbb, const DSA *dsa) { in DSA_marshal_public_key() argument
135 if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) || in DSA_marshal_public_key()
140 !CBB_flush(cbb)) { in DSA_marshal_public_key()
165 int DSA_marshal_parameters(CBB *cbb, const DSA *dsa) { in DSA_marshal_parameters() argument
167 if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) || in DSA_marshal_parameters()
[all …]
/external/boringssl/src/crypto/rsa_extra/
Drsa_asn1.c81 static int marshal_integer(CBB *cbb, BIGNUM *bn) { in marshal_integer() argument
87 return BN_marshal_asn1(cbb, bn); in marshal_integer()
127 int RSA_marshal_public_key(CBB *cbb, const RSA *rsa) { in RSA_marshal_public_key() argument
129 if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) || in RSA_marshal_public_key()
132 !CBB_flush(cbb)) { in RSA_marshal_public_key()
141 CBB cbb; in RSA_public_key_to_bytes() local
142 CBB_zero(&cbb); in RSA_public_key_to_bytes()
143 if (!CBB_init(&cbb, 0) || in RSA_public_key_to_bytes()
144 !RSA_marshal_public_key(&cbb, rsa) || in RSA_public_key_to_bytes()
145 !CBB_finish(&cbb, out_bytes, out_len)) { in RSA_public_key_to_bytes()
[all …]
/external/boringssl/src/include/openssl/
Dbytestring.h357 OPENSSL_EXPORT void CBB_zero(CBB *cbb);
362 OPENSSL_EXPORT int CBB_init(CBB *cbb, size_t initial_capacity);
367 OPENSSL_EXPORT int CBB_init_fixed(CBB *cbb, uint8_t *buf, size_t len);
376 OPENSSL_EXPORT void CBB_cleanup(CBB *cbb);
386 OPENSSL_EXPORT int CBB_finish(CBB *cbb, uint8_t **out_data, size_t *out_len);
393 OPENSSL_EXPORT int CBB_flush(CBB *cbb);
400 OPENSSL_EXPORT const uint8_t *CBB_data(const CBB *cbb);
407 OPENSSL_EXPORT size_t CBB_len(const CBB *cbb);
412 OPENSSL_EXPORT int CBB_add_u8_length_prefixed(CBB *cbb, CBB *out_contents);
417 OPENSSL_EXPORT int CBB_add_u16_length_prefixed(CBB *cbb, CBB *out_contents);
[all …]
/external/boringssl/src/crypto/ecdsa_extra/
Decdsa_asn1.c83 CBB cbb; in ECDSA_sign() local
84 CBB_zero(&cbb); in ECDSA_sign()
86 if (!CBB_init_fixed(&cbb, sig, ECDSA_size(eckey)) || in ECDSA_sign()
87 !ECDSA_SIG_marshal(&cbb, s) || in ECDSA_sign()
88 !CBB_finish(&cbb, NULL, &len)) { in ECDSA_sign()
90 CBB_cleanup(&cbb); in ECDSA_sign()
181 int ECDSA_SIG_marshal(CBB *cbb, const ECDSA_SIG *sig) { in ECDSA_SIG_marshal() argument
183 if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) || in ECDSA_SIG_marshal()
186 !CBB_flush(cbb)) { in ECDSA_SIG_marshal()
195 CBB cbb; in ECDSA_SIG_to_bytes() local
[all …]
/external/boringssl/src/crypto/dh/
Ddh_asn1.c77 static int marshal_integer(CBB *cbb, BIGNUM *bn) { in marshal_integer() argument
83 return BN_marshal_asn1(cbb, bn); in marshal_integer()
120 int DH_marshal_parameters(CBB *cbb, const DH *dh) { in DH_marshal_parameters() argument
122 if (!CBB_add_asn1(cbb, &child, CBS_ASN1_SEQUENCE) || in DH_marshal_parameters()
127 !CBB_flush(cbb)) { in DH_marshal_parameters()
153 CBB cbb; in i2d_DHparams() local
154 if (!CBB_init(&cbb, 0) || in i2d_DHparams()
155 !DH_marshal_parameters(&cbb, in)) { in i2d_DHparams()
156 CBB_cleanup(&cbb); in i2d_DHparams()
159 return CBB_finish_i2d(&cbb, outp); in i2d_DHparams()
Ddh_test.cc351 bssl::ScopedCBB cbb; in TestASN1() local
354 if (!CBB_init(cbb.get(), 0) || in TestASN1()
355 !DH_marshal_parameters(cbb.get(), dh.get()) || in TestASN1()
356 !CBB_finish(cbb.get(), &der, &der_len)) { in TestASN1()
397 if (!CBB_init(cbb.get(), 0) || in TestASN1()
398 !DH_marshal_parameters(cbb.get(), dh.get()) || in TestASN1()
399 !CBB_finish(cbb.get(), &der, &der_len)) { in TestASN1()
/external/boringssl/src/ssl/
Dd1_both.cc154 ScopedCBB cbb; in dtls1_hm_fragment_new() local
171 if (!CBB_init_fixed(cbb.get(), frag->data, DTLS1_HM_HEADER_LENGTH) || in dtls1_hm_fragment_new()
172 !CBB_add_u8(cbb.get(), msg_hdr->type) || in dtls1_hm_fragment_new()
173 !CBB_add_u24(cbb.get(), msg_hdr->msg_len) || in dtls1_hm_fragment_new()
174 !CBB_add_u16(cbb.get(), msg_hdr->seq) || in dtls1_hm_fragment_new()
175 !CBB_add_u24(cbb.get(), 0 /* frag_off */) || in dtls1_hm_fragment_new()
176 !CBB_add_u24(cbb.get(), msg_hdr->msg_len) || in dtls1_hm_fragment_new()
177 !CBB_finish(cbb.get(), NULL, NULL)) { in dtls1_hm_fragment_new()
511 bool dtls1_init_message(SSL *ssl, CBB *cbb, CBB *body, uint8_t type) { in dtls1_init_message() argument
513 if (!CBB_init(cbb, 64) || in dtls1_init_message()
[all …]
Dtls13_both.cc59 ScopedCBB cbb; in tls13_get_cert_verify_signature_input() local
60 if (!CBB_init(cbb.get(), 64 + 33 + 1 + 2 * EVP_MAX_MD_SIZE)) { in tls13_get_cert_verify_signature_input()
66 if (!CBB_add_u8(cbb.get(), 0x20)) { in tls13_get_cert_verify_signature_input()
88 if (!CBB_add_bytes(cbb.get(), in tls13_get_cert_verify_signature_input()
98 !CBB_add_bytes(cbb.get(), context_hash, context_hash_len) || in tls13_get_cert_verify_signature_input()
99 !CBBFinishArray(cbb.get(), out)) { in tls13_get_cert_verify_signature_input()
424 ScopedCBB cbb; in tls13_add_certificate() local
428 if (!CBB_init(cbb.get(), 1024)) { in tls13_add_certificate()
431 body = cbb.get(); in tls13_add_certificate()
434 if (!ssl->method->init_message(ssl, cbb.get(), body, SSL3_MT_CERTIFICATE)) { in tls13_add_certificate()
[all …]
Dssl_asn1.cc193 static int SSL_SESSION_to_bytes_full(const SSL_SESSION *in, CBB *cbb, in SSL_SESSION_to_bytes_full() argument
200 if (!CBB_add_asn1(cbb, &session, CBS_ASN1_SEQUENCE) || in SSL_SESSION_to_bytes_full()
392 return CBB_flush(cbb); in SSL_SESSION_to_bytes_full()
743 int ssl_session_serialize(const SSL_SESSION *in, CBB *cbb) { in ssl_session_serialize() argument
744 return SSL_SESSION_to_bytes_full(in, cbb, 0); in ssl_session_serialize()
769 ScopedCBB cbb; in SSL_SESSION_to_bytes() local
770 if (!CBB_init(cbb.get(), 256) || in SSL_SESSION_to_bytes()
771 !SSL_SESSION_to_bytes_full(in, cbb.get(), 0) || in SSL_SESSION_to_bytes()
772 !CBB_finish(cbb.get(), out_data, out_len)) { in SSL_SESSION_to_bytes()
781 ScopedCBB cbb; in SSL_SESSION_to_bytes_for_ticket() local
[all …]
/external/nos/host/android/hals/keymaster/
Dexport_key.cpp69 CBB cbb; in export_key_der() local
71 CBB_init_fixed(&cbb, data, 1024); in export_key_der()
74 if (!EVP_marshal_public_key(&cbb, pkey.get())) { in export_key_der()
81 data), CBB_len(&cbb), true /* Transfer ownership. */); in export_key_der()
82 CBB_cleanup(&cbb); in export_key_der()
158 CBB cbb; in export_key_der() local
160 CBB_init_fixed(&cbb, data, 256); in export_key_der()
161 if (!EVP_marshal_public_key(&cbb, pkey.get())) { in export_key_der()
168 data), CBB_len(&cbb), true /* Transfer ownership. */); in export_key_der()
169 CBB_cleanup(&cbb); in export_key_der()
/external/boringssl/src/crypto/pkcs7/
Dpkcs7_test.cc485 bssl::ScopedCBB cbb; in TestCertRepase() local
486 ASSERT_TRUE(CBB_init(cbb.get(), der_len)); in TestCertRepase()
487 ASSERT_TRUE(PKCS7_bundle_certificates(cbb.get(), certs.get())); in TestCertRepase()
488 ASSERT_TRUE(CBB_finish(cbb.get(), &result_data, &result_len)); in TestCertRepase()
502 ASSERT_TRUE(CBB_init(cbb.get(), der_len)); in TestCertRepase()
503 ASSERT_TRUE(PKCS7_bundle_certificates(cbb.get(), certs2.get())); in TestCertRepase()
504 ASSERT_TRUE(CBB_finish(cbb.get(), &result2_data, &result2_len)); in TestCertRepase()
567 bssl::ScopedCBB cbb; in TestCRLReparse() local
568 ASSERT_TRUE(CBB_init(cbb.get(), der_len)); in TestCRLReparse()
569 ASSERT_TRUE(PKCS7_bundle_CRLs(cbb.get(), crls.get())); in TestCRLReparse()
[all …]
/external/libchrome/crypto/
Drsa_private_key.cc87 bssl::ScopedCBB cbb; in ExportPrivateKey() local
88 if (!CBB_init(cbb.get(), 0) || in ExportPrivateKey()
89 !EVP_marshal_private_key(cbb.get(), key_.get()) || in ExportPrivateKey()
90 !CBB_finish(cbb.get(), &der, &der_len)) { in ExportPrivateKey()
102 bssl::ScopedCBB cbb; in ExportPublicKey() local
103 if (!CBB_init(cbb.get(), 0) || in ExportPublicKey()
104 !EVP_marshal_public_key(cbb.get(), key_.get()) || in ExportPublicKey()
105 !CBB_finish(cbb.get(), &der, &der_len)) { in ExportPublicKey()
/external/boringssl/src/crypto/ec_extra/
Dec_asn1.c192 int EC_KEY_marshal_private_key(CBB *cbb, const EC_KEY *key, in EC_KEY_marshal_private_key() argument
200 if (!CBB_add_asn1(cbb, &ec_private_key, CBS_ASN1_SEQUENCE) || in EC_KEY_marshal_private_key()
236 if (!CBB_flush(cbb)) { in EC_KEY_marshal_private_key()
349 int EC_KEY_marshal_curve_name(CBB *cbb, const EC_GROUP *group) { in EC_KEY_marshal_curve_name() argument
361 return CBB_add_asn1(cbb, &child, CBS_ASN1_OBJECT) && in EC_KEY_marshal_curve_name()
363 CBB_flush(cbb); in EC_KEY_marshal_curve_name()
448 CBB cbb; in i2d_ECPrivateKey() local
449 if (!CBB_init(&cbb, 0) || in i2d_ECPrivateKey()
450 !EC_KEY_marshal_private_key(&cbb, key, EC_KEY_get_enc_flags(key))) { in i2d_ECPrivateKey()
451 CBB_cleanup(&cbb); in i2d_ECPrivateKey()
[all …]
/external/boringssl/src/crypto/evp/
Devp_extra_test.cc499 bssl::ScopedCBB cbb; in TEST() local
500 EXPECT_FALSE(EVP_marshal_public_key(cbb.get(), empty.get())) in TEST()
580 bssl::ScopedCBB cbb; in TEST() local
583 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
584 ASSERT_TRUE(EVP_marshal_public_key(cbb.get(), pubkey.get())); in TEST()
585 ASSERT_TRUE(CBB_finish(cbb.get(), &der, &der_len)); in TEST()
590 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
591 EXPECT_FALSE(EVP_marshal_private_key(cbb.get(), pubkey.get())); in TEST()
595 cbb.Reset(); in TEST()
603 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
[all …]
/external/boringssl/src/crypto/pkcs8/
Dpkcs8_x509.c139 CBB cbb; in EVP_PKEY2PKCS8() local
142 if (!CBB_init(&cbb, 0) || in EVP_PKEY2PKCS8()
143 !EVP_marshal_private_key(&cbb, pkey) || in EVP_PKEY2PKCS8()
144 !CBB_finish(&cbb, &der, &der_len) || in EVP_PKEY2PKCS8()
146 CBB_cleanup(&cbb); in EVP_PKEY2PKCS8()
220 CBB cbb; in PKCS8_encrypt() local
221 if (!CBB_init(&cbb, 128) || in PKCS8_encrypt()
222 !PKCS8_marshal_encrypted_private_key(&cbb, pbe_nid, cipher, pass, in PKCS8_encrypt()
225 !CBB_finish(&cbb, &der, &der_len)) { in PKCS8_encrypt()
226 CBB_cleanup(&cbb); in PKCS8_encrypt()
[all …]
/external/boringssl/src/ssl/test/
Dtest_state.cc85 bool SerializeContextState(SSL_CTX *ctx, CBB *cbb) { in SerializeContextState() argument
88 if (!CBB_add_u24_length_prefixed(cbb, &out) || in SerializeContextState()
103 return CBB_flush(cbb); in SerializeContextState()
130 bool TestState::Serialize(CBB *cbb) const { in Serialize()
132 if (!CBB_add_u24_length_prefixed(cbb, &out) || in Serialize()
141 !CBB_flush(cbb)) { in Serialize()
/external/boringssl/src/crypto/asn1/
Da_mbstr.c248 CBB cbb; in OPENSSL_DECLARE_ERROR_REASON() local
249 if (!CBB_init(&cbb, size_estimate + 1)) { in OPENSSL_DECLARE_ERROR_REASON()
257 !encode_func(&cbb, c)) { in OPENSSL_DECLARE_ERROR_REASON()
266 !CBB_add_u8(&cbb, 0) || in OPENSSL_DECLARE_ERROR_REASON()
267 !CBB_finish(&cbb, &data, &data_len) || in OPENSSL_DECLARE_ERROR_REASON()
281 CBB_cleanup(&cbb); in OPENSSL_DECLARE_ERROR_REASON()
/external/boringssl/src/crypto/bn_extra/
Dconvert.c250 CBB cbb; in BN_bn2dec() local
251 if (!CBB_init(&cbb, 16) || in BN_bn2dec()
252 !CBB_add_u8(&cbb, 0 /* trailing NUL */)) { in BN_bn2dec()
257 if (!CBB_add_u8(&cbb, '0')) { in BN_bn2dec()
274 if (!CBB_add_u8(&cbb, '0' + word % 10)) { in BN_bn2dec()
284 !CBB_add_u8(&cbb, '-')) { in BN_bn2dec()
290 if (!CBB_finish(&cbb, &data, &len)) { in BN_bn2dec()
308 CBB_cleanup(&cbb); in BN_bn2dec()
/external/boringssl/src/crypto/digest_extra/
Ddigest_test.cc237 bssl::ScopedCBB cbb; in TEST() local
238 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
239 EXPECT_FALSE(EVP_marshal_digest_algorithm(cbb.get(), EVP_md5_sha1())); in TEST()
252 cbb.Reset(); in TEST()
253 ASSERT_TRUE(CBB_init(cbb.get(), 0)); in TEST()
254 ASSERT_TRUE(EVP_marshal_digest_algorithm(cbb.get(), EVP_sha256())); in TEST()
257 ASSERT_TRUE(CBB_finish(cbb.get(), &der, &der_len)); in TEST()

1234