Lines Matching refs:item

13 check_key_type(cbor_item_t *item)  in check_key_type()  argument
15 if (item->type == CBOR_TYPE_UINT || item->type == CBOR_TYPE_NEGINT || in check_key_type()
16 item->type == CBOR_TYPE_STRING) in check_key_type()
19 fido_log_debug("%s: invalid type: %d", __func__, item->type); in check_key_type()
63 cbor_map_iter(const cbor_item_t *item, void *arg, int(*f)(const cbor_item_t *, in cbor_map_iter() argument
69 if ((v = cbor_map_handle(item)) == NULL) { in cbor_map_iter()
74 n = cbor_map_size(item); in cbor_map_iter()
97 cbor_array_iter(const cbor_item_t *item, void *arg, int(*f)(const cbor_item_t *, in cbor_array_iter() argument
103 if ((v = cbor_array_handle(item)) == NULL) { in cbor_array_iter()
108 n = cbor_array_size(item); in cbor_array_iter()
124 cbor_item_t *item = NULL; in cbor_parse_reply() local
140 if ((item = cbor_load(blob + 1, blob_len - 1, &cbor)) == NULL) { in cbor_parse_reply()
146 if (cbor_isa_map(item) == false || in cbor_parse_reply()
147 cbor_map_is_definite(item) == false) { in cbor_parse_reply()
153 if (cbor_map_iter(item, arg, parser) < 0) { in cbor_parse_reply()
161 if (item != NULL) in cbor_parse_reply()
162 cbor_decref(&item); in cbor_parse_reply()
168 cbor_vector_free(cbor_item_t **item, size_t len) in cbor_vector_free() argument
171 if (item[i] != NULL) in cbor_vector_free()
172 cbor_decref(&item[i]); in cbor_vector_free()
176 cbor_bytestring_copy(const cbor_item_t *item, unsigned char **buf, size_t *len) in cbor_bytestring_copy() argument
183 if (cbor_isa_bytestring(item) == false || in cbor_bytestring_copy()
184 cbor_bytestring_is_definite(item) == false) { in cbor_bytestring_copy()
189 *len = cbor_bytestring_length(item); in cbor_bytestring_copy()
195 memcpy(*buf, cbor_bytestring_handle(item), *len); in cbor_bytestring_copy()
201 cbor_string_copy(const cbor_item_t *item, char **str) in cbor_string_copy() argument
210 if (cbor_isa_string(item) == false || in cbor_string_copy()
211 cbor_string_is_definite(item) == false) { in cbor_string_copy()
216 if ((len = cbor_string_length(item)) == SIZE_MAX || in cbor_string_copy()
220 memcpy(*str, cbor_string_handle(item), len); in cbor_string_copy()
227 cbor_add_bytestring(cbor_item_t *item, const char *key, in cbor_add_bytestring() argument
241 if (!cbor_map_add(item, pair)) { in cbor_add_bytestring()
257 cbor_add_string(cbor_item_t *item, const char *key, const char *value) in cbor_add_string() argument
270 if (!cbor_map_add(item, pair)) { in cbor_add_string()
286 cbor_add_bool(cbor_item_t *item, const char *key, fido_opt_t value) in cbor_add_bool() argument
299 if (!cbor_map_add(item, pair)) { in cbor_add_bool()
315 cbor_add_uint8(cbor_item_t *item, const char *key, uint8_t value) in cbor_add_uint8() argument
328 if (!cbor_map_add(item, pair)) { in cbor_add_uint8()
344 cbor_add_arg(cbor_item_t *item, uint8_t n, cbor_item_t *arg) in cbor_add_arg() argument
361 if (!cbor_map_add(item, pair)) { in cbor_add_arg()
436 cbor_item_t *item = NULL; in cbor_encode_rp_entity() local
438 if ((item = cbor_new_definite_map(2)) == NULL) in cbor_encode_rp_entity()
441 if ((rp->id && cbor_add_string(item, "id", rp->id) < 0) || in cbor_encode_rp_entity()
442 (rp->name && cbor_add_string(item, "name", rp->name) < 0)) { in cbor_encode_rp_entity()
443 cbor_decref(&item); in cbor_encode_rp_entity()
447 return (item); in cbor_encode_rp_entity()
453 cbor_item_t *item = NULL; in cbor_encode_user_entity() local
457 if ((item = cbor_new_definite_map(4)) == NULL) in cbor_encode_user_entity()
460 if ((id->ptr && cbor_add_bytestring(item, "id", id->ptr, id->len) < 0) || in cbor_encode_user_entity()
461 (user->icon && cbor_add_string(item, "icon", user->icon) < 0) || in cbor_encode_user_entity()
462 (user->name && cbor_add_string(item, "name", user->name) < 0) || in cbor_encode_user_entity()
463 (display && cbor_add_string(item, "displayName", display) < 0)) { in cbor_encode_user_entity()
464 cbor_decref(&item); in cbor_encode_user_entity()
468 return (item); in cbor_encode_user_entity()
474 cbor_item_t *item = NULL; in cbor_encode_pubkey_param() local
481 if ((item = cbor_new_definite_array(1)) == NULL || in cbor_encode_pubkey_param()
500 cbor_array_push(item, body) == false) in cbor_encode_pubkey_param()
506 if (item != NULL) { in cbor_encode_pubkey_param()
507 cbor_decref(&item); in cbor_encode_pubkey_param()
508 item = NULL; in cbor_encode_pubkey_param()
519 return (item); in cbor_encode_pubkey_param()
603 cbor_item_t *item = NULL; in cbor_encode_cred_ext() local
617 if (size == 0 || (item = cbor_new_definite_map(size)) == NULL) in cbor_encode_cred_ext()
621 if (cbor_add_bytestring(item, "credBlob", blob->ptr, in cbor_encode_cred_ext()
623 cbor_decref(&item); in cbor_encode_cred_ext()
629 cbor_add_uint8(item, "credProtect", in cbor_encode_cred_ext()
631 cbor_decref(&item); in cbor_encode_cred_ext()
636 if (cbor_add_bool(item, "hmac-secret", FIDO_OPT_TRUE) < 0) { in cbor_encode_cred_ext()
637 cbor_decref(&item); in cbor_encode_cred_ext()
642 if (cbor_encode_largeblob_key_ext(item) < 0) { in cbor_encode_cred_ext()
643 cbor_decref(&item); in cbor_encode_cred_ext()
648 if (cbor_add_bool(item, "minPinLength", FIDO_OPT_TRUE) < 0) { in cbor_encode_cred_ext()
649 cbor_decref(&item); in cbor_encode_cred_ext()
654 return (item); in cbor_encode_cred_ext()
660 cbor_item_t *item = NULL; in cbor_encode_cred_opt() local
662 if ((item = cbor_new_definite_map(2)) == NULL) in cbor_encode_cred_opt()
664 if ((rk != FIDO_OPT_OMIT && cbor_add_bool(item, "rk", rk) < 0) || in cbor_encode_cred_opt()
665 (uv != FIDO_OPT_OMIT && cbor_add_bool(item, "uv", uv) < 0)) { in cbor_encode_cred_opt()
666 cbor_decref(&item); in cbor_encode_cred_opt()
670 return (item); in cbor_encode_cred_opt()
676 cbor_item_t *item = NULL; in cbor_encode_assert_opt() local
678 if ((item = cbor_new_definite_map(2)) == NULL) in cbor_encode_assert_opt()
680 if ((up != FIDO_OPT_OMIT && cbor_add_bool(item, "up", up) < 0) || in cbor_encode_assert_opt()
681 (uv != FIDO_OPT_OMIT && cbor_add_bool(item, "uv", uv) < 0)) { in cbor_encode_assert_opt()
682 cbor_decref(&item); in cbor_encode_assert_opt()
686 return (item); in cbor_encode_assert_opt()
741 cbor_item_t *item = NULL; in cbor_encode_change_pin_auth() local
772 if ((item = cbor_build_bytestring(dgst, outlen)) == NULL) { in cbor_encode_change_pin_auth()
780 return (item); in cbor_encode_change_pin_auth()
784 cbor_encode_hmac_secret_param(const fido_dev_t *dev, cbor_item_t *item, in cbor_encode_hmac_secret_param() argument
797 if (item == NULL || ecdh == NULL || pk == NULL || salt->ptr == NULL) { in cbor_encode_hmac_secret_param()
848 if (!cbor_map_add(item, pair)) { in cbor_encode_hmac_secret_param()
873 cbor_item_t *item = NULL; in cbor_encode_assert_ext() local
882 if (size == 0 || (item = cbor_new_definite_map(size)) == NULL) in cbor_encode_assert_ext()
886 if (cbor_add_bool(item, "credBlob", FIDO_OPT_TRUE) < 0) { in cbor_encode_assert_ext()
887 cbor_decref(&item); in cbor_encode_assert_ext()
892 if (cbor_encode_hmac_secret_param(dev, item, ecdh, pk, in cbor_encode_assert_ext()
894 cbor_decref(&item); in cbor_encode_assert_ext()
899 if (cbor_encode_largeblob_key_ext(item) < 0) { in cbor_encode_assert_ext()
900 cbor_decref(&item); in cbor_encode_assert_ext()
905 return (item); in cbor_encode_assert_ext()
909 cbor_decode_fmt(const cbor_item_t *item, char **fmt) in cbor_decode_fmt() argument
913 if (cbor_string_copy(item, &type) < 0) { in cbor_decode_fmt()
980 get_cose_alg(const cbor_item_t *item, int *cose_alg) in get_cose_alg() argument
988 if (cbor_isa_map(item) == false || in get_cose_alg()
989 cbor_map_is_definite(item) == false || in get_cose_alg()
990 cbor_map_iter(item, &cose_key, find_cose_alg) < 0) { in get_cose_alg()
1035 cbor_decode_pubkey(const cbor_item_t *item, int *type, void *key) in cbor_decode_pubkey() argument
1037 if (get_cose_alg(item, type) < 0) { in cbor_decode_pubkey()
1044 if (es256_pk_decode(item, key) < 0) { in cbor_decode_pubkey()
1050 if (es384_pk_decode(item, key) < 0) { in cbor_decode_pubkey()
1056 if (rs256_pk_decode(item, key) < 0) { in cbor_decode_pubkey()
1062 if (eddsa_pk_decode(item, key) < 0) { in cbor_decode_pubkey()
1079 cbor_item_t *item = NULL; in decode_attcred() local
1108 if ((item = cbor_load(*buf, *len, &cbor)) == NULL) { in decode_attcred()
1113 if (cbor_decode_pubkey(item, &attcred->type, &attcred->pubkey) < 0) { in decode_attcred()
1129 if (item != NULL) in decode_attcred()
1130 cbor_decref(&item); in decode_attcred()
1191 cbor_item_t *item = NULL; in decode_cred_extensions() local
1199 if ((item = cbor_load(*buf, *len, &cbor)) == NULL) { in decode_cred_extensions()
1204 if (cbor_isa_map(item) == false || in decode_cred_extensions()
1205 cbor_map_is_definite(item) == false || in decode_cred_extensions()
1206 cbor_map_iter(item, authdata_ext, decode_cred_extension) < 0) { in decode_cred_extensions()
1216 if (item != NULL) in decode_cred_extensions()
1217 cbor_decref(&item); in decode_cred_extensions()
1261 cbor_item_t *item = NULL; in decode_assert_extensions() local
1267 if ((item = cbor_load(*buf, *len, &cbor)) == NULL) { in decode_assert_extensions()
1272 if (cbor_isa_map(item) == false || in decode_assert_extensions()
1273 cbor_map_is_definite(item) == false || in decode_assert_extensions()
1274 cbor_map_iter(item, authdata_ext, decode_assert_extension) < 0) { in decode_assert_extensions()
1284 if (item != NULL) in decode_assert_extensions()
1285 cbor_decref(&item); in decode_assert_extensions()
1291 cbor_decode_cred_authdata(const cbor_item_t *item, int cose_alg, in cbor_decode_cred_authdata() argument
1299 if (cbor_isa_bytestring(item) == false || in cbor_decode_cred_authdata()
1300 cbor_bytestring_is_definite(item) == false) { in cbor_decode_cred_authdata()
1306 (authdata_cbor->len = cbor_serialize_alloc(item, in cbor_decode_cred_authdata()
1312 buf = cbor_bytestring_handle(item); in cbor_decode_cred_authdata()
1313 len = cbor_bytestring_length(item); in cbor_decode_cred_authdata()
1341 cbor_decode_assert_authdata(const cbor_item_t *item, fido_blob_t *authdata_cbor, in cbor_decode_assert_authdata() argument
1348 if (cbor_isa_bytestring(item) == false || in cbor_decode_assert_authdata()
1349 cbor_bytestring_is_definite(item) == false) { in cbor_decode_assert_authdata()
1355 (authdata_cbor->len = cbor_serialize_alloc(item, in cbor_decode_assert_authdata()
1361 buf = cbor_bytestring_handle(item); in cbor_decode_assert_authdata()
1362 len = cbor_bytestring_length(item); in cbor_decode_assert_authdata()
1387 decode_x5c(const cbor_item_t *item, void *arg) in decode_x5c() argument
1394 return (fido_blob_decode(item, x5c)); in decode_x5c()
1456 cbor_decode_attstmt(const cbor_item_t *item, fido_attstmt_t *attstmt) in cbor_decode_attstmt() argument
1460 if (cbor_isa_map(item) == false || in cbor_decode_attstmt()
1461 cbor_map_is_definite(item) == false || in cbor_decode_attstmt()
1462 cbor_map_iter(item, attstmt, decode_attstmt_entry) < 0) { in cbor_decode_attstmt()
1468 (attstmt->cbor.len = cbor_serialize_alloc(item, in cbor_decode_attstmt()
1478 cbor_decode_uint64(const cbor_item_t *item, uint64_t *n) in cbor_decode_uint64() argument
1480 if (cbor_isa_uint(item) == false) { in cbor_decode_uint64()
1485 *n = cbor_get_int(item); in cbor_decode_uint64()
1517 cbor_decode_cred_id(const cbor_item_t *item, fido_blob_t *id) in cbor_decode_cred_id() argument
1519 if (cbor_isa_map(item) == false || in cbor_decode_cred_id()
1520 cbor_map_is_definite(item) == false || in cbor_decode_cred_id()
1521 cbor_map_iter(item, id, decode_cred_id_entry) < 0) { in cbor_decode_cred_id()
1572 cbor_decode_user(const cbor_item_t *item, fido_user_t *user) in cbor_decode_user() argument
1574 if (cbor_isa_map(item) == false || in cbor_decode_user()
1575 cbor_map_is_definite(item) == false || in cbor_decode_user()
1576 cbor_map_iter(item, user, decode_user_entry) < 0) { in cbor_decode_user()
1618 cbor_decode_rp_entity(const cbor_item_t *item, fido_rp_t *rp) in cbor_decode_rp_entity() argument
1620 if (cbor_isa_map(item) == false || in cbor_decode_rp_entity()
1621 cbor_map_is_definite(item) == false || in cbor_decode_rp_entity()
1622 cbor_map_iter(item, rp, decode_rp_entity_entry) < 0) { in cbor_decode_rp_entity()
1631 cbor_decode_bool(const cbor_item_t *item, bool *v) in cbor_decode_bool() argument
1633 if (cbor_isa_float_ctrl(item) == false || in cbor_decode_bool()
1634 cbor_float_get_width(item) != CBOR_FLOAT_0 || in cbor_decode_bool()
1635 cbor_is_bool(item) == false) { in cbor_decode_bool()
1641 *v = cbor_ctrl_value(item) == CBOR_CTRL_TRUE; in cbor_decode_bool()
1660 cbor_array_append(cbor_item_t **array, cbor_item_t *item) in cbor_array_append() argument
1675 if (cbor_array_push(ret, item) == 0) { in cbor_array_append()