Remove unused parameter "salt" from stretchSecret()
stretchSecret() no longer uses the "salt" parameter, so remove it and
simplify callers
Bug: 181910578
Test: Cuttlefish boots.
Change-Id: Ic2d0742b22b98a66da37f435e274c9d385b8e188
diff --git a/KeyStorage.cpp b/KeyStorage.cpp
index 8d518de..05b7eb3 100644
--- a/KeyStorage.cpp
+++ b/KeyStorage.cpp
@@ -415,7 +415,7 @@
}
static bool stretchSecret(const std::string& stretching, const std::string& secret,
- const std::string& salt, std::string* stretched) {
+ std::string* stretched) {
if (stretching == kStretch_nopassword) {
if (!secret.empty()) {
LOG(WARNING) << "Password present but stretching is nopassword";
@@ -432,10 +432,9 @@
}
static bool generateAppId(const KeyAuthentication& auth, const std::string& stretching,
- const std::string& salt, const std::string& secdiscardable_hash,
- std::string* appId) {
+ const std::string& secdiscardable_hash, std::string* appId) {
std::string stretched;
- if (!stretchSecret(stretching, auth.secret, salt, &stretched)) return false;
+ if (!stretchSecret(stretching, auth.secret, &stretched)) return false;
*appId = secdiscardable_hash + stretched;
const std::lock_guard<std::mutex> scope_lock(storage_binding_info.guard);
@@ -570,9 +569,8 @@
if (!createSecdiscardable(dir + "/" + kFn_secdiscardable, &secdiscardable_hash)) return false;
std::string stretching = getStretching(auth);
if (!writeStringToFile(stretching, dir + "/" + kFn_stretching)) return false;
- std::string salt;
std::string appId;
- if (!generateAppId(auth, stretching, salt, secdiscardable_hash, &appId)) return false;
+ if (!generateAppId(auth, stretching, secdiscardable_hash, &appId)) return false;
std::string encryptedKey;
if (auth.usesKeymaster()) {
Keymaster keymaster;
@@ -621,9 +619,8 @@
if (!readSecdiscardable(dir + "/" + kFn_secdiscardable, &secdiscardable_hash)) return false;
std::string stretching;
if (!readFileToString(dir + "/" + kFn_stretching, &stretching)) return false;
- std::string salt;
std::string appId;
- if (!generateAppId(auth, stretching, salt, secdiscardable_hash, &appId)) return false;
+ if (!generateAppId(auth, stretching, secdiscardable_hash, &appId)) return false;
std::string encryptedMessage;
if (!readFileToString(dir + "/" + kFn_encrypted_key, &encryptedMessage)) return false;
if (auth.usesKeymaster()) {