修改升级场景导致的app的el4目录访问异常 -- fix compile error and conflict

Signed-off-by: 宁竞莜 <ningjingyou@huawei.com>
This commit is contained in:
宁竞莜 2024-10-18 21:24:18 +08:00
parent 230ec1f840
commit 2f63ddbf1e
5 changed files with 15 additions and 15 deletions

View File

@ -1097,7 +1097,7 @@ int KeyManager::ActiveCeSceSeceUserKey(unsigned int user,
if (!KeyCtrlHasFscryptSyspara()) {
return 0;
}
if (CheckUserPinProtect(user, token, secret)) {
if (CheckUserPinProtect(user, token, secret) != E_OK) {
LOGE("IAM & Storage mismatch, wait user input pin.");
return -EFAULT;
}
@ -1183,13 +1183,10 @@ int KeyManager::ActiveUeceUserKey(unsigned int user,
userEl5Key_[user] = elKey;
UserAuth auth = { .token = token, .secret = secret };
bool eBufferStatue = false;
if (!elKey->DecryptClassE(auth, saveESecretStatus[user], eBufferStatue, user, USER_UNLOCK) &&
elKey->DecryptClassE({}, saveESecretStatus[user], user, USER_UNLOCK)) {
if (TryToFixUeceKey(user, token, secret) != E_OK) {
LOGE("TryToFixUeceKey el5 failed !");
if (!elKey->DecryptClassE(auth, saveESecretStatus[user], eBufferStatue, user, USER_UNLOCK)) {
LOGE("Unlock user %{public}u E_Class failed", user);
return -EFAULT;
}
}
if (!token.empty() && !secret.empty() && eBufferStatue) {
if (TryToFixUeceKey(user, token, secret) != E_OK) {
@ -1840,7 +1837,7 @@ int KeyManager::TryToFixUserCeEceSeceKey(unsigned int userId,
LOGI("enter TryToFixUserCeEceSeceKey");
keyMutex_.unlock();
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;
}
@ -1874,7 +1871,7 @@ int KeyManager::TryToFixUeceKey(unsigned int userId,
LOGI("enter TryToFixUeceKey");
keyMutex_.unlock();
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;
}
@ -1884,7 +1881,7 @@ int KeyManager::TryToFixUeceKey(unsigned int userId,
LOGE("Pin code is exist, get secure uid.");
}
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) {
LOGE("try to fix elx key failed !");

View File

@ -55,7 +55,8 @@ public:
virtual bool DeleteAppkey(const std::string keyId) = 0;
virtual bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status) = 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 ChangePinCodeClassE(bool &isFbeSupport, uint32_t userId) = 0;
virtual bool LockUece(bool &isFbeSupport) = 0;

View File

@ -42,7 +42,8 @@ public:
bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status = 0);
bool DeleteClassEPinCode(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 LockUece(bool &isFbeSupport);

View File

@ -37,7 +37,8 @@ public:
bool AddClassE(bool &isNeedEncryptClassE, bool &isSupport, uint32_t status = 0);
bool DeleteClassEPinCode(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 GenerateAppkey(uint32_t userId, uint32_t hashId, std::string &keyId);
bool DeleteAppkey(const std::string KeyId);

View File

@ -104,7 +104,7 @@ public:
int GenerateUserKeyByType(unsigned int user, KeyType type,
const std::vector<uint8_t> &token,
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> &secret);
int TryToFixUeceKey(unsigned int userId,
@ -140,7 +140,7 @@ private:
const std::vector<uint8_t> &token,
const std::vector<uint8_t> &secret, std::shared_ptr<BaseKey> elKey);
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);
int InactiveUserElKey(unsigned int user, std::map<unsigned int, std::shared_ptr<BaseKey>> &userElxKey_);
int CheckAndDeleteEmptyEl5Directory(std::string keyDir, unsigned int user);