Lines Matching defs:item

12 check_key_type(cbor_item_t *item)
14 if (item->type == CBOR_TYPE_UINT || item->type == CBOR_TYPE_NEGINT ||
15 item->type == CBOR_TYPE_STRING)
18 fido_log_debug("%s: invalid type: %d", __func__, item->type);
62 cbor_map_iter(const cbor_item_t *item, void *arg, int(*f)(const cbor_item_t *,
68 if ((v = cbor_map_handle(item)) == NULL) {
73 n = cbor_map_size(item);
96 cbor_array_iter(const cbor_item_t *item, void *arg, int(*f)(const cbor_item_t *,
102 if ((v = cbor_array_handle(item)) == NULL) {
107 n = cbor_array_size(item);
123 cbor_item_t *item = NULL;
139 if ((item = cbor_load(blob + 1, blob_len - 1, &cbor)) == NULL) {
145 if (cbor_isa_map(item) == false ||
146 cbor_map_is_definite(item) == false) {
152 if (cbor_map_iter(item, arg, parser) < 0) {
160 if (item != NULL)
161 cbor_decref(&item);
167 cbor_vector_free(cbor_item_t **item, size_t len)
170 if (item[i] != NULL)
171 cbor_decref(&item[i]);
175 cbor_bytestring_copy(const cbor_item_t *item, unsigned char **buf, size_t *len)
182 if (cbor_isa_bytestring(item) == false ||
183 cbor_bytestring_is_definite(item) == false) {
188 *len = cbor_bytestring_length(item);
194 memcpy(*buf, cbor_bytestring_handle(item), *len);
200 cbor_string_copy(const cbor_item_t *item, char **str)
209 if (cbor_isa_string(item) == false ||
210 cbor_string_is_definite(item) == false) {
215 if ((len = cbor_string_length(item)) == SIZE_MAX ||
219 memcpy(*str, cbor_string_handle(item), len);
226 cbor_add_bytestring(cbor_item_t *item, const char *key,
240 if (!cbor_map_add(item, pair)) {
256 cbor_add_string(cbor_item_t *item, const char *key, const char *value)
269 if (!cbor_map_add(item, pair)) {
285 cbor_add_bool(cbor_item_t *item, const char *key, fido_opt_t value)
298 if (!cbor_map_add(item, pair)) {
314 cbor_add_uint8(cbor_item_t *item, const char *key, uint8_t value)
327 if (!cbor_map_add(item, pair)) {
343 cbor_add_arg(cbor_item_t *item, uint8_t n, cbor_item_t *arg)
360 if (!cbor_map_add(item, pair)) {
435 cbor_item_t *item = NULL;
437 if ((item = cbor_new_definite_map(2)) == NULL)
440 if ((rp->id && cbor_add_string(item, "id", rp->id) < 0) ||
441 (rp->name && cbor_add_string(item, "name", rp->name) < 0)) {
442 cbor_decref(&item);
446 return (item);
452 cbor_item_t *item = NULL;
456 if ((item = cbor_new_definite_map(4)) == NULL)
459 if ((id->ptr && cbor_add_bytestring(item, "id", id->ptr, id->len) < 0) ||
460 (user->icon && cbor_add_string(item, "icon", user->icon) < 0) ||
461 (user->name && cbor_add_string(item, "name", user->name) < 0) ||
462 (display && cbor_add_string(item, "displayName", display) < 0)) {
463 cbor_decref(&item);
467 return (item);
473 cbor_item_t *item = NULL;
480 if ((item = cbor_new_definite_array(1)) == NULL ||
499 cbor_array_push(item, body) == false)
505 if (item != NULL) {
506 cbor_decref(&item);
507 item = NULL;
518 return (item);
602 cbor_item_t *item = NULL;
616 if (size == 0 || (item = cbor_new_definite_map(size)) == NULL)
620 if (cbor_add_bytestring(item, "credBlob", blob->ptr,
622 cbor_decref(&item);
628 cbor_add_uint8(item, "credProtect",
630 cbor_decref(&item);
635 if (cbor_add_bool(item, "hmac-secret", FIDO_OPT_TRUE) < 0) {
636 cbor_decref(&item);
641 if (cbor_encode_largeblob_key_ext(item) < 0) {
642 cbor_decref(&item);
647 if (cbor_add_bool(item, "minPinLength", FIDO_OPT_TRUE) < 0) {
648 cbor_decref(&item);
653 return (item);
659 cbor_item_t *item = NULL;
661 if ((item = cbor_new_definite_map(2)) == NULL)
663 if ((rk != FIDO_OPT_OMIT && cbor_add_bool(item, "rk", rk) < 0) ||
664 (uv != FIDO_OPT_OMIT && cbor_add_bool(item, "uv", uv) < 0)) {
665 cbor_decref(&item);
669 return (item);
675 cbor_item_t *item = NULL;
677 if ((item = cbor_new_definite_map(2)) == NULL)
679 if ((up != FIDO_OPT_OMIT && cbor_add_bool(item, "up", up) < 0) ||
680 (uv != FIDO_OPT_OMIT && cbor_add_bool(item, "uv", uv) < 0)) {
681 cbor_decref(&item);
685 return (item);
740 cbor_item_t *item = NULL;
771 if ((item = cbor_build_bytestring(dgst, outlen)) == NULL) {
779 return (item);
783 cbor_encode_hmac_secret_param(const fido_dev_t *dev, cbor_item_t *item,
796 if (item == NULL || ecdh == NULL || pk == NULL || salt->ptr == NULL) {
847 if (!cbor_map_add(item, pair)) {
872 cbor_item_t *item = NULL;
881 if (size == 0 || (item = cbor_new_definite_map(size)) == NULL)
885 if (cbor_add_bool(item, "credBlob", FIDO_OPT_TRUE) < 0) {
886 cbor_decref(&item);
891 if (cbor_encode_hmac_secret_param(dev, item, ecdh, pk,
893 cbor_decref(&item);
898 if (cbor_encode_largeblob_key_ext(item) < 0) {
899 cbor_decref(&item);
904 return (item);
908 cbor_decode_fmt(const cbor_item_t *item, char **fmt)
912 if (cbor_string_copy(item, &type) < 0) {
979 get_cose_alg(const cbor_item_t *item, int *cose_alg)
987 if (cbor_isa_map(item) == false ||
988 cbor_map_is_definite(item) == false ||
989 cbor_map_iter(item, &cose_key, find_cose_alg) < 0) {
1030 cbor_decode_pubkey(const cbor_item_t *item, int *type, void *key)
1032 if (get_cose_alg(item, type) < 0) {
1039 if (es256_pk_decode(item, key) < 0) {
1045 if (rs256_pk_decode(item, key) < 0) {
1051 if (eddsa_pk_decode(item, key) < 0) {
1068 cbor_item_t *item = NULL;
1097 if ((item = cbor_load(*buf, *len, &cbor)) == NULL) {
1102 if (cbor_decode_pubkey(item, &attcred->type, &attcred->pubkey) < 0) {
1118 if (item != NULL)
1119 cbor_decref(&item);
1184 cbor_item_t *item = NULL;
1192 if ((item = cbor_load(*buf, *len, &cbor)) == NULL) {
1197 if (cbor_isa_map(item) == false ||
1198 cbor_map_is_definite(item) == false ||
1199 cbor_map_iter(item, authdata_ext, decode_cred_extension) < 0) {
1209 if (item != NULL)
1210 cbor_decref(&item);
1254 cbor_item_t *item = NULL;
1260 if ((item = cbor_load(*buf, *len, &cbor)) == NULL) {
1265 if (cbor_isa_map(item) == false ||
1266 cbor_map_is_definite(item) == false ||
1267 cbor_map_iter(item, authdata_ext, decode_assert_extension) < 0) {
1277 if (item != NULL)
1278 cbor_decref(&item);
1284 cbor_decode_cred_authdata(const cbor_item_t *item, int cose_alg,
1292 if (cbor_isa_bytestring(item) == false ||
1293 cbor_bytestring_is_definite(item) == false) {
1299 (authdata_cbor->len = cbor_serialize_alloc(item,
1305 buf = cbor_bytestring_handle(item);
1306 len = cbor_bytestring_length(item);
1334 cbor_decode_assert_authdata(const cbor_item_t *item, fido_blob_t *authdata_cbor,
1341 if (cbor_isa_bytestring(item) == false ||
1342 cbor_bytestring_is_definite(item) == false) {
1348 (authdata_cbor->len = cbor_serialize_alloc(item,
1354 buf = cbor_bytestring_handle(item);
1355 len = cbor_bytestring_length(item);
1380 decode_x5c(const cbor_item_t *item, void *arg)
1387 return (fido_blob_decode(item, x5c));
1448 cbor_decode_attstmt(const cbor_item_t *item, fido_attstmt_t *attstmt)
1452 if (cbor_isa_map(item) == false ||
1453 cbor_map_is_definite(item) == false ||
1454 cbor_map_iter(item, attstmt, decode_attstmt_entry) < 0) {
1460 (attstmt->cbor.len = cbor_serialize_alloc(item,
1470 cbor_decode_uint64(const cbor_item_t *item, uint64_t *n)
1472 if (cbor_isa_uint(item) == false) {
1477 *n = cbor_get_int(item);
1509 cbor_decode_cred_id(const cbor_item_t *item, fido_blob_t *id)
1511 if (cbor_isa_map(item) == false ||
1512 cbor_map_is_definite(item) == false ||
1513 cbor_map_iter(item, id, decode_cred_id_entry) < 0) {
1564 cbor_decode_user(const cbor_item_t *item, fido_user_t *user)
1566 if (cbor_isa_map(item) == false ||
1567 cbor_map_is_definite(item) == false ||
1568 cbor_map_iter(item, user, decode_user_entry) < 0) {
1610 cbor_decode_rp_entity(const cbor_item_t *item, fido_rp_t *rp)
1612 if (cbor_isa_map(item) == false ||
1613 cbor_map_is_definite(item) == false ||
1614 cbor_map_iter(item, rp, decode_rp_entity_entry) < 0) {
1636 cbor_array_append(cbor_item_t **array, cbor_item_t *item)
1651 if (cbor_array_push(ret, item) == 0) {