]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/TlsLibNull/TlsProcessNull.c
CryptoPkg: Change OPTIONAL keyword usage style
[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
27 IN VOID *Tls\r
28 )\r
29{\r
30 ASSERT(FALSE);\r
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
63 IN VOID *Tls,\r
c8f46130
MK
64 IN UINT8 *BufferIn OPTIONAL,\r
65 IN UINTN BufferInSize OPTIONAL,\r
66 OUT UINT8 *BufferOut OPTIONAL,\r
79cd636f
SB
67 IN OUT UINTN *BufferOutSize\r
68 )\r
69{\r
70 ASSERT(FALSE);\r
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
102 IN VOID *Tls,\r
c8f46130
MK
103 IN UINT8 *BufferIn OPTIONAL,\r
104 IN UINTN BufferInSize OPTIONAL,\r
105 OUT UINT8 *BufferOut OPTIONAL,\r
79cd636f
SB
106 IN OUT UINTN *BufferOutSize\r
107 )\r
108{\r
109 ASSERT(FALSE);\r
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
134 IN VOID *Tls,\r
135 IN OUT UINT8 *Buffer,\r
136 IN OUT UINTN *BufferSize\r
137 )\r
138{\r
139 ASSERT(FALSE);\r
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
160 IN VOID *Tls,\r
161 IN OUT VOID *Buffer,\r
162 IN UINTN BufferSize\r
163 )\r
164{\r
165 ASSERT(FALSE);\r
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
186 IN VOID *Tls,\r
187 IN VOID *Buffer,\r
188 IN UINTN BufferSize\r
189 )\r
190{\r
191 ASSERT(FALSE);\r
192 return 0;\r
193}\r
194/**\r
195 Attempts to read bytes from the specified TLS connection into the buffer.\r
196\r
197 This function tries to read BufferSize bytes data from the specified TLS\r
198 connection into the Buffer.\r
199\r
200 @param[in] Tls Pointer to the TLS connection for data reading.\r
201 @param[in,out] Buffer Pointer to the data buffer.\r
202 @param[in] BufferSize The size of Buffer in bytes.\r
203\r
204 @retval >0 The read operation was successful, and return value is the\r
205 number of bytes actually read from the TLS connection.\r
206 @retval <=0 The read operation was not successful.\r
207\r
208**/\r
209INTN\r
210EFIAPI\r
211TlsRead (\r
212 IN VOID *Tls,\r
213 IN OUT VOID *Buffer,\r
214 IN UINTN BufferSize\r
215 )\r
216{\r
217 ASSERT(FALSE);\r
218 return 0;\r
219}\r
220\r
221/**\r
222 Attempts to write data to a TLS connection.\r
223\r
224 This function tries to write BufferSize bytes data from the Buffer into the\r
225 specified TLS connection.\r
226\r
227 @param[in] Tls Pointer to the TLS connection for data writing.\r
228 @param[in] Buffer Pointer to the data buffer.\r
229 @param[in] BufferSize The size of Buffer in bytes.\r
230\r
231 @retval >0 The write operation was successful, and return value is the\r
232 number of bytes actually written to the TLS connection.\r
233 @retval <=0 The write operation was not successful.\r
234\r
235**/\r
236INTN\r
237EFIAPI\r
238TlsWrite (\r
239 IN VOID *Tls,\r
240 IN VOID *Buffer,\r
241 IN UINTN BufferSize\r
242 )\r
243{\r
244 ASSERT(FALSE);\r
245 return 0;\r
246}\r