1 /*
2  * Copyright (c) 2023 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 "hks_test_file_operator.h"
17 
18 #include <dirent.h>
19 #include <errno.h>
20 #include <limits.h>
21 #include <sys/stat.h>
22 #include <unistd.h>
23 
24 #include "hks_param.h"
25 #include "hks_test_log.h"
26 #include "hks_test_mem.h"
27 #include "hks_type.h"
28 
29 #include "securec.h"
30 
31 #define HKS_MAX_FILE_NAME_LEN 512
32 #define REQUIRED_KEY_NOT_AVAILABLE 126
33 
34 int32_t GetFileName(const char *path, const char *fileName, char *fullFileName, uint32_t fullFileNameLen);
35 
36 int32_t IsFileExist(const char *fileName);
37 
38 int32_t FileRead(const char *fileName, uint32_t offset, struct HksBlob *blob, uint32_t *size);
39 
40 uint32_t FileSize(const char *fileName);
41 
42 int32_t FileWrite(const char *fileName, uint32_t offset, const uint8_t *buf, uint32_t len);
43