• 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 HITLS_FUNC_H
17 #define HITLS_FUNC_H
18 
19 #include "hitls_config.h"
20 #include "bsl_uio.h"
21 #include "hlt_type.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /**
28 * @brief Hitls initialization
29 */
30 int HitlsInit(void);
31 
32 /**
33 * @brief HiTLS Create connection management resources.
34 */
35 void* HitlsNewCtx(TLS_VERSION tlsVersion);
36 
37 HITLS_Config *HitlsProviderNewCtx(char *providerPath, char (*providerNames)[MAX_PROVIDER_NAME_LEN], int *providerLibFmts,
38     int providerCnt, char *attrName, TLS_VERSION tlsVersion);
39 
40 /**
41 * @brief HiTLS Releases connection management resources.
42 */
43 void HitlsFreeCtx(void *ctx);
44 
45 /**
46 * @brief HiTLS Setting connection information
47 */
48 int HitlsSetCtx(HITLS_Config *config, HLT_Ctx_Config *ctxConfig);
49 
50 /**
51 * @brief HiTLS Creating an SSL resource
52 */
53 void* HitlsNewSsl(void *ctx);
54 
55 /**
56 * @brief HiTLS Releases SSL resources.
57 */
58 void HitlsFreeSsl(void *ssl);
59 
60 /**
61 * @brief HiTLS Set TLS information.
62 */
63 int HitlsSetSsl(void *ssl, HLT_Ssl_Config *sslConfig);
64 
65 /**
66 * @brief HiTLS waits for a TLS connection.
67 */
68 int HitlsAccept(void *ssl);
69 
70 /**
71 * @brief The HiTLS initiates a TLS connection.
72 */
73 int HitlsConnect(void *ssl);
74 
75 /**
76 * @brief HiTLS writes data through the TLS connection.
77 */
78 int HitlsWrite(void *ssl, uint8_t *data, uint32_t dataLen);
79 
80 /**
81 * @brief HiTLS reads data through the TLS connection.
82 */
83 int HitlsRead(void *ssl, uint8_t *data, uint32_t bufSize, uint32_t *readLen);
84 
85 /**
86 * @brief HiTLS Disables the TLS connection.
87 */
88 int HitlsClose(void *ssl);
89 
90 /**
91 * @brief HiTLS supports renegotiation through TLS connection.
92 */
93 int HitlsRenegotiate(void *ssl);
94 
95 int HitlsSetMtu(void *ssl, uint16_t mtu);
96 
97 int HitlsSetSession(void *ssl, void *session);
98 int HitlsSessionReused(void *ssl);
99 void *HitlsGet1Session(void *ssl);
100 int HitlsSessionHasTicket(void *session);
101 int HitlsSessionIsResumable(void *session);
102 void HitlsFreeSession(void *session);
103 int HitlsGetErrorCode(void *ssl);
104 
105 /**
106 * @brief Obtaining method based on the connection type
107 */
108 BSL_UIO_Method *GetDefaultMethod(BSL_UIO_TransportType type);
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif // HITLS_FUNC_H
115