mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 15:09:48 +00:00
修改升级场景导致的app的el4目录访问异常 -- fix compile error and conflict
Signed-off-by: 宁竞莜 <ningjingyou@huawei.com>
This commit is contained in:
parent
230ec1f840
commit
2f63ddbf1e
@ -1097,7 +1097,7 @@ int KeyManager::ActiveCeSceSeceUserKey(unsigned int user,
|
|||||||
if (!KeyCtrlHasFscryptSyspara()) {
|
if (!KeyCtrlHasFscryptSyspara()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (CheckUserPinProtect(user, token, secret)) {
|
if (CheckUserPinProtect(user, token, secret) != E_OK) {
|
||||||
LOGE("IAM & Storage mismatch, wait user input pin.");
|
LOGE("IAM & Storage mismatch, wait user input pin.");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
@ -1183,12 +1183,9 @@ int KeyManager::ActiveUeceUserKey(unsigned int user,
|
|||||||
userEl5Key_[user] = elKey;
|
userEl5Key_[user] = elKey;
|
||||||
UserAuth auth = { .token = token, .secret = secret };
|
UserAuth auth = { .token = token, .secret = secret };
|
||||||
bool eBufferStatue = false;
|
bool eBufferStatue = false;
|
||||||
if (!elKey->DecryptClassE(auth, saveESecretStatus[user], eBufferStatue, user, USER_UNLOCK) &&
|
if (!elKey->DecryptClassE(auth, saveESecretStatus[user], eBufferStatue, user, USER_UNLOCK)) {
|
||||||
elKey->DecryptClassE({}, saveESecretStatus[user], user, USER_UNLOCK)) {
|
LOGE("Unlock user %{public}u E_Class failed", user);
|
||||||
if (TryToFixUeceKey(user, token, secret) != E_OK) {
|
return -EFAULT;
|
||||||
LOGE("TryToFixUeceKey el5 failed !");
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!token.empty() && !secret.empty() && eBufferStatue) {
|
if (!token.empty() && !secret.empty() && eBufferStatue) {
|
||||||
@ -1840,7 +1837,7 @@ int KeyManager::TryToFixUserCeEceSeceKey(unsigned int userId,
|
|||||||
LOGI("enter TryToFixUserCeEceSeceKey");
|
LOGI("enter TryToFixUserCeEceSeceKey");
|
||||||
keyMutex_.unlock();
|
keyMutex_.unlock();
|
||||||
if (!IamClient::GetInstance().HasPinProtect(userId)) {
|
if (!IamClient::GetInstance().HasPinProtect(userId)) {
|
||||||
LOGE("User %{public}d has pin code protect.", userId);
|
LOGE("User %{public}d has no pin code protect.", userId);
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1874,7 +1871,7 @@ int KeyManager::TryToFixUeceKey(unsigned int userId,
|
|||||||
LOGI("enter TryToFixUeceKey");
|
LOGI("enter TryToFixUeceKey");
|
||||||
keyMutex_.unlock();
|
keyMutex_.unlock();
|
||||||
if (!IamClient::GetInstance().HasPinProtect(userId)) {
|
if (!IamClient::GetInstance().HasPinProtect(userId)) {
|
||||||
LOGE("User %{public}d has pin code protect.", userId);
|
LOGE("User %{public}d has no pin code protect.", userId);
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1884,7 +1881,7 @@ int KeyManager::TryToFixUeceKey(unsigned int userId,
|
|||||||
LOGE("Pin code is exist, get secure uid.");
|
LOGE("Pin code is exist, get secure uid.");
|
||||||
}
|
}
|
||||||
UserAuth auth = { .token=token, .secret=secret, .secureUid = secureUid };
|
UserAuth auth = { .token=token, .secret=secret, .secureUid = secureUid };
|
||||||
UserTokenSecret tokenSecret = { .token = token, .oldSecret = {'!'}, .newSecret = secret, .secureUid = secureUid};
|
UserTokenSecret tokenSecret = { .token = token, .oldSecret = { }, .newSecret = secret, .secureUid = secureUid};
|
||||||
|
|
||||||
if (UpdateESecret(userId, tokenSecret) != E_OK) {
|
if (UpdateESecret(userId, tokenSecret) != E_OK) {
|
||||||
LOGE("try to fix elx key failed !");
|
LOGE("try to fix elx key failed !");
|
||||||
|
@ -55,7 +55,8 @@ public:
|
|||||||
virtual bool DeleteAppkey(const std::string keyId) = 0;
|
virtual bool DeleteAppkey(const std::string keyId) = 0;
|
||||||
virtual bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status) = 0;
|
virtual bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status) = 0;
|
||||||
virtual bool DeleteClassEPinCode(uint32_t userId) = 0;
|
virtual bool DeleteClassEPinCode(uint32_t userId) = 0;
|
||||||
virtual bool DecryptClassE(const UserAuth &auth, bool &isSupport, bool &eBufferStatue, uint32_t user, uint32_t status) = 0;
|
virtual bool DecryptClassE(const UserAuth &auth, bool &isSupport, bool &eBufferStatue, uint32_t user,
|
||||||
|
uint32_t status) = 0;
|
||||||
virtual bool EncryptClassE(const UserAuth &auth, bool &isSupport, uint32_t user, uint32_t status) = 0;
|
virtual bool EncryptClassE(const UserAuth &auth, bool &isSupport, uint32_t user, uint32_t status) = 0;
|
||||||
virtual bool ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId) = 0;
|
virtual bool ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId) = 0;
|
||||||
virtual bool LockUece(bool &isFbeSupport) = 0;
|
virtual bool LockUece(bool &isFbeSupport) = 0;
|
||||||
|
@ -42,7 +42,8 @@ public:
|
|||||||
bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status = 0);
|
bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status = 0);
|
||||||
bool DeleteClassEPinCode(uint32_t userId = 0);
|
bool DeleteClassEPinCode(uint32_t userId = 0);
|
||||||
bool ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId = 0);
|
bool ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId = 0);
|
||||||
bool DecryptClassE(const UserAuth &auth, bool &isSupport, bool &eBufferStatue, uint32_t user = 0, uint32_t status = 0);
|
bool DecryptClassE(const UserAuth &auth, bool &isSupport, bool &eBufferStatue, uint32_t user = 0,
|
||||||
|
uint32_t status = 0);
|
||||||
bool EncryptClassE(const UserAuth &auth, bool &isSupport, uint32_t user = 0, uint32_t status = 0);
|
bool EncryptClassE(const UserAuth &auth, bool &isSupport, uint32_t user = 0, uint32_t status = 0);
|
||||||
bool LockUece(bool &isFbeSupport);
|
bool LockUece(bool &isFbeSupport);
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ public:
|
|||||||
bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status = 0);
|
bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status = 0);
|
||||||
bool DeleteClassEPinCode(uint32_t userId = 0);
|
bool DeleteClassEPinCode(uint32_t userId = 0);
|
||||||
bool ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId = 0);
|
bool ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId = 0);
|
||||||
bool DecryptClassE(const UserAuth &auth, bool &isSupport, bool &eBufferStatue, uint32_t user = 0, uint32_t status = 0);
|
bool DecryptClassE(const UserAuth &auth, bool &isSupport, bool &eBufferStatue, uint32_t user = 0,
|
||||||
|
uint32_t status = 0);
|
||||||
bool EncryptClassE(const UserAuth &auth, bool &isSupport, uint32_t user = 0, uint32_t status = 0);
|
bool EncryptClassE(const UserAuth &auth, bool &isSupport, uint32_t user = 0, uint32_t status = 0);
|
||||||
bool GenerateAppkey(uint32_t userId, uint32_t hashId, std::string &keyId);
|
bool GenerateAppkey(uint32_t userId, uint32_t hashId, std::string &keyId);
|
||||||
bool DeleteAppkey(const std::string KeyId);
|
bool DeleteAppkey(const std::string KeyId);
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
int GenerateUserKeyByType(unsigned int user, KeyType type,
|
int GenerateUserKeyByType(unsigned int user, KeyType type,
|
||||||
const std::vector<uint8_t> &token,
|
const std::vector<uint8_t> &token,
|
||||||
const std::vector<uint8_t> &secret);
|
const std::vector<uint8_t> &secret);
|
||||||
int TryToFixUserCeEceSeceKey(unsigned int user, KeyType type,
|
int TryToFixUserCeEceSeceKey(unsigned int userId, KeyType type,
|
||||||
const std::vector<uint8_t> &token,
|
const std::vector<uint8_t> &token,
|
||||||
const std::vector<uint8_t> &secret);
|
const std::vector<uint8_t> &secret);
|
||||||
int TryToFixUeceKey(unsigned int userId,
|
int TryToFixUeceKey(unsigned int userId,
|
||||||
@ -140,7 +140,7 @@ private:
|
|||||||
const std::vector<uint8_t> &token,
|
const std::vector<uint8_t> &token,
|
||||||
const std::vector<uint8_t> &secret, std::shared_ptr<BaseKey> elKey);
|
const std::vector<uint8_t> &secret, std::shared_ptr<BaseKey> elKey);
|
||||||
int ActiveElXUserKey(unsigned int user,
|
int ActiveElXUserKey(unsigned int user,
|
||||||
const std::vector<uint8_t> &token, KeyType keyTpype,
|
const std::vector<uint8_t> &token, KeyType keyType,
|
||||||
const std::vector<uint8_t> &secret, std::shared_ptr<BaseKey> elKey);
|
const std::vector<uint8_t> &secret, std::shared_ptr<BaseKey> elKey);
|
||||||
int InactiveUserElKey(unsigned int user, std::map<unsigned int, std::shared_ptr<BaseKey>> &userElxKey_);
|
int InactiveUserElKey(unsigned int user, std::map<unsigned int, std::shared_ptr<BaseKey>> &userElxKey_);
|
||||||
int CheckAndDeleteEmptyEl5Directory(std::string keyDir, unsigned int user);
|
int CheckAndDeleteEmptyEl5Directory(std::string keyDir, unsigned int user);
|
||||||
|
Loading…
Reference in New Issue
Block a user