Lines Matching refs:CBS
29 // A "CBS" (CRYPTO ByteString) represents a string of bytes in memory and
57 // CBS_init sets |cbs| to point to |data|. It does not take ownership of
59 OPENSSL_EXPORT void CBS_init(CBS *cbs, const uint8_t *data, size_t len);
61 // CBS_skip advances |cbs| by |len| bytes. It returns one on success and zero
63 OPENSSL_EXPORT int CBS_skip(CBS *cbs, size_t len);
65 // CBS_data returns a pointer to the contents of |cbs|.
66 OPENSSL_EXPORT const uint8_t *CBS_data(const CBS *cbs);
68 // CBS_len returns the number of bytes remaining in |cbs|.
69 OPENSSL_EXPORT size_t CBS_len(const CBS *cbs);
71 // CBS_stow copies the current contents of |cbs| into |*out_ptr| and
74 // success, |*out_ptr| should be freed with OPENSSL_free. If |cbs| is empty,
76 OPENSSL_EXPORT int CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len);
78 // CBS_strdup copies the current contents of |cbs| into |*out_ptr| as a
83 // NOTE: If |cbs| contains NUL bytes, the string will be truncated. Call
84 // |CBS_contains_zero_byte(cbs)| to check for NUL bytes.
85 OPENSSL_EXPORT int CBS_strdup(const CBS *cbs, char **out_ptr);
87 // CBS_contains_zero_byte returns one if the current contents of |cbs| contains
89 OPENSSL_EXPORT int CBS_contains_zero_byte(const CBS *cbs);
91 // CBS_mem_equal compares the current contents of |cbs| with the |len| bytes
94 OPENSSL_EXPORT int CBS_mem_equal(const CBS *cbs, const uint8_t *data,
97 // CBS_get_u8 sets |*out| to the next uint8_t from |cbs| and advances |cbs|. It
99 OPENSSL_EXPORT int CBS_get_u8(CBS *cbs, uint8_t *out);
101 // CBS_get_u16 sets |*out| to the next, big-endian uint16_t from |cbs| and
102 // advances |cbs|. It returns one on success and zero on error.
103 OPENSSL_EXPORT int CBS_get_u16(CBS *cbs, uint16_t *out);
105 // CBS_get_u24 sets |*out| to the next, big-endian 24-bit value from |cbs| and
106 // advances |cbs|. It returns one on success and zero on error.
107 OPENSSL_EXPORT int CBS_get_u24(CBS *cbs, uint32_t *out);
109 // CBS_get_u32 sets |*out| to the next, big-endian uint32_t value from |cbs|
110 // and advances |cbs|. It returns one on success and zero on error.
111 OPENSSL_EXPORT int CBS_get_u32(CBS *cbs, uint32_t *out);
113 // CBS_get_u64 sets |*out| to the next, big-endian uint64_t value from |cbs|
114 // and advances |cbs|. It returns one on success and zero on error.
115 OPENSSL_EXPORT int CBS_get_u64(CBS *cbs, uint64_t *out);
117 // CBS_get_last_u8 sets |*out| to the last uint8_t from |cbs| and shortens
118 // |cbs|. It returns one on success and zero on error.
119 OPENSSL_EXPORT int CBS_get_last_u8(CBS *cbs, uint8_t *out);
121 // CBS_get_bytes sets |*out| to the next |len| bytes from |cbs| and advances
122 // |cbs|. It returns one on success and zero on error.
123 OPENSSL_EXPORT int CBS_get_bytes(CBS *cbs, CBS *out, size_t len);
125 // CBS_copy_bytes copies the next |len| bytes from |cbs| to |out| and advances
126 // |cbs|. It returns one on success and zero on error.
127 OPENSSL_EXPORT int CBS_copy_bytes(CBS *cbs, uint8_t *out, size_t len);
130 // length-prefixed value from |cbs| and advances |cbs| over it. It returns one
132 OPENSSL_EXPORT int CBS_get_u8_length_prefixed(CBS *cbs, CBS *out);
135 // big-endian, length-prefixed value from |cbs| and advances |cbs| over it. It
137 OPENSSL_EXPORT int CBS_get_u16_length_prefixed(CBS *cbs, CBS *out);
140 // big-endian, length-prefixed value from |cbs| and advances |cbs| over it. It
142 OPENSSL_EXPORT int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out);
147 // |CBS| may be used to parse DER structures. Rather than using a schema
212 // including tag and length bytes) and advances |cbs| over it. The ASN.1
215 OPENSSL_EXPORT int CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value);
219 OPENSSL_EXPORT int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value);
222 // if the next ASN.1 element on |cbs| would have tag |tag_value|. If
223 // |cbs| is empty or the tag does not match, it returns zero. Note: if
226 OPENSSL_EXPORT int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value);
228 // CBS_get_any_asn1 sets |*out| to contain the next ASN.1 element from |*cbs|
230 // advances |*cbs|. It returns one on success and zero on error. Either of |out|
232 OPENSSL_EXPORT int CBS_get_any_asn1(CBS *cbs, CBS *out, unsigned *out_tag);
235 // |*cbs| (including header bytes) and advances |*cbs|. It sets |*out_tag| to
238 OPENSSL_EXPORT int CBS_get_any_asn1_element(CBS *cbs, CBS *out,
246 OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out,
250 // CBS_get_asn1_uint64 gets an ASN.1 INTEGER from |cbs| using |CBS_get_asn1|
254 OPENSSL_EXPORT int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out);
256 // CBS_get_asn1_bool gets an ASN.1 BOOLEAN from |cbs| and sets |*out| to zero
258 OPENSSL_EXPORT int CBS_get_asn1_bool(CBS *cbs, int *out);
260 // CBS_get_optional_asn1 gets an optional explicitly-tagged element from |cbs|
265 OPENSSL_EXPORT int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present,
269 // explicitly-tagged OCTET STRING from |cbs|. If present, it sets
274 OPENSSL_EXPORT int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out,
279 // INTEGER from |cbs|. If present, it sets |*out| to the
283 OPENSSL_EXPORT int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out,
288 // |cbs|. If present, it sets |*out| to either zero or one, based on the
292 OPENSSL_EXPORT int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag,
295 // CBS_is_valid_asn1_bitstring returns one if |cbs| is a valid ASN.1 BIT STRING
297 OPENSSL_EXPORT int CBS_is_valid_asn1_bitstring(const CBS *cbs);
299 // CBS_asn1_bitstring_has_bit returns one if |cbs| is a valid ASN.1 BIT STRING
302 OPENSSL_EXPORT int CBS_asn1_bitstring_has_bit(const CBS *cbs, unsigned bit);
304 // CBS_asn1_oid_to_text interprets |cbs| as DER-encoded ASN.1 OBJECT IDENTIFIER
309 OPENSSL_EXPORT char *CBS_asn1_oid_to_text(const CBS *cbs);