Lines Matching refs:name
94 bool requires_attest_key(const std::string& name) { in requires_attest_key() argument
95 return name.find("-attest-key") != std::string::npos; in requires_attest_key()
98 bool requires_rr(const std::string& name) { in requires_rr() argument
99 return name.find("-rr") != std::string::npos; in requires_rr()
102 bool is_asymmetric(const std::string& name) { in is_asymmetric() argument
103 return (name.find("rsa") != std::string::npos || name.find("25519") != std::string::npos || in is_asymmetric()
104 name.find("p256") != std::string::npos); in is_asymmetric()
125 void save_keyblob(const std::string& subdir, const std::string& name, in save_keyblob() argument
129 std::string blobname(subdir + "/" + name + ".keyblob"); in save_keyblob()
135 std::string charsname(subdir + "/" + name + ".chars"); in save_keyblob()
145 std::string hexname(subdir + "/" + name + ".hex"); in save_keyblob()
151 void save_keyblob_and_cert(const std::string& subdir, const std::string& name, in save_keyblob_and_cert() argument
155 save_keyblob(subdir, name, keyblob, key_characteristics); in save_keyblob_and_cert()
157 if (is_asymmetric(name)) { in save_keyblob_and_cert()
160 FAIL() << "No cert available for " << name; in save_keyblob_and_cert()
163 std::string certname(subdir + "/" + name + ".cert"); in save_keyblob_and_cert()
171 void delete_keyblob(const std::string& subdir, const std::string& name) { in delete_keyblob() argument
172 std::string blobname(subdir + "/" + name + ".keyblob"); in delete_keyblob()
174 std::string charsname(subdir + "/" + name + ".chars"); in delete_keyblob()
176 std::string hexname(subdir + "/" + name + ".hex"); in delete_keyblob()
178 std::string certname(subdir + "/" + name + ".cert"); in delete_keyblob()
182 std::vector<uint8_t> load_file(const std::string& subdir, const std::string& name, in load_file() argument
184 std::string blobname(subdir + "/" + name + suffix); in load_file()
192 std::vector<uint8_t> load_keyblob(const std::string& subdir, const std::string& name) { in load_keyblob() argument
193 return load_file(subdir, name, ".keyblob"); in load_keyblob()
196 std::vector<uint8_t> load_cert(const std::string& subdir, const std::string& name) { in load_cert() argument
197 return load_file(subdir, name, ".cert"); in load_cert()
220 for (std::string name : keyblob_names()) { in UpgradeKeyBlobs() local
221 if (requires_attest_key(name) && shouldSkipAttestKeyTest()) { in UpgradeKeyBlobs()
222 std::cerr << "Skipping variant '" << name in UpgradeKeyBlobs()
236 name += "-hidden"; in UpgradeKeyBlobs()
238 SCOPED_TRACE(testing::Message() << name); in UpgradeKeyBlobs()
241 std::vector<uint8_t> keyblob = load_keyblob(subdir, name); in UpgradeKeyBlobs()
243 if (requires_rr(name)) { in UpgradeKeyBlobs()
244 std::cerr << "Skipping missing keyblob file '" << name in UpgradeKeyBlobs()
247 FAIL() << "Missing keyblob file '" << name << "'"; in UpgradeKeyBlobs()
260 std::cerr << "Keyblob '" << name << "' did not require upgrade\n"; in UpgradeKeyBlobs()
262 << "Keyblob '" << name << "' unexpectedly left as-is"; in UpgradeKeyBlobs()
276 save_keyblob(subdir, name, upgraded_keyblob, key_characteristics); in UpgradeKeyBlobs()
278 std::cerr << "Keyblob '" << name << "' upgraded\n"; in UpgradeKeyBlobs()
279 EXPECT_TRUE(expectUpgrade) << "Keyblob '" << name << "' unexpectedly upgraded"; in UpgradeKeyBlobs()
373 for (std::string name : keyblob_names()) { in TEST_P() local
374 if (requires_attest_key(name) && shouldSkipAttestKeyTest()) { in TEST_P()
375 std::cerr << "Skipping variant '" << name in TEST_P()
379 auto entry = keys_info.find(name); in TEST_P()
380 ASSERT_NE(entry, keys_info.end()) << "no builder for " << name; in TEST_P()
387 name += "-hidden"; in TEST_P()
389 SCOPED_TRACE(testing::Message() << name); in TEST_P()
397 if (requires_rr(name) && result == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE) { in TEST_P()
399 std::cerr << "Skipping '" << name << "' key as rollback resistance unavailable\n"; in TEST_P()
402 ASSERT_EQ(ErrorCode::OK, result) << " failed for " << name; in TEST_P()
405 save_keyblob_and_cert(subdir, name, keyblob, key_characteristics, cert_chain); in TEST_P()
461 for (std::string name : keyblob_names()) { in TEST_P() local
462 if (requires_attest_key(name) && shouldSkipAttestKeyTest()) { in TEST_P()
463 std::cerr << "Skipping variant '" << name in TEST_P()
473 name += "-hidden"; in TEST_P()
475 SCOPED_TRACE(testing::Message() << name); in TEST_P()
476 std::vector<uint8_t> keyblob = load_keyblob(subdir, name); in TEST_P()
478 if (requires_rr(name)) { in TEST_P()
479 std::cerr << "Skipping missing keyblob file '" << name in TEST_P()
482 FAIL() << "Missing keyblob file '" << name << "'"; in TEST_P()
488 if (is_asymmetric(name)) { in TEST_P()
489 cert = load_cert(subdir, name); in TEST_P()
495 if (name.find("aes-key") != std::string::npos) { in TEST_P()
500 } else if (name.find("des-key") != std::string::npos) { in TEST_P()
505 } else if (name.find("hmac-key") != std::string::npos) { in TEST_P()
511 } else if (name.find("rsa-key") != std::string::npos) { in TEST_P()
515 } else if (name.find("p256-key") != std::string::npos) { in TEST_P()
519 } else if (name.find("ed25519-key") != std::string::npos) { in TEST_P()
523 } else if (name.find("x25519-key") != std::string::npos) { in TEST_P()
566 } else if (requires_attest_key(name)) { in TEST_P()
588 FAIL() << "Unexpected name: " << name; in TEST_P()
603 for (std::string name : keyblob_names()) { in TEST_P() local
610 name += "-hidden"; in TEST_P()
612 if (!requires_rr(name)) { in TEST_P()
613 std::cerr << "Skipping keyblob file '" << name in TEST_P()
617 SCOPED_TRACE(testing::Message() << name); in TEST_P()
618 std::vector<uint8_t> keyblob = load_keyblob(subdir, name); in TEST_P()
620 std::cerr << "Skipping missing keyblob file '" << name in TEST_P()
629 std::cerr << "Deleting files for deleted key '" << name << "';\n"; in TEST_P()
630 delete_keyblob(subdir, name); in TEST_P()
634 if (name.find("aes-key") != std::string::npos) { in TEST_P()
639 FAIL() << "Unexpected name: " << name; in TEST_P()