Lines Matching refs:hdr
79 struct program_binary_header *hdr = binary;
81 if (binary_size < sizeof(*hdr))
87 if (payload_size > binary_size - sizeof(*hdr))
90 hdr->internal_format = 0;
91 memcpy(hdr->sha1, sha1, sizeof(hdr->sha1));
92 memcpy(hdr + 1, payload, payload_size);
93 hdr->size = payload_size;
95 hdr->crc32 = util_hash_crc32(hdr + 1, payload_size);
102 simple_header_checks(const struct program_binary_header *hdr, unsigned length)
104 if (hdr == NULL || length < sizeof(*hdr))
107 if (hdr->internal_format != 0)
114 check_crc32(const struct program_binary_header *hdr, unsigned length)
119 crc32_len = hdr->size;
120 if (crc32_len > length - sizeof(*hdr))
123 crc32 = util_hash_crc32(hdr + 1, crc32_len);
124 if (hdr->crc32 != crc32)
132 const struct program_binary_header *hdr,
138 if (!simple_header_checks(hdr, length))
141 if (memcmp(hdr->sha1, sha1, sizeof(hdr->sha1)) != 0)
144 if (!check_crc32(hdr, length))
164 const struct program_binary_header *hdr = binary;
165 if (!is_program_binary_valid(binary_format, sha1, hdr, length))
167 return (const uint8_t*)binary + sizeof(*hdr);