Lines Matching defs:hdr
81 struct program_binary_header *hdr = binary;
83 if (binary_size < sizeof(*hdr))
89 if (payload_size > binary_size - sizeof(*hdr))
92 hdr->internal_format = 0;
93 memcpy(hdr->sha1, sha1, sizeof(hdr->sha1));
94 memcpy(hdr + 1, payload, payload_size);
95 hdr->size = payload_size;
97 hdr->crc32 = util_hash_crc32(hdr + 1, payload_size);
104 simple_header_checks(const struct program_binary_header *hdr, unsigned length)
106 if (hdr == NULL || length < sizeof(*hdr))
109 if (hdr->internal_format != 0)
116 check_crc32(const struct program_binary_header *hdr, unsigned length)
121 crc32_len = hdr->size;
122 if (crc32_len > length - sizeof(*hdr))
125 crc32 = util_hash_crc32(hdr + 1, crc32_len);
126 if (hdr->crc32 != crc32)
134 const struct program_binary_header *hdr,
140 if (!simple_header_checks(hdr, length))
143 if (memcmp(hdr->sha1, sha1, sizeof(hdr->sha1)) != 0)
146 if (!check_crc32(hdr, length))
166 const struct program_binary_header *hdr = binary;
167 if (!is_program_binary_valid(binary_format, sha1, hdr, length))
169 return (const uint8_t*)binary + sizeof(*hdr);