Lines Matching refs:buf
206 static int toc0_create_key_item(uint8_t *buf, uint32_t *len, in toc0_create_key_item() argument
209 struct toc0_key_item *key_item = (void *)buf; in toc0_create_key_item()
237 SHA256(buf, key_item->sig - buf, digest); in toc0_create_key_item()
260 static int toc0_verify_key_item(const uint8_t *buf, uint32_t len, in toc0_verify_key_item() argument
263 struct toc0_key_item *key_item = (void *)buf; in toc0_verify_key_item()
297 SHA256(buf, key_item->sig - buf, digest); in toc0_verify_key_item()
347 static int toc0_create_cert_item(uint8_t *buf, uint32_t *len, RSA *fw_key, in toc0_create_cert_item() argument
350 struct toc0_cert_item *cert_item = (void *)buf; in toc0_create_cert_item()
414 static int toc0_verify_cert_item(const uint8_t *buf, uint32_t len, RSA *fw_key, in toc0_verify_cert_item() argument
417 const struct toc0_cert_item *cert_item = (const void *)buf; in toc0_verify_cert_item()
474 static int toc0_create(uint8_t *buf, uint32_t len, RSA *root_key, RSA *fw_key, in toc0_create() argument
478 struct toc0_main_info *main_info = (void *)buf; in toc0_create()
481 uint32_t *buf32 = (void *)buf; in toc0_create()
508 memcpy(buf + item_offset, key_item, item_length); in toc0_create()
509 } else if (toc0_create_key_item(buf + item_offset, &item_length, in toc0_create()
521 if (toc0_create_cert_item(buf + item_offset, &item_length, in toc0_create()
534 if (buf + item_offset != fw_item) in toc0_create()
535 memmove(buf + item_offset, fw_item, item_length); in toc0_create()
547 memset(buf + item_offset, 0xff, item_length); in toc0_create()
602 static int toc0_verify(const uint8_t *buf, uint32_t len, RSA *root_key) in toc0_verify() argument
604 const struct toc0_main_info *main_info = (void *)buf; in toc0_verify()
609 uint32_t *buf32 = (void *)buf; in toc0_verify()
639 else if (toc0_verify_key_item(buf + offset, length, root_key, &fw_key)) in toc0_verify()
649 SHA256(buf + offset, length, digest); in toc0_verify()
658 if (toc0_verify_cert_item(buf + offset, length, fw_key, digest)) in toc0_verify()
719 static int toc0_verify_header(unsigned char *buf, int image_size, in toc0_verify_header() argument
741 ret = toc0_verify(buf, image_size, root_key); in toc0_verify_header()
760 static void toc0_print_header(const void *buf, struct image_tool_params *params) in toc0_print_header() argument
762 const struct toc0_main_info *main_info = buf; in toc0_print_header()
804 static void toc0_set_header(void *buf, struct stat *sbuf, int ifd, in toc0_set_header() argument
869 ret = toc0_create(buf, params->file_size, root_key, fw_key, in toc0_set_header()
871 buf + TOC0_DEFAULT_HEADER_LEN, in toc0_set_header()