• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef SAL_FILE_H
17 #define SAL_FILE_H
18 
19 #include <stdint.h>
20 
21 #ifdef HITLS_BSL_SAL_FILE
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28  * @ingroup bsl_sal
29  * @brief Reads the specified file into the buff
30  *
31  * Reads the specified file into the buff
32  *
33  * @attention None.
34  * @param path [IN] specified file.
35  * @param buff [OUT] return the read memory.
36  * @param len [OUT] return the read memory len.
37  * @retval if the operation is successful, BSL_SUCCESS is returned, for other errors, see bsl_error.h
38  */
39 int32_t BSL_SAL_ReadFile(const char *path, uint8_t **buff, uint32_t *len);
40 
41 /**
42  * @ingroup bsl_sal
43  * @brief Writes the buff to the specified file
44  *
45  * Writes the buff to the specified file
46  *
47  * @attention None.
48  * @param path [IN] specified file.
49  * @param buff [IN] the write memory.
50  * @param len [IN] the write memory len.
51  * @retval if the operation is successful, BSL_SUCCESS is returned, for other errors, see bsl_error.h
52  */
53 int32_t BSL_SAL_WriteFile(const char *path, const uint8_t *buff, uint32_t len);
54 
55 #ifdef __cplusplus
56 }
57 #endif /* __cplusplus */
58 
59 #endif /* HITLS_BSL_SAL_FILE */
60 
61 #endif // SAL_FILE_H
62