Lines Matching refs:cbor
24 static inline CborMajorType get_type_(const uint8_t* cbor);
25 static inline uint8_t get_addtl_data_(const uint8_t* cbor);
26 static inline void set_type_(CborMajorType type, uint8_t* cbor);
27 static inline void set_addtl_data_(uint8_t addtl_data, uint8_t* cbor);
42 static bool blindly_decode_uint_(const uint8_t* cbor,
45 static bool blindly_decode_str_(const uint8_t* cbor,
50 bool uw_macaroon_encoding_get_item_len_(const uint8_t* cbor, in uw_macaroon_encoding_get_item_len_() argument
53 if (cbor == NULL || cbor_len == 0 || first_item_len == NULL) { in uw_macaroon_encoding_get_item_len_()
57 CborMajorType type = get_type_(cbor); in uw_macaroon_encoding_get_item_len_()
65 if (!blindly_decode_uint_(cbor, cbor_len, &unsigned_int)) { in uw_macaroon_encoding_get_item_len_()
149 bool uw_macaroon_encoding_decode_uint_(const uint8_t* cbor, in uw_macaroon_encoding_decode_uint_() argument
152 if (cbor == NULL || cbor_len == 0 || unsigned_int == NULL || in uw_macaroon_encoding_decode_uint_()
153 get_type_(cbor) != kCborMajorTypeUint) { in uw_macaroon_encoding_decode_uint_()
157 return blindly_decode_uint_(cbor, cbor_len, unsigned_int); in uw_macaroon_encoding_decode_uint_()
160 bool uw_macaroon_encoding_decode_array_len_(const uint8_t* cbor, in uw_macaroon_encoding_decode_array_len_() argument
163 if (cbor == NULL || cbor_len == 0 || array_len == NULL || in uw_macaroon_encoding_decode_array_len_()
164 get_type_(cbor) != kCborMajorTypeArray) { in uw_macaroon_encoding_decode_array_len_()
168 return blindly_decode_uint_(cbor, cbor_len, array_len); in uw_macaroon_encoding_decode_array_len_()
171 bool uw_macaroon_encoding_decode_byte_str_(const uint8_t* cbor, in uw_macaroon_encoding_decode_byte_str_() argument
175 if (cbor == NULL || cbor_len == 0 || out_str == NULL || out_str_len == NULL || in uw_macaroon_encoding_decode_byte_str_()
176 get_type_(cbor) != kCborMajorTypeByteStr) { in uw_macaroon_encoding_decode_byte_str_()
180 return blindly_decode_str_(cbor, cbor_len, out_str, out_str_len); in uw_macaroon_encoding_decode_byte_str_()
183 bool uw_macaroon_encoding_decode_text_str_(const uint8_t* cbor, in uw_macaroon_encoding_decode_text_str_() argument
187 if (cbor == NULL || cbor_len == 0 || out_str == NULL || out_str_len == NULL || in uw_macaroon_encoding_decode_text_str_()
188 get_type_(cbor) != kCborMajorTypeTextStr) { in uw_macaroon_encoding_decode_text_str_()
192 return blindly_decode_str_(cbor, cbor_len, out_str, out_str_len); in uw_macaroon_encoding_decode_text_str_()
195 static inline CborMajorType get_type_(const uint8_t* cbor) { in get_type_() argument
196 return (CborMajorType)((*cbor) & MAJOR_TYPE_MASK); in get_type_()
199 static inline uint8_t get_addtl_data_(const uint8_t* cbor) { in get_addtl_data_() argument
200 return (*cbor) & ADDITIONAL_DATA_MASK; in get_addtl_data_()
203 static inline void set_type_(CborMajorType type, uint8_t* cbor) { in set_type_() argument
204 *cbor = ((uint8_t)type) | ((*cbor) & ADDITIONAL_DATA_MASK); in set_type_()
207 static inline void set_addtl_data_(uint8_t addtl_data, uint8_t* cbor) { in set_addtl_data_() argument
208 *cbor = ((*cbor) & MAJOR_TYPE_MASK) | (addtl_data & ADDITIONAL_DATA_MASK); in set_addtl_data_()
357 static bool blindly_decode_uint_(const uint8_t* cbor, in blindly_decode_uint_() argument
360 if (cbor == NULL || cbor_len == 0 || unsigned_int == NULL) { in blindly_decode_uint_()
364 uint8_t addtl_data = get_addtl_data_(cbor); in blindly_decode_uint_()
379 return read_uint_big_endian_(cbor + 1, uint_num_bytes, unsigned_int); in blindly_decode_uint_()
382 static bool blindly_decode_str_(const uint8_t* cbor, in blindly_decode_str_() argument
386 if (cbor == NULL || cbor_len == 0 || out_str == NULL || out_str == NULL) { in blindly_decode_str_()
391 if (!blindly_decode_uint_(cbor, cbor_len, &unsigned_int)) { in blindly_decode_str_()
401 *out_str = cbor + offset; in blindly_decode_str_()