Lines Matching defs:footer

20 static enum hvb_errno _footer_parser(struct hvb_footer *footer, struct hvb_buf *footer_buf)
24 if (footer_buf->size < sizeof(*footer)) {
25 hvb_print("footer src size error.\n");
28 if (hvb_memcpy_s(footer, sizeof(*footer), footer_buf->addr, sizeof(*footer)) != 0) {
29 hvb_print("error, copy footer.\n");
34 if (hvb_memcmp(footer->magic, HVB_FOOTER_MAGIC, sizeof(footer->magic)) != 0) {
40 if (footer->partition_size > HVB_MAX_PARTITION_SIZE ||
41 footer->partition_size < HVB_MIN_PARTITION_SIZE) {
42 hvb_print("Invalid partition_size in footer.\n");
46 size = footer->image_size + footer->cert_size + HVB_FOOTER_SIZE;
47 if (footer->image_size >= footer->partition_size ||
48 size < footer->image_size + HVB_FOOTER_SIZE ||
49 size > footer->partition_size) {
50 hvb_print("Invalid image_size in footer.\n");
54 size = footer->cert_offset + footer->cert_size + HVB_FOOTER_SIZE;
55 if (footer->cert_offset < footer->image_size ||
56 size < footer->cert_offset + HVB_FOOTER_SIZE ||
57 size > footer->partition_size) {
58 hvb_print("Invalid cert info in footer.\n");
65 static enum hvb_errno _load_and_parse_footer(struct hvb_ops *ops, struct hvb_footer *footer, const char *ptn)
84 ret = _footer_parser(footer, &footer_buf);
86 hvb_printv(ptn, ": No footer detected,.\n", NULL);
93 static enum hvb_errno _load_cert(struct hvb_ops *ops, struct hvb_buf *cert, const char *ptn, struct hvb_footer *footer)
97 uint64_t offset = footer->cert_offset;
123 struct hvb_footer footer = {0};
136 ret = _load_and_parse_footer(ops, &footer, ptn);
140 cert_buf.size = footer.cert_size;
147 ret = _load_cert(ops, &cert_buf, ptn, &footer);