提交 a4d18673 编写于 作者: L limingkang

update cmdline info for hvb

Signed-off-by: Nlimingkang <limingkang1@huawei.com>
Change-Id: I9710ba13a44ba80b2901fa2c4a75071b46d3f6dd
上级 c65340c8
......@@ -15,6 +15,7 @@
#include "dm_verity.h"
#include "fs_hvb.h"
#include "hvb_cmdline.h"
#include "securec.h"
#include "beget_ext.h"
#include <stdbool.h>
......@@ -25,10 +26,9 @@ extern "C" {
#endif
#endif
#define HVB_VERIFIEDBOOT_STATE_STR_MAX_LEN 32
#define HVB_CMDLINE_VERIFIEDBOOT_STATE "ohos.boot.verifiedbootstate"
#define HVB_VB_STATE_STR_MAX_LEN 32
#define HVB_FORCE_ENABLE_STR_MAX_LEN 16
#define HVB_CMDLINE_HVB_FORCE_ENABLE "ohos.boot.oem_swtype"
#define HVB_CMDLINE_HVB_FORCE_ENABLE "ohos.boot.hvb.oem_swtype"
#define DM_VERITY_RETURN_ERR_IF_NULL(__ptr) \
do { \
......@@ -42,20 +42,21 @@ static bool HvbDmVerityIsEnable()
{
int rc;
char forceEnable[HVB_FORCE_ENABLE_STR_MAX_LEN] = {0};
char verifiedBootState[HVB_VERIFIEDBOOT_STATE_STR_MAX_LEN] = {0};
char vBState[HVB_VB_STATE_STR_MAX_LEN] = {0};
rc = FsHvbGetValueFromCmdLine(&forceEnable[0], sizeof(forceEnable), HVB_CMDLINE_HVB_FORCE_ENABLE);
if (rc == 0 && strcmp(&forceEnable[0], "factory") == 0) {
return true;
}
rc = FsHvbGetValueFromCmdLine(&verifiedBootState[0], sizeof(verifiedBootState), HVB_CMDLINE_VERIFIEDBOOT_STATE);
rc = FsHvbGetValueFromCmdLine(&vBState[0], sizeof(vBState), HVB_CMDLINE_VB_STATE);
if (rc != 0) {
BEGET_LOGE("error 0x%x, get verifed boot state", rc);
return false;
}
if (strcmp(&verifiedBootState[0], "orange") == 0 || strcmp(&verifiedBootState[0], "ORANGE")) {
if (strcmp(&vBState[0], "false") == 0 || strcmp(&vBState[0], "FALSE") == 0) {
return false;
}
......
......@@ -41,8 +41,6 @@ extern "C" {
#define FS_HVB_DEVPATH_MAX_LEN 128
#define FS_HVB_RVT_PARTITION_NAME "rvt"
#define FS_HVB_CMDLINE_PATH "/proc/cmdline"
#define FS_HVB_CMDLINE_HASH_ALG "ohos.boot.hvb.hash_algo"
#define FS_HVB_CMDLINE_CERT_DIGEST "ohos.boot.rvt.digest"
#define FS_HVB_PARTITION_PREFIX "/dev/block/by-name/"
#define FS_HVB_RETURN_ERR_IF_NULL(__ptr) \
......@@ -67,12 +65,12 @@ static char FsHvbHexCharToBin(char hex)
static int FsHvbGetHashStr(char *str, size_t size)
{
return FsHvbGetValueFromCmdLine(str, size, FS_HVB_CMDLINE_HASH_ALG);
return FsHvbGetValueFromCmdLine(str, size, HVB_CMDLINE_HASH_ALG);
}
static int FsHvbGetCertDigstStr(char *str, size_t size)
{
return FsHvbGetValueFromCmdLine(str, size, FS_HVB_CMDLINE_CERT_DIGEST);
return FsHvbGetValueFromCmdLine(str, size, HVB_CMDLINE_CERT_DIGEST);
}
static int FsHvbComputeSha256(char *digest, size_t size, struct hvb_cert_data *certs, uint64_t num_certs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册