Lines Matching defs:vd
29 struct hvb_verified_data *vd = NULL;
31 vd = hvb_calloc(sizeof(*vd));
32 if (!vd) {
37 vd->certs = hvb_calloc(sizeof(struct hvb_cert_data) * HVB_MAX_NUMBER_OF_LOADED_CERTS);
38 if (!vd->certs) {
43 vd->images = hvb_calloc(sizeof(struct hvb_image_data) * HVB_MAX_NUMBER_OF_LOADED_IMAGES);
44 if (!vd->images) {
49 vd->num_loaded_certs = 0;
50 vd->num_loaded_images = 0;
52 vd->cmdline.buf = hvb_calloc(CMD_LINE_SIZE);
53 if (!vd->cmdline.buf) {
58 vd->cmdline.cur_pos = 0;
59 vd->cmdline.max_size = CMD_LINE_SIZE;
61 vd->key_len = 0;
63 return vd;
66 hvb_chain_verify_data_free(vd);
67 hvb_free(vd);
68 vd = NULL;
69 return vd;
74 struct hvb_verified_data *vd)
81 ret = footer_init_desc(ops, ptn, ptn_list, &cert_pubk, vd);
104 static struct hvb_buf *hvb_get_partition_image(struct hvb_verified_data *vd, const char *ptn)
106 struct hvb_image_data *p = vd->images;
107 struct hvb_image_data *end = p + vd->num_loaded_images;
130 struct hvb_buf *rvt, struct hvb_verified_data *vd)
141 desc_size = sizeof(desc) - (PUBKEY_LEN - vd->key_len);
168 ret = footer_init_desc(ops, &desc.name[0], ptn_list, &cert_pubk, vd);
229 struct hvb_verified_data *vd = NULL;
252 vd = hvb_init_verified_data();
253 if (!vd) {
260 ret = hvb_rvt_verify_root(ops, rvt_ptn, ptn_list, vd);
267 rvt_image = hvb_get_partition_image(vd, rvt_ptn);
275 ret = hvb_walk_verify_nodes(ops, ptn_list, rvt_image, vd);
282 ret = hvb_creat_cmdline(ops, vd);
288 *out_vd = vd;
291 if (vd != NULL && ret != HVB_OK) {
292 hvb_chain_verify_data_free(vd);
293 hvb_free(vd);
301 void hvb_chain_verify_data_free(struct hvb_verified_data *vd)
305 if (vd == NULL) {
306 hvb_print("vd is NULL, do nothing\n");
310 for (n = 0; n < vd->num_loaded_certs && vd->certs; n++) {
311 if (vd->certs[n].data.addr != NULL)
312 hvb_free(vd->certs[n].data.addr);
314 if (vd->certs[n].partition_name != NULL) {
315 hvb_free(vd->certs[n].partition_name);
319 if (vd->certs != NULL) {
320 hvb_free(vd->certs);
323 for (n = 0; n < vd->num_loaded_images && vd->images; n++) {
324 if (vd->images[n].data.addr != NULL)
325 hvb_free(vd->images[n].data.addr);
327 if (vd->images[n].partition_name != NULL)
328 hvb_free(vd->images[n].partition_name);
331 if (vd->images != NULL) {
332 hvb_free(vd->images);
335 if (vd->cmdline.buf != NULL) {
336 hvb_free(vd->cmdline.buf);
339 hvb_memset((uint8_t *)vd, 0, sizeof(*vd));