• Home
  • Raw
  • Download

Lines Matching refs:dir

201 static KeymasterOperation begin(Keymaster& keymaster, const std::string& dir,  in begin()  argument
206 auto kmKeyPath = dir + "/" + kFn_keymaster_key_blob; in begin()
217 LOG(DEBUG) << "Upgrading key: " << dir; in begin()
220 auto newKeyPath = dir + "/" + kFn_keymaster_key_blob_upgraded; in begin()
227 LOG(ERROR) << "Key deletion failed during upgrade, continuing anyway: " << dir; in begin()
230 LOG(INFO) << "Key upgraded: " << dir; in begin()
234 static bool encryptWithKeymasterKey(Keymaster& keymaster, const std::string& dir, in encryptWithKeymasterKey() argument
241 begin(keymaster, dir, km::KeyPurpose::ENCRYPT, keyParams, opParams, authToken, &outParams); in encryptWithKeymasterKey()
262 static bool decryptWithKeymasterKey(Keymaster& keymaster, const std::string& dir, in decryptWithKeymasterKey() argument
271 begin(keymaster, dir, km::KeyPurpose::DECRYPT, keyParams, opParams, authToken, nullptr); in decryptWithKeymasterKey()
447 bool storeKey(const std::string& dir, const KeyAuthentication& auth, const KeyBuffer& key) { in storeKey() argument
448 if (TEMP_FAILURE_RETRY(mkdir(dir.c_str(), 0700)) == -1) { in storeKey()
449 PLOG(ERROR) << "key mkdir " << dir; in storeKey()
452 if (!writeStringToFile(kCurrentVersion, dir + "/" + kFn_version)) return false; in storeKey()
454 if (!createSecdiscardable(dir + "/" + kFn_secdiscardable, &secdiscardable_hash)) return false; in storeKey()
456 if (!writeStringToFile(stretching, dir + "/" + kFn_stretching)) return false; in storeKey()
463 if (!writeStringToFile(salt, dir + "/" + kFn_salt)) return false; in storeKey()
473 if (!writeStringToFile(kmKey, dir + "/" + kFn_keymaster_key_blob)) return false; in storeKey()
477 if (!encryptWithKeymasterKey(keymaster, dir, keyParams, authToken, key, &encryptedKey)) in storeKey()
482 if (!writeStringToFile(encryptedKey, dir + "/" + kFn_encrypted_key)) return false; in storeKey()
505 bool retrieveKey(const std::string& dir, const KeyAuthentication& auth, KeyBuffer* key) { in retrieveKey() argument
507 if (!readFileToString(dir + "/" + kFn_version, &version)) return false; in retrieveKey()
513 if (!readSecdiscardable(dir + "/" + kFn_secdiscardable, &secdiscardable_hash)) return false; in retrieveKey()
515 if (!readFileToString(dir + "/" + kFn_stretching, &stretching)) return false; in retrieveKey()
518 if (!readFileToString(dir + "/" + kFn_salt, &salt)) return false; in retrieveKey()
523 if (!readFileToString(dir + "/" + kFn_encrypted_key, &encryptedMessage)) return false; in retrieveKey()
530 if (!decryptWithKeymasterKey(keymaster, dir, keyParams, authToken, encryptedMessage, key)) in retrieveKey()
538 static bool deleteKey(const std::string& dir) { in deleteKey() argument
540 if (!readFileToString(dir + "/" + kFn_keymaster_key_blob, &kmKey)) return false; in deleteKey()
555 static bool recursiveDeleteKey(const std::string& dir) { in recursiveDeleteKey() argument
556 if (ForkExecvp(std::vector<std::string>{kRmPath, "-rf", dir}) != 0) { in recursiveDeleteKey()
563 bool destroyKey(const std::string& dir) { in destroyKey() argument
566 bool uses_km = pathExists(dir + "/" + kFn_keymaster_key_blob); in destroyKey()
568 success &= deleteKey(dir); in destroyKey()
571 kSecdiscardPath, "--", dir + "/" + kFn_encrypted_key, dir + "/" + kFn_secdiscardable, in destroyKey()
574 secdiscard_cmd.emplace_back(dir + "/" + kFn_keymaster_key_blob); in destroyKey()
580 success &= recursiveDeleteKey(dir); in destroyKey()