Lines Matching refs:vnsm
137 static bool handle_get_random(VirtIONSM *vnsm, struct iovec *request, in handle_get_random() argument
208 static bool handle_describe_nsm(VirtIONSM *vnsm, struct iovec *request, in handle_describe_nsm() argument
226 if (!qemu_cbor_add_string_to_map(nested_map, "digest", vnsm->digest)) { in handle_describe_nsm()
230 if (!qemu_cbor_add_uint8_to_map(nested_map, "max_pcrs", vnsm->max_pcrs)) { in handle_describe_nsm()
235 vnsm->module_id)) { in handle_describe_nsm()
240 if (vnsm->pcrs[i].locked) { in handle_describe_nsm()
250 vnsm->version_major)) { in handle_describe_nsm()
255 vnsm->version_minor)) { in handle_describe_nsm()
260 vnsm->version_patch)) { in handle_describe_nsm()
370 static bool handle_describe_pcr(VirtIONSM *vnsm, struct iovec *request, in handle_describe_pcr() argument
389 if (nsm_req.index >= vnsm->max_pcrs) { in handle_describe_pcr()
395 pcr = &(vnsm->pcrs[nsm_req.index]); in handle_describe_pcr()
550 static bool handle_extend_pcr(VirtIONSM *vnsm, struct iovec *request, in handle_extend_pcr() argument
569 if (nsm_req->index >= vnsm->max_pcrs) { in handle_extend_pcr()
576 pcr = &(vnsm->pcrs[nsm_req->index]); in handle_extend_pcr()
585 if (!vnsm->extend_pcr(vnsm, nsm_req->index, nsm_req->data, in handle_extend_pcr()
702 static bool handle_lock_pcr(VirtIONSM *vnsm, struct iovec *request, in handle_lock_pcr() argument
719 if (nsm_req.index >= vnsm->max_pcrs) { in handle_lock_pcr()
726 pcr = &(vnsm->pcrs[nsm_req.index]); in handle_lock_pcr()
837 static bool handle_lock_pcrs(VirtIONSM *vnsm, struct iovec *request, in handle_lock_pcrs() argument
853 if (nsm_req.range > vnsm->max_pcrs) { in handle_lock_pcrs()
861 vnsm->pcrs[i].locked = true; in handle_lock_pcrs()
1155 static bool add_payload_to_cose(cbor_item_t *cose, VirtIONSM *vnsm, in add_payload_to_cose() argument
1175 if (!qemu_cbor_add_string_to_map(root, "module_id", vnsm->module_id)) { in add_payload_to_cose()
1178 if (!qemu_cbor_add_string_to_map(root, "digest", vnsm->digest)) { in add_payload_to_cose()
1188 if (vnsm->pcrs[i].locked) { in add_payload_to_cose()
1196 pcr = &(vnsm->pcrs[ind[i]]); in add_payload_to_cose()
1346 static bool handle_attestation(VirtIONSM *vnsm, struct iovec *request, in handle_attestation() argument
1382 if (!add_payload_to_cose(cose, vnsm, nsm_req)) { in handle_attestation()
1443 bool (*response_fn)(VirtIONSM *vnsm, struct iovec *request,
1505 static bool get_nsm_request_response(VirtIONSM *vnsm, struct iovec *req, in get_nsm_request_response() argument
1528 return cmd->response_fn(vnsm, req, resp, errp); in get_nsm_request_response()
1535 VirtIONSM *vnsm = VIRTIO_NSM(vdev); in handle_input() local
1576 if (!get_nsm_request_response(vnsm, &req, &res, &err)) { in handle_input()
1613 static bool extend_pcr(VirtIONSM *vnsm, int ind, uint8_t *data, uint16_t len) in extend_pcr() argument
1616 struct PCRInfo *pcr = &(vnsm->pcrs[ind]); in extend_pcr()
1634 static void lock_pcr(VirtIONSM *vnsm, int ind) in lock_pcr() argument
1636 vnsm->pcrs[ind].locked = true; in lock_pcr()
1642 VirtIONSM *vnsm = VIRTIO_NSM(dev); in virtio_nsm_device_realize() local
1644 vnsm->max_pcrs = NSM_MAX_PCRS; in virtio_nsm_device_realize()
1645 vnsm->digest = (char *) "SHA384"; in virtio_nsm_device_realize()
1646 if (vnsm->module_id == NULL) { in virtio_nsm_device_realize()
1647 vnsm->module_id = (char *) "i-234-enc5678"; in virtio_nsm_device_realize()
1649 vnsm->version_major = 1; in virtio_nsm_device_realize()
1650 vnsm->version_minor = 0; in virtio_nsm_device_realize()
1651 vnsm->version_patch = 0; in virtio_nsm_device_realize()
1652 vnsm->extend_pcr = extend_pcr; in virtio_nsm_device_realize()
1653 vnsm->lock_pcr = lock_pcr; in virtio_nsm_device_realize()
1657 vnsm->vq = virtio_add_queue(vdev, 2, handle_input); in virtio_nsm_device_realize()