1 /*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "attest_type.h"
17 #include "attest_utils_log.h"
18 #include "attest_utils_timer.h"
19 #include "attest_service.h"
20 #include "attest_entry.h"
21
AttestTask(void)22 int32_t AttestTask(void)
23 {
24 ATTEST_LOG_INFO("[AttestTask] Begin.");
25 // 执行主流程代码
26 int32_t ret = ProcAttest();
27 if (ret != ATTEST_OK) {
28 ATTEST_LOG_ERROR("[AttestTask] Proc failed ret = %d.", ret);
29 }
30
31 // 创建主流程定时器
32 ret = CreateTimerTask(EXPIRED_INTERVAL, &ProcAttest, ATTEST_TIMER_TYPE_PERIOD);
33 if (ret != ATTEST_OK) {
34 ATTEST_LOG_ERROR("[AttestTask] Create Periodic TimerTask return ret = %d.", ret);
35 }
36 ATTEST_LOG_INFO("[AttestTask] End.");
37 return ret;
38 }
39
QueryAttest(int32_t ** resultArray,int32_t arraySize,char ** ticket,int32_t * ticketLength)40 int32_t QueryAttest(int32_t** resultArray, int32_t arraySize, char** ticket, int32_t* ticketLength)
41 {
42 return QueryAttestStatus(resultArray, arraySize, ticket, ticketLength);
43 }