Lines Matching refs:std

54 static bool HexToBytes(const std::string &hex, std::vector<uint8_t> *bytes) {  in HexToBytes()
128 static std::unique_ptr<ShaHasher> CreateShaHasher( in CreateShaHasher()
129 const std::string &algorithm) { in CreateShaHasher()
131 return std::make_unique<ShaHasherImpl<SHA_CTX>>( in CreateShaHasher()
135 return std::make_unique<ShaHasherImpl<SHA256_CTX>>( in CreateShaHasher()
139 return std::make_unique<ShaHasherImpl<SHA512_CTX>>( in CreateShaHasher()
149 const std::vector<uint8_t> buffer(size, 0); in CalculateZeroDigest()
191 std::vector<uint8_t> calculating_hash_block;
214 static std::string VerifyHashtree(int image_fd, uint64_t image_size, in VerifyHashtree()
215 const std::vector<uint8_t> &salt, in VerifyHashtree()
220 const std::vector<uint8_t> &root_digest) { in VerifyHashtree()
235 std::list<HashtreeLevel> levels; in VerifyHashtree()
258 for (auto level = std::prev(levels.end()); level != levels.begin(); in VerifyHashtree()
260 std::prev(level)->comparing_tree_offset = in VerifyHashtree()
265 std::vector<uint8_t> padded_zero_digest(padded_digest_size, 0); in VerifyHashtree()
271 std::vector<uint8_t> data_block(data_block_size); in VerifyHashtree()
272 std::vector<uint8_t> tree_block(hash_block_size); in VerifyHashtree()
285 std::vector<uint8_t> *current_block = &data_block; in VerifyHashtree()
294 if (std::next(level) == levels.end()) { in VerifyHashtree()
364 static std::string GetHashAlgorithm(const AvbHashtreeDescriptor &descriptor) { in GetHashAlgorithm()
365 return std::string(reinterpret_cast<const char *>(descriptor.hash_algorithm)); in GetHashAlgorithm()
369 static std::string GetHashAlgorithm(const AvbHashDescriptor &descriptor) { in GetHashAlgorithm()
370 return std::string(reinterpret_cast<const char *>(descriptor.hash_algorithm)); in GetHashAlgorithm()
374 static bool ValidatePublicKeyBlob(const std::string &key_blob_to_validate) { in ValidatePublicKeyBlob()
380 std::string allowed_key_blob; in ValidatePublicKeyBlob()
381 std::vector<std::string> allowed_key_paths = { in ValidatePublicKeyBlob()
404 static std::unique_ptr<android::fs_mgr::FsAvbHashtreeDescriptor>
407 std::string *out_system_path) { in GetSystemHashtreeDescriptor()
430 std::string out_public_key_data; in GetSystemHashtreeDescriptor()
431 std::string out_avb_partition_name; in GetSystemHashtreeDescriptor()
432 std::unique_ptr<android::fs_mgr::VBMetaData> vbmeta = in GetSystemHashtreeDescriptor()
451 std::unique_ptr<android::fs_mgr::FsAvbHashtreeDescriptor> descriptor = in GetSystemHashtreeDescriptor()
452 android::fs_mgr::GetHashtreeDescriptor("system", std::move(*vbmeta)); in GetSystemHashtreeDescriptor()
477 std::string out_public_key_data; in TEST()
479 std::string boot_path = "/dev/block/by-name/boot" + fs_mgr_get_slot_suffix(); in TEST()
480 std::unique_ptr<android::fs_mgr::VBMetaData> vbmeta = in TEST()
495 std::unique_ptr<android::fs_mgr::FsAvbHashDescriptor> descriptor = in TEST()
496 android::fs_mgr::GetHashDescriptor("boot", std::move(*vbmeta)); in TEST()
497 const std::string &salt_str = descriptor->salt; in TEST()
498 const std::string &expected_digest_str = descriptor->digest; in TEST()
503 const std::string hash_algorithm(GetHashAlgorithm(*descriptor)); in TEST()
506 std::unique_ptr<ShaHasher> hasher = CreateShaHasher(hash_algorithm); in TEST()
509 std::vector<uint8_t> salt, expected_digest, out_digest; in TEST()
516 std::vector<char> boot_partition_vector; in TEST()
538 std::string system_path; in TEST()
539 std::unique_ptr<android::fs_mgr::FsAvbHashtreeDescriptor> descriptor = in TEST()
551 const std::string &salt_str = descriptor->salt; in TEST()
552 const std::string &expected_digest_str = descriptor->root_digest; in TEST()
557 const std::string hash_algorithm(GetHashAlgorithm(*descriptor)); in TEST()
560 std::unique_ptr<ShaHasher> hasher = CreateShaHasher(hash_algorithm); in TEST()
563 std::vector<uint8_t> salt, expected_digest; in TEST()
576 std::string error_message = VerifyHashtree( in TEST()
594 static size_t NextWord(const std::string &str, size_t *pos) { in NextWord()
597 if (start == std::string::npos) { in NextWord()
601 if (*pos == std::string::npos) { in NextWord()
612 std::string system_path; in TEST()
613 std::unique_ptr<android::fs_mgr::FsAvbHashtreeDescriptor> descriptor = in TEST()
626 std::vector<android::dm::DeviceMapper::TargetInfo> table; in TEST()
645 std::array<std::string, 10> descriptor_values = { in TEST()
646 std::to_string(descriptor->dm_verity_version), in TEST()
649 std::to_string(descriptor->data_block_size), in TEST()
650 std::to_string(descriptor->hash_block_size), in TEST()
651 std::to_string(descriptor->image_size / in TEST()
653 std::to_string(descriptor->image_size / in TEST()
661 for (const std::string &descriptor_value : descriptor_values) { in TEST()
663 ASSERT_NE(begin_pos, std::string::npos); in TEST()
675 ASSERT_NE(begin_pos, std::string::npos); in TEST()
677 std::stoul(target.data.substr(begin_pos, next_pos - begin_pos)); in TEST()
680 std::set<std::string> opt_params = { in TEST()
687 std::map<std::string, std::string> opt_fec_params = { in TEST()
696 ASSERT_NE(begin_pos, std::string::npos); in TEST()
697 const std::string param_name(target.data, begin_pos, next_pos - begin_pos); in TEST()
702 ASSERT_NE(begin_pos, std::string::npos); in TEST()
712 std::to_string(descriptor->fec_num_roots)); in TEST()
715 std::to_string(descriptor->fec_offset / descriptor->data_block_size)); in TEST()
718 std::to_string(descriptor->fec_offset / descriptor->data_block_size)); in TEST()
721 ASSERT_EQ(NextWord(target.data, &next_pos), std::string::npos); in TEST()