Lines Matching refs:gbb
58 GoogleBinaryBlockHeader *gbb = (GoogleBinaryBlockHeader *)buf; in recognize_gbb() local
60 if (memcmp(gbb->signature, GBB_SIGNATURE, GBB_SIGNATURE_SIZE)) in recognize_gbb()
62 if (gbb->major_version > GBB_MAJOR_VER) in recognize_gbb()
71 int futil_valid_gbb_header(GoogleBinaryBlockHeader *gbb, uint32_t len, in futil_valid_gbb_header() argument
77 if (memcmp(gbb->signature, GBB_SIGNATURE, GBB_SIGNATURE_SIZE)) in futil_valid_gbb_header()
79 if (gbb->major_version != GBB_MAJOR_VER) in futil_valid_gbb_header()
84 uint32_t maxlen = gbb->header_size; in futil_valid_gbb_header()
86 gbb->hwid_offset + gbb->hwid_size); in futil_valid_gbb_header()
88 gbb->rootkey_offset + gbb->rootkey_size); in futil_valid_gbb_header()
90 gbb->bmpfv_offset + gbb->bmpfv_size); in futil_valid_gbb_header()
92 gbb->recovery_key_offset + gbb->recovery_key_size); in futil_valid_gbb_header()
96 if (gbb->header_size != GBB_HEADER_SIZE || gbb->header_size > len) in futil_valid_gbb_header()
98 if (gbb->hwid_offset < GBB_HEADER_SIZE) in futil_valid_gbb_header()
100 if (gbb->hwid_offset + gbb->hwid_size > len) in futil_valid_gbb_header()
102 if (gbb->hwid_size) { in futil_valid_gbb_header()
104 ((uint8_t *)gbb + gbb->hwid_offset); in futil_valid_gbb_header()
105 if (!is_null_terminated(s, gbb->hwid_size)) in futil_valid_gbb_header()
108 if (gbb->rootkey_offset < GBB_HEADER_SIZE) in futil_valid_gbb_header()
110 if (gbb->rootkey_offset + gbb->rootkey_size > len) in futil_valid_gbb_header()
113 if (gbb->bmpfv_offset < GBB_HEADER_SIZE) in futil_valid_gbb_header()
115 if (gbb->bmpfv_offset + gbb->bmpfv_size > len) in futil_valid_gbb_header()
117 if (gbb->recovery_key_offset < GBB_HEADER_SIZE) in futil_valid_gbb_header()
119 if (gbb->recovery_key_offset + gbb->recovery_key_size > len) in futil_valid_gbb_header()
128 int print_hwid_digest(GoogleBinaryBlockHeader *gbb, in print_hwid_digest() argument
134 if (gbb->minor_version < 2) { in print_hwid_digest()
139 uint8_t *buf = (uint8_t *)gbb; in print_hwid_digest()
140 char *hwid_str = (char *)(buf + gbb->hwid_offset); in print_hwid_digest()
142 uint8_t *digest = DigestBuf(buf + gbb->hwid_offset, in print_hwid_digest()
150 printf("%02x", gbb->hwid_digest[i]); in print_hwid_digest()
151 if (gbb->hwid_digest[i] != digest[i]) in print_hwid_digest()
163 void update_hwid_digest(GoogleBinaryBlockHeader *gbb) in update_hwid_digest() argument
166 if (gbb->minor_version < 2) in update_hwid_digest()
169 uint8_t *buf = (uint8_t *)gbb; in update_hwid_digest()
170 char *hwid_str = (char *)(buf + gbb->hwid_offset); in update_hwid_digest()
171 uint8_t *digest = DigestBuf(buf + gbb->hwid_offset, in update_hwid_digest()
174 memcpy(gbb->hwid_digest, digest, SHA256_DIGEST_SIZE); in update_hwid_digest()