]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/TlsLibNull/TlsProcessNull.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / TlsLibNull / TlsProcessNull.c
CommitLineData
79cd636f
SB
1/** @file\r
2 SSL/TLS Process Null Library Wrapper Implementation.\r
3 The process includes the TLS handshake and packet I/O.\r
4\r
5Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
6(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
7SPDX-License-Identifier: BSD-2-Clause-Patent\r
8\r
9**/\r
10\r
11#include "InternalTlsLib.h"\r
12\r
13/**\r
14 Checks if the TLS handshake was done.\r
15\r
16 This function will check if the specified TLS handshake was done.\r
17\r
18 @param[in] Tls Pointer to the TLS object for handshake state checking.\r
19\r
20 @retval TRUE The TLS handshake was done.\r
21 @retval FALSE The TLS handshake was not done.\r
22\r
23**/\r
24BOOLEAN\r
25EFIAPI\r
26TlsInHandshake (\r
7c342378 27 IN VOID *Tls\r
79cd636f
SB
28 )\r
29{\r
7c342378 30 ASSERT (FALSE);\r
79cd636f
SB
31 return FALSE;\r
32}\r
33\r
34/**\r
35 Perform a TLS/SSL handshake.\r
36\r
37 This function will perform a TLS/SSL handshake.\r
38\r
39 @param[in] Tls Pointer to the TLS object for handshake operation.\r
40 @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.\r
41 @param[in] BufferInSize Packet size in bytes for the most recently received TLS\r
42 Handshake packet.\r
43 @param[out] BufferOut Pointer to the buffer to hold the built packet.\r
44 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is\r
45 the buffer size provided by the caller. On output, it\r
46 is the buffer size in fact needed to contain the\r
47 packet.\r
48\r
49 @retval EFI_SUCCESS The required TLS packet is built successfully.\r
50 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
51 Tls is NULL.\r
52 BufferIn is NULL but BufferInSize is NOT 0.\r
53 BufferInSize is 0 but BufferIn is NOT NULL.\r
54 BufferOutSize is NULL.\r
55 BufferOut is NULL if *BufferOutSize is not zero.\r
56 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.\r
57 @retval EFI_ABORTED Something wrong during handshake.\r
58\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62TlsDoHandshake (\r
7c342378
MK
63 IN VOID *Tls,\r
64 IN UINT8 *BufferIn OPTIONAL,\r
65 IN UINTN BufferInSize OPTIONAL,\r
66 OUT UINT8 *BufferOut OPTIONAL,\r
67 IN OUT UINTN *BufferOutSize\r
79cd636f
SB
68 )\r
69{\r
7c342378 70 ASSERT (FALSE);\r
79cd636f
SB
71 return EFI_UNSUPPORTED;\r
72}\r
73\r
74/**\r
75 Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,\r
76 TLS session has errors and the response packet needs to be Alert message based on error type.\r
77\r
78 @param[in] Tls Pointer to the TLS object for state checking.\r
79 @param[in] BufferIn Pointer to the most recently received TLS Alert packet.\r
80 @param[in] BufferInSize Packet size in bytes for the most recently received TLS\r
81 Alert packet.\r
82 @param[out] BufferOut Pointer to the buffer to hold the built packet.\r
83 @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is\r
84 the buffer size provided by the caller. On output, it\r
85 is the buffer size in fact needed to contain the\r
86 packet.\r
87\r
88 @retval EFI_SUCCESS The required TLS packet is built successfully.\r
89 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
90 Tls is NULL.\r
91 BufferIn is NULL but BufferInSize is NOT 0.\r
92 BufferInSize is 0 but BufferIn is NOT NULL.\r
93 BufferOutSize is NULL.\r
94 BufferOut is NULL if *BufferOutSize is not zero.\r
95 @retval EFI_ABORTED An error occurred.\r
96 @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.\r
97\r
98**/\r
99EFI_STATUS\r
100EFIAPI\r
101TlsHandleAlert (\r
7c342378
MK
102 IN VOID *Tls,\r
103 IN UINT8 *BufferIn OPTIONAL,\r
104 IN UINTN BufferInSize OPTIONAL,\r
105 OUT UINT8 *BufferOut OPTIONAL,\r
106 IN OUT UINTN *BufferOutSize\r
79cd636f
SB
107 )\r
108{\r
7c342378 109 ASSERT (FALSE);\r
79cd636f
SB
110 return EFI_UNSUPPORTED;\r
111}\r
112\r
113/**\r
114 Build the CloseNotify packet.\r
115\r
116 @param[in] Tls Pointer to the TLS object for state checking.\r
117 @param[in, out] Buffer Pointer to the buffer to hold the built packet.\r
118 @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is\r
119 the buffer size provided by the caller. On output, it\r
120 is the buffer size in fact needed to contain the\r
121 packet.\r
122\r
123 @retval EFI_SUCCESS The required TLS packet is built successfully.\r
124 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
125 Tls is NULL.\r
126 BufferSize is NULL.\r
127 Buffer is NULL if *BufferSize is not zero.\r
128 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.\r
129\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133TlsCloseNotify (\r
7c342378
MK
134 IN VOID *Tls,\r
135 IN OUT UINT8 *Buffer,\r
136 IN OUT UINTN *BufferSize\r
79cd636f
SB
137 )\r
138{\r
7c342378 139 ASSERT (FALSE);\r
79cd636f
SB
140 return EFI_UNSUPPORTED;\r
141}\r
142\r
143/**\r
144 Attempts to read bytes from one TLS object and places the data in Buffer.\r
145\r
146 This function will attempt to read BufferSize bytes from the TLS object\r
147 and places the data in Buffer.\r
148\r
149 @param[in] Tls Pointer to the TLS object.\r
150 @param[in,out] Buffer Pointer to the buffer to store the data.\r
151 @param[in] BufferSize The size of Buffer in bytes.\r
152\r
153 @retval >0 The amount of data successfully read from the TLS object.\r
154 @retval <=0 No data was successfully read.\r
155\r
156**/\r
157INTN\r
158EFIAPI\r
159TlsCtrlTrafficOut (\r
7c342378
MK
160 IN VOID *Tls,\r
161 IN OUT VOID *Buffer,\r
162 IN UINTN BufferSize\r
79cd636f
SB
163 )\r
164{\r
7c342378 165 ASSERT (FALSE);\r
79cd636f
SB
166 return 0;\r
167}\r
168\r
169/**\r
170 Attempts to write data from the buffer to TLS object.\r
171\r
172 This function will attempt to write BufferSize bytes data from the Buffer\r
173 to the TLS object.\r
174\r
175 @param[in] Tls Pointer to the TLS object.\r
176 @param[in] Buffer Pointer to the data buffer.\r
177 @param[in] BufferSize The size of Buffer in bytes.\r
178\r
179 @retval >0 The amount of data successfully written to the TLS object.\r
180 @retval <=0 No data was successfully written.\r
181\r
182**/\r
183INTN\r
184EFIAPI\r
185TlsCtrlTrafficIn (\r
7c342378
MK
186 IN VOID *Tls,\r
187 IN VOID *Buffer,\r
188 IN UINTN BufferSize\r
79cd636f
SB
189 )\r
190{\r
7c342378 191 ASSERT (FALSE);\r
79cd636f
SB
192 return 0;\r
193}\r
7c342378 194\r
79cd636f
SB
195/**\r
196 Attempts to read bytes from the specified TLS connection into the buffer.\r
197\r
198 This function tries to read BufferSize bytes data from the specified TLS\r
199 connection into the Buffer.\r
200\r
201 @param[in] Tls Pointer to the TLS connection for data reading.\r
202 @param[in,out] Buffer Pointer to the data buffer.\r
203 @param[in] BufferSize The size of Buffer in bytes.\r
204\r
205 @retval >0 The read operation was successful, and return value is the\r
206 number of bytes actually read from the TLS connection.\r
207 @retval <=0 The read operation was not successful.\r
208\r
209**/\r
210INTN\r
211EFIAPI\r
212TlsRead (\r
7c342378
MK
213 IN VOID *Tls,\r
214 IN OUT VOID *Buffer,\r
215 IN UINTN BufferSize\r
79cd636f
SB
216 )\r
217{\r
7c342378 218 ASSERT (FALSE);\r
79cd636f
SB
219 return 0;\r
220}\r
221\r
222/**\r
223 Attempts to write data to a TLS connection.\r
224\r
225 This function tries to write BufferSize bytes data from the Buffer into the\r
226 specified TLS connection.\r
227\r
228 @param[in] Tls Pointer to the TLS connection for data writing.\r
229 @param[in] Buffer Pointer to the data buffer.\r
230 @param[in] BufferSize The size of Buffer in bytes.\r
231\r
232 @retval >0 The write operation was successful, and return value is the\r
233 number of bytes actually written to the TLS connection.\r
234 @retval <=0 The write operation was not successful.\r
235\r
236**/\r
237INTN\r
238EFIAPI\r
239TlsWrite (\r
7c342378
MK
240 IN VOID *Tls,\r
241 IN VOID *Buffer,\r
242 IN UINTN BufferSize\r
79cd636f
SB
243 )\r
244{\r
7c342378 245 ASSERT (FALSE);\r
79cd636f
SB
246 return 0;\r
247}\r