Lines Matching refs:v
193 verity_info *v = &f->verity; in verify_tree() local
197 v->hash_size = in verify_tree()
198 verity_get_size(v->data_blocks * FEC_BLOCKSIZE, &levels, NULL); in verify_tree()
200 check(v->hash_start < UINT64_MAX - v->hash_size); in verify_tree()
201 check(v->hash_start + v->hash_size <= f->data_size); in verify_tree()
203 uint64_t hash_offset = v->hash_start; in verify_tree()
206 v->hash_data_offset = data_offset; in verify_tree()
228 verity_get_size(v->data_blocks * FEC_BLOCKSIZE, NULL, hashes); in verify_tree()
235 v->hash_data_offset = data_offset; in verify_tree()
236 v->hash_data_blocks = blocks; in verify_tree()
241 check(v->hash_data_blocks); in verify_tree()
242 check(v->hash_data_blocks <= v->hash_size / FEC_BLOCKSIZE); in verify_tree()
244 check(v->hash_data_offset); in verify_tree()
245 check(v->hash_data_offset <= in verify_tree()
246 UINT64_MAX - (v->hash_data_blocks * FEC_BLOCKSIZE)); in verify_tree()
247 check(v->hash_data_offset < f->data_size); in verify_tree()
248 check(v->hash_data_offset + v->hash_data_blocks * FEC_BLOCKSIZE <= in verify_tree()
303 if (blocks == v->hash_data_blocks) { in verify_tree()
315 v->hash = data_hashes.release(); in verify_tree()
330 verity_info *v = &f->verity; in parse_table() local
370 &v->data_blocks) == -1) { in parse_table()
378 &v->hash_start) == -1) { in parse_table()
383 v->hash_start *= FEC_BLOCKSIZE; in parse_table()
398 v->salt_size = token.size(); in parse_table()
399 check(v->salt_size % 2 == 0); in parse_table()
400 v->salt_size /= 2; in parse_table()
402 salt.reset(new (std::nothrow) uint8_t[v->salt_size]); in parse_table()
409 if (parse_hex(salt.get(), v->salt_size, token.c_str()) == -1) { in parse_table()
425 check(v->hash_start < f->data_size); in parse_table()
427 if (v->metadata_start < v->hash_start) { in parse_table()
428 check(v->data_blocks == v->metadata_start / FEC_BLOCKSIZE); in parse_table()
430 check(v->data_blocks == v->hash_start / FEC_BLOCKSIZE); in parse_table()
433 v->salt = salt.release(); in parse_table()
434 v->table = table.release(); in parse_table()
441 check(v->hash); in parse_table()
446 if (verity_hash(f, zero_block, v->zero_hash) == -1) { in parse_table()
472 verity_info *v = &f->verity; in rewrite_metadata() local
473 memcpy(metadata.get(), &v->header, sizeof(v->header)); in rewrite_metadata()
475 check(v->table); in rewrite_metadata()
476 size_t len = strlen(v->table); in rewrite_metadata()
478 check(sizeof(v->header) + len <= VERITY_METADATA_SIZE); in rewrite_metadata()
479 memcpy(metadata.get() + sizeof(v->header), v->table, len); in rewrite_metadata()
536 verity_info *v = &f->verity; in verity_parse_header() local
539 if (!raw_pread(f, &v->header, sizeof(v->header), offset)) { in verity_parse_header()
546 if (v->header.magic == VERITY_MAGIC_DISABLE) { in verity_parse_header()
549 v->disabled = true; in verity_parse_header()
552 if (fec_pread(f, &v->ecc_header, sizeof(v->ecc_header), offset) != in verity_parse_header()
553 sizeof(v->ecc_header)) { in verity_parse_header()
558 if (validate_header(f, &v->header, offset)) { in verity_parse_header()
562 if (validate_header(f, &v->ecc_header, offset)) { in verity_parse_header()
567 if (!v->disabled && v->header.magic != v->ecc_header.magic) { in verity_parse_header()
569 v->header.magic = v->ecc_header.magic; in verity_parse_header()
572 if (v->header.version != v->ecc_header.version) { in verity_parse_header()
574 v->header.version = v->ecc_header.version; in verity_parse_header()
577 if (v->header.length != v->ecc_header.length) { in verity_parse_header()
579 v->header.length = v->ecc_header.length; in verity_parse_header()
582 if (memcmp(v->header.signature, v->ecc_header.signature, in verity_parse_header()
583 sizeof(v->header.signature))) { in verity_parse_header()
590 v->metadata_start = offset; in verity_parse_header()
592 if (parse_table(f, offset + sizeof(v->header), v->header.length) == -1) { in verity_parse_header()
603 if (v->metadata_start < v->hash_start) { in verity_parse_header()
604 f->data_size = v->metadata_start; in verity_parse_header()
606 f->data_size = v->hash_start; in verity_parse_header()
622 verity_info *v = &f->verity; in fec_verity_set_status() local
624 if (!v->metadata_start) { in fec_verity_set_status()
630 if (v->disabled == !enabled) { in fec_verity_set_status()
636 if (!raw_pwrite(f, &magic, sizeof(magic), v->metadata_start)) { in fec_verity_set_status()
644 v->disabled = !enabled; in fec_verity_set_status()