From e6fe67847809e046dd8e670d1d69797168b6b0be Mon Sep 17 00:00:00 2001 From: Kemin <541416002@qq.com> Date: Tue, 3 Jan 2023 14:05:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?xts=5Fdevice=5Fattest=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E6=84=8F=E8=A7=81=20Signed-off-by:=20?= =?UTF-8?q?=E7=BD=97=E9=94=AE=E9=93=AD=20<541416002@qq.com>=20ec809b3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xts/device_attest/napi_device_attest.h | 60 ++++++++++++ .../device_attest/napi_device_attest_type.h | 91 +++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 zh-cn/native_sdk/xts/device_attest/napi_device_attest.h create mode 100644 zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h diff --git a/zh-cn/native_sdk/xts/device_attest/napi_device_attest.h b/zh-cn/native_sdk/xts/device_attest/napi_device_attest.h new file mode 100644 index 00000000..f4c8aade --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/napi_device_attest.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup DeviceAttest + * @{ + * + * @brief 提供Device Attest设备证明的相关接口。 + * + * @Syscap SystemCapability.DeviceAttest.Core + * @since 9 + * @version 1.0 + */ + +/** + * @file napi_device_attest.h + * + * @brief Device Attest部件接口定义。 + * + * @since 9 + * @version 1.0 + */ + +#ifndef NAPI_DEVICE_ATTEST_H +#define NAPI_DEVICE_ATTEST_H + +#include "napi_device_attest_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 获取{@link OH_DA_ResultInfo}类型的参数结构体,获取设备认证结果。 + * + * @param attestResultInfo 待获取的设备认证结果的参数结构体。 + * @return 返回接口执行结果。返回0,表示成功;返回其他值,表示失败。 + * @since 9 + * @version 1.0 + */ +int32_t OH_DA_GetAttestStatus(OH_DA_ResultInfo *attestResultInfo); + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NAPI_DEVICE_ATTEST_H \ No newline at end of file diff --git a/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h new file mode 100644 index 00000000..e265a3e6 --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup DeviceAttest + * @{ + * + * @brief 提供Device Attest设备证明的相关接口。 + * + * @Syscap SystemCapability.DeviceAttest.Core + * @since 9 + * @version 1.0 + */ + +/** + * @file napi_device_attest_type.h + * + * @brief Device Attest定义的结构体和枚举值。 + * + * @since 9 + * @version 1.0 + */ + +#ifndef NAPI_DEVICE_ATTEST_TYPE_H +#define NAPI_DEVICE_ATTEST_TYPE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief SoftwareResultDetail类型枚举 + * + * @since 9 + * @version 1.0 + */ +typedef enum { + /** versionIdResult信息 */ + OH_DA_RESULT_VERSIONID = 0, + /** patchLevelResult信息 */ + OH_DA_RESULT_PATCHLEVEL = 1, + /** rootHashResult信息 */ + OH_DA_RESULT_ROOTHASH = 2, + /** pcidResult信息 */ + OH_DA_RESULT_PCID = 3, + /** 预留位信息 */ + OH_DA_RESULT_RESERVE = 4, + /** ResultInfo最大数 */ + OH_DA_RESULT_MAX = 5 +} OH_DA_RESULT_TYPE; + +/** + * @brief Device Attest设备证明结果的参数结构体类型 + * + * @since 9 + * @version 1.0 + */ +typedef struct OH_DA_ResultInfo { + /** 设备硬件信息认证结果 */ + int32_t authResult; + /** 设备软件信息认证结果 */ + int32_t softwareResult; + /** 设备软件信息详细结果 */ + int32_t softwareResultDetail[]; + /** ticket长度 */ + int32_t ticketLength; + /** ticket保存信息 */ + char *ticket; +} OH_DA_ResultInfo; + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NAPI_DEVICE_ATTEST_TYPE_H \ No newline at end of file -- Gitee From c1d9b03266f145d959f5f0d2e0ccd4b7da3509c0 Mon Sep 17 00:00:00 2001 From: Kemin <541416002@qq.com> Date: Tue, 3 Jan 2023 14:05:41 +0800 Subject: [PATCH 2/3] =?UTF-8?q?xts=5Fdevice=5Fattest=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E6=84=8F=E8=A7=81=20Signed-off-by:=20?= =?UTF-8?q?=E7=BD=97=E9=94=AE=E9=93=AD=20<541416002@qq.com>=20ec809b3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xts/device_attest/napi_device_attest.h | 60 ++++++++++++ .../device_attest/napi_device_attest_type.h | 91 +++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 zh-cn/native_sdk/xts/device_attest/napi_device_attest.h create mode 100644 zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h diff --git a/zh-cn/native_sdk/xts/device_attest/napi_device_attest.h b/zh-cn/native_sdk/xts/device_attest/napi_device_attest.h new file mode 100644 index 00000000..360b3bf7 --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/napi_device_attest.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup DeviceAttest + * @{ + * + * @brief 提供Device Attest设备证明的相关接口。 + * + * @Syscap SystemCapability.XTS.DeviceAttest + * @since 9 + * @version 1.0 + */ + +/** + * @file napi_device_attest.h + * + * @brief Device Attest部件接口定义。 + * + * @since 9 + * @version 1.0 + */ + +#ifndef NAPI_DEVICE_ATTEST_H +#define NAPI_DEVICE_ATTEST_H + +#include "napi_device_attest_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 获取{@link OH_DA_ResultInfo}类型的参数结构体,获取设备认证结果。 + * + * @param attestResultInfo 待获取的设备认证结果的参数结构体。 + * @return 返回接口执行结果。返回0,表示成功;返回其他值,表示失败。 + * @since 9 + * @version 1.0 + */ +int32_t OH_DA_GetAttestStatus(OH_DA_ResultInfo *attestResultInfo); + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NAPI_DEVICE_ATTEST_H \ No newline at end of file diff --git a/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h new file mode 100644 index 00000000..c634835d --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup DeviceAttest + * @{ + * + * @brief 提供Device Attest设备证明的相关接口。 + * + * @Syscap SystemCapability.XTS.DeviceAttest + * @since 9 + * @version 1.0 + */ + +/** + * @file napi_device_attest_type.h + * + * @brief Device Attest定义的结构体和枚举值。 + * + * @since 9 + * @version 1.0 + */ + +#ifndef NAPI_DEVICE_ATTEST_TYPE_H +#define NAPI_DEVICE_ATTEST_TYPE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief SoftwareResultDetail类型枚举 + * + * @since 9 + * @version 1.0 + */ +typedef enum { + /** versionIdResult信息 */ + OH_DA_RESULT_VERSIONID = 0, + /** patchLevelResult信息 */ + OH_DA_RESULT_PATCHLEVEL = 1, + /** rootHashResult信息 */ + OH_DA_RESULT_ROOTHASH = 2, + /** pcidResult信息 */ + OH_DA_RESULT_PCID = 3, + /** 预留位信息 */ + OH_DA_RESULT_RESERVE = 4, + /** ResultInfo最大数 */ + OH_DA_RESULT_MAX = 5 +} OH_DA_RESULT_TYPE; + +/** + * @brief Device Attest设备证明结果的参数结构体类型 + * + * @since 9 + * @version 1.0 + */ +typedef struct OH_DA_ResultInfo { + /** 设备硬件信息认证结果 */ + int32_t authResult; + /** 设备软件信息认证结果 */ + int32_t softwareResult; + /** 设备软件信息详细结果 */ + int32_t softwareResultDetail[OH_DA_RESULT_MAX]; + /** ticket长度 */ + int32_t ticketLength; + /** ticket保存信息 */ + char *ticket; +} OH_DA_ResultInfo; + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NAPI_DEVICE_ATTEST_TYPE_H \ No newline at end of file -- Gitee From dbf51027bfff7329a697a54a87a78353afba8465 Mon Sep 17 00:00:00 2001 From: Kemin <541416002@qq.com> Date: Tue, 3 Jan 2023 20:35:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?xts=5Fdevice=5Fattest=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E6=84=8F=E8=A7=81=20Signed-off-by:=20?= =?UTF-8?q?=E7=BD=97=E9=94=AE=E9=93=AD=20<541416002@qq.com>=20ec809b3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h index 187c1dc7..9d2a2f7e 100644 --- a/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h +++ b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h @@ -36,8 +36,9 @@ #ifndef NAPI_DEVICE_ATTEST_TYPE_H #define NAPI_DEVICE_ATTEST_TYPE_H -#include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { -- Gitee