!1494 【StorageService】升级场景C类失败后直接等待PIN

Merge pull request !1494 from 洪圣铨/master
This commit is contained in:
openharmony_ci 2024-11-12 13:27:50 +00:00 committed by Gitee
commit 4f15ef8ee0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 7 additions and 2 deletions

View File

@ -63,6 +63,7 @@ enum ErrNo {
E_MTP_PREPARE_DIR_ERR,
E_MTP_MOUNT_FAILED,
E_MTP_UMOUNT_FAILED,
E_MIGRETE_ELX_FAILED,
};
enum JsErrCode {

View File

@ -263,7 +263,7 @@ int32_t StorageDaemon::RestoreOneUserKey(int32_t userId, KeyType type)
if (type != EL1_KEY) {
LOGE("userId %{public}u type %{public}u restore key failed, but return success, error = %{public}d",
userId, type, ret);
return E_OK; // maybe need user key, so return E_OK to continue
return E_MIGRETE_ELX_FAILED; // maybe need user key, so return E_OK to continue
}
LOGE("RestoreUserKey EL1_KEY failed, error = %{public}d, userId %{public}u", ret, userId);
return ret;
@ -301,6 +301,10 @@ int32_t StorageDaemon::RestoreUserKey(int32_t userId, uint32_t flags)
std::vector<KeyType> keyTypes = {EL1_KEY, EL2_KEY, EL3_KEY, EL4_KEY, EL5_KEY};
for (KeyType type : keyTypes) {
auto ret = RestoreOneUserKey(userId, type);
if (ret == E_MIGRETE_ELX_FAILED) {
LOGE("Try restore user: %{public}d type: %{public}d migrate key, wait user pin !", userId, type);
break;
}
if (ret != E_OK) {
return ret;
}

View File

@ -239,5 +239,5 @@ uint8_t KeyCtrlLoadVersion(const char *keyPath)
}
LOGE("bad version content. buf = %s", buf);
free(buf);
return FSCRYPT_INVALID;
return FSCRYPT_V1;
}