函数优化

Signed-off-by: dengrenqi <1069093439@qq.com>
This commit is contained in:
dengrenqi 2024-11-11 15:08:49 +08:00
parent 9609e6abb9
commit a0d28b220f
5 changed files with 7 additions and 7 deletions

View File

@ -1142,7 +1142,7 @@ uint32_t BaseKey::GetIdFromDir()
return static_cast<uint32_t>(userId);
}
bool BaseKey::KeyDesclsEmpty()
bool BaseKey::KeyDescIsEmpty()
{
return keyInfo_.keyDesc.IsEmpty();
}

View File

@ -1174,7 +1174,7 @@ bool KeyManager::HasElxDesc(std::map<unsigned int, std::shared_ptr<BaseKey>> &us
auto it = userElKey_.find(user);
if (it != userElKey_.end()) {
auto elKey = it->second;
if (it != userElKey_.end() && !elKey->KeyDesclsEmpty()) {
if (it != userElKey_.end() && !elKey->KeyDescIsEmpty()) {
LOGI("user el%{public}u key desc has existed", type);
return true;
}

View File

@ -70,7 +70,7 @@ public:
bool UpgradeKeys();
bool GetOriginKey(KeyBlob &originKey);
void SetOriginKey(KeyBlob &originKey);
bool KeyDesclsEmpty();
bool KeyDescIsEmpty();
KeyInfo keyInfo_;
std::string GetDir() const

View File

@ -39,7 +39,7 @@ public:
virtual bool GetOriginKey(KeyBlob &originKey) = 0;
virtual bool SaveKeyBlob(const KeyBlob &blob, const std::string &path) = 0;
virtual bool LoadKeyBlob(KeyBlob &blob, const std::string &path, const uint32_t size) = 0;
virtual bool KeyDesclsEmpty() = 0;
virtual bool KeyDescIsEmpty() = 0;
public:
static inline std::shared_ptr<IBaseKeyMoc> baseKeyMoc = nullptr;
};
@ -53,7 +53,7 @@ public:
MOCK_METHOD1(UpdateKey, bool(const std::string &keypath));
MOCK_METHOD1(RestoreKey, bool(const UserAuth &auth));
MOCK_METHOD0(UpgradeKeys, bool());
MOCK_METHOD0(KeyDesclsEmpty, bool());
MOCK_METHOD0(KeyDescIsEmpty, bool());
MOCK_METHOD4(DecryptKeyBlob, bool(const UserAuth &, const std::string &, KeyBlob &, KeyBlob &));
MOCK_METHOD4(EncryptKeyBlob, bool(const UserAuth &, const std::string &, KeyBlob &, KeyBlob &));
MOCK_METHOD1(RenameKeyPath, bool(const std::string &keypath));

View File

@ -110,12 +110,12 @@ bool BaseKey::RenameKeyPath(const std::string &keyPath)
return IBaseKeyMoc::baseKeyMoc->RenameKeyPath(keyPath);
}
bool BaseKey::KeyDesclsEmpty()
bool BaseKey::KeyDescIsEmpty()
{
if (IBaseKeyMoc::baseKeyMoc == nullptr) {
return false;
}
return IBaseKeyMoc::baseKeyMoc->KeyDesclsEmpty();
return IBaseKeyMoc::baseKeyMoc->KeyDescIsEmpty();
}
void BaseKey::ClearMemoryKeyCtx()