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 0000000000000000000000000000000000000000..195e74178eee9169c95b0c25aaf921b158ed7b4a --- /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 0000000000000000000000000000000000000000..9d2a2f7e995fe74116e5d91416d7a631d7aa2946 --- /dev/null +++ b/zh-cn/native_sdk/xts/device_attest/napi_device_attest_type.h @@ -0,0 +1,92 @@ +/* + * 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 +#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