NetworkPkg: Update Ipsecconfig Application to print the keys of SAD in concise way.
[mirror_edk2.git] / NetworkPkg / Application / IpsecConfig / Dump.c
CommitLineData
a3bcde70
HT
1/** @file\r
2 The implementation of dump policy entry function in IpSecConfig application.\r
3\r
22441982 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "IpSecConfig.h"\r
17#include "Dump.h"\r
18#include "ForEach.h"\r
19#include "Helper.h"\r
20\r
21/**\r
22 Private function called to get the version infomation from an EFI_IP_ADDRESS_INFO structure.\r
23\r
24 @param[in] AddressInfo The pointer to the EFI_IP_ADDRESS_INFO structure.\r
25\r
26 @return the value of version.\r
27**/\r
28UINTN\r
29GetVerFromAddrInfo (\r
30 IN EFI_IP_ADDRESS_INFO *AddressInfo\r
31)\r
32{\r
33 if((AddressInfo->PrefixLength <= 32) && (AddressInfo->Address.Addr[1] == 0) &&\r
34 (AddressInfo->Address.Addr[2] == 0) && (AddressInfo->Address.Addr[3] == 0)) {\r
35 return IP_VERSION_4;\r
36 } else {\r
37 return IP_VERSION_6;\r
38 }\r
39}\r
40\r
41/**\r
42 Private function called to get the version information from a EFI_IP_ADDRESS structure.\r
43\r
44 @param[in] Address The pointer to the EFI_IP_ADDRESS structure.\r
45\r
46 @return The value of the version.\r
47**/\r
48UINTN\r
49GetVerFromIpAddr (\r
50 IN EFI_IP_ADDRESS *Address\r
51)\r
52{\r
53 if ((Address->Addr[1] == 0) && (Address->Addr[2] == 0) && (Address->Addr[3] == 0)) {\r
54 return IP_VERSION_4;\r
55 } else {\r
56 return IP_VERSION_6;\r
57 }\r
58}\r
59\r
60/**\r
61 Private function called to print an ASCII string in unicode char format.\r
62\r
63 @param[in] Str The pointer to the ASCII string.\r
64 @param[in] Length The value of the ASCII string length.\r
65**/\r
66VOID\r
67DumpAsciiString (\r
68 IN CHAR8 *Str,\r
69 IN UINTN Length\r
70 )\r
71{\r
72 UINTN Index;\r
22441982 73 Print (L"\"");\r
a3bcde70
HT
74 for (Index = 0; Index < Length; Index++) {\r
75 Print (L"%c", (CHAR16) Str[Index]);\r
76 }\r
22441982 77 Print (L"\"");\r
78}\r
79\r
80/**\r
81 Private function called to print a buffer in Hex format.\r
82\r
83 @param[in] Data The pointer to the buffer.\r
84 @param[in] Length The size of the buffer.\r
85\r
86**/\r
87VOID\r
88DumpBuf (\r
89 IN UINT8 *Data,\r
90 IN UINTN Length\r
91 )\r
92{\r
93 UINTN Index;\r
94 for (Index = 0; Index < Length; Index++) {\r
95 Print (L"%02x ", Data[Index]); \r
96 }\r
a3bcde70
HT
97}\r
98\r
99/**\r
100 Private function called to print EFI_IP_ADDRESS_INFO content.\r
101\r
102 @param[in] AddressInfo The pointer to the EFI_IP_ADDRESS_INFO structure.\r
103**/\r
104VOID\r
105DumpAddressInfo (\r
106 IN EFI_IP_ADDRESS_INFO *AddressInfo\r
107 )\r
108{\r
109 if (IP_VERSION_4 == GetVerFromAddrInfo (AddressInfo)) {\r
110 Print (\r
111 L"%d.%d.%d.%d",\r
112 (UINTN) AddressInfo->Address.v4.Addr[0],\r
113 (UINTN) AddressInfo->Address.v4.Addr[1],\r
114 (UINTN) AddressInfo->Address.v4.Addr[2],\r
115 (UINTN) AddressInfo->Address.v4.Addr[3]\r
116 );\r
117 if (AddressInfo->PrefixLength != 32) {\r
118 Print (L"/%d", (UINTN) AddressInfo->PrefixLength);\r
119 }\r
120 }\r
121\r
122 if (IP_VERSION_6 == GetVerFromAddrInfo (AddressInfo)) {\r
123 Print (\r
124 L"%x:%x:%x:%x:%x:%x:%x:%x",\r
125 (((UINT16) AddressInfo->Address.v6.Addr[0]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[1]),\r
126 (((UINT16) AddressInfo->Address.v6.Addr[2]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[3]),\r
127 (((UINT16) AddressInfo->Address.v6.Addr[4]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[5]),\r
128 (((UINT16) AddressInfo->Address.v6.Addr[6]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[7]),\r
129 (((UINT16) AddressInfo->Address.v6.Addr[8]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[9]),\r
130 (((UINT16) AddressInfo->Address.v6.Addr[10]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[11]),\r
131 (((UINT16) AddressInfo->Address.v6.Addr[12]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[13]),\r
132 (((UINT16) AddressInfo->Address.v6.Addr[14]) << 8) | ((UINT16) AddressInfo->Address.v6.Addr[15])\r
133 );\r
134 if (AddressInfo->PrefixLength != 128) {\r
135 Print (L"/%d", AddressInfo->PrefixLength);\r
136 }\r
137 }\r
138}\r
139\r
140/**\r
141 Private function called to print EFI_IP_ADDRESS content.\r
142\r
143 @param[in] IpAddress The pointer to the EFI_IP_ADDRESS structure.\r
144**/\r
145VOID\r
146DumpIpAddress (\r
147 IN EFI_IP_ADDRESS *IpAddress\r
148 )\r
149{\r
150 if (IP_VERSION_4 == GetVerFromIpAddr (IpAddress)) {\r
151 Print (\r
152 L"%d.%d.%d.%d",\r
153 (UINTN) IpAddress->v4.Addr[0],\r
154 (UINTN) IpAddress->v4.Addr[1],\r
155 (UINTN) IpAddress->v4.Addr[2],\r
156 (UINTN) IpAddress->v4.Addr[3]\r
157 );\r
158 }\r
159\r
160 if (IP_VERSION_6 == GetVerFromIpAddr (IpAddress)) {\r
161 Print (\r
162 L"%x:%x:%x:%x:%x:%x:%x:%x",\r
163 (((UINT16) IpAddress->v6.Addr[0]) << 8) | ((UINT16) IpAddress->v6.Addr[1]),\r
164 (((UINT16) IpAddress->v6.Addr[2]) << 8) | ((UINT16) IpAddress->v6.Addr[3]),\r
165 (((UINT16) IpAddress->v6.Addr[4]) << 8) | ((UINT16) IpAddress->v6.Addr[5]),\r
166 (((UINT16) IpAddress->v6.Addr[6]) << 8) | ((UINT16) IpAddress->v6.Addr[7]),\r
167 (((UINT16) IpAddress->v6.Addr[8]) << 8) | ((UINT16) IpAddress->v6.Addr[9]),\r
168 (((UINT16) IpAddress->v6.Addr[10]) << 8) | ((UINT16) IpAddress->v6.Addr[11]),\r
169 (((UINT16) IpAddress->v6.Addr[12]) << 8) | ((UINT16) IpAddress->v6.Addr[13]),\r
170 (((UINT16) IpAddress->v6.Addr[14]) << 8) | ((UINT16) IpAddress->v6.Addr[15])\r
171 );\r
172 }\r
173\r
174}\r
175\r
176/**\r
177 Private function called to print EFI_IPSEC_SPD_SELECTOR content.\r
178\r
179 @param[in] Selector The pointer to the EFI_IPSEC_SPD_SELECTOR structure.\r
180**/\r
181VOID\r
182DumpSpdSelector (\r
183 IN EFI_IPSEC_SPD_SELECTOR *Selector\r
184 )\r
185{\r
186 UINT32 Index;\r
187 CHAR16 *Str;\r
188\r
189 for (Index = 0; Index < Selector->LocalAddressCount; Index++) {\r
190 if (Index > 0) {\r
191 Print (L",");\r
192 }\r
193\r
194 DumpAddressInfo (&Selector->LocalAddress[Index]);\r
195 }\r
196\r
197 if (Index == 0) {\r
198 Print (L"localhost");\r
199 }\r
200\r
201 Print (L" -> ");\r
202\r
203 for (Index = 0; Index < Selector->RemoteAddressCount; Index++) {\r
204 if (Index > 0) {\r
205 Print (L",");\r
206 }\r
207\r
208 DumpAddressInfo (&Selector->RemoteAddress[Index]);\r
209 }\r
210\r
211 Str = MapIntegerToString (Selector->NextLayerProtocol, mMapIpProtocol);\r
212 if (Str != NULL) {\r
213 Print (L" %s", Str);\r
214 } else {\r
215 Print (L" proto:%d", (UINTN) Selector->NextLayerProtocol);\r
216 }\r
217\r
218 if ((Selector->NextLayerProtocol == EFI_IP4_PROTO_TCP) || (Selector->NextLayerProtocol == EFI_IP4_PROTO_UDP)) {\r
219 Print (L" port:");\r
220 if (Selector->LocalPort != EFI_IPSEC_ANY_PORT) {\r
221 Print (L"%d", Selector->LocalPort);\r
222 if (Selector->LocalPortRange != 0) {\r
223 Print (L"~%d", (UINTN) Selector->LocalPort + Selector->LocalPortRange);\r
224 }\r
225 } else {\r
226 Print (L"any");\r
227 }\r
228\r
229 Print (L" -> ");\r
230 if (Selector->RemotePort != EFI_IPSEC_ANY_PORT) {\r
231 Print (L"%d", Selector->RemotePort);\r
232 if (Selector->RemotePortRange != 0) {\r
233 Print (L"~%d", (UINTN) Selector->RemotePort + Selector->RemotePortRange);\r
234 }\r
235 } else {\r
236 Print (L"any");\r
237 }\r
238 } else if (Selector->NextLayerProtocol == EFI_IP4_PROTO_ICMP) {\r
239 Print (L" class/code:");\r
240 if (Selector->LocalPort != 0) {\r
241 Print (L"%d", (UINTN) (UINT8) Selector->LocalPort);\r
242 } else {\r
243 Print (L"any");\r
244 }\r
245\r
246 Print (L"/");\r
247 if (Selector->RemotePort != 0) {\r
248 Print (L"%d", (UINTN) (UINT8) Selector->RemotePort);\r
249 } else {\r
250 Print (L"any");\r
251 }\r
252 }\r
253}\r
254\r
255/**\r
256 Print EFI_IPSEC_SPD_SELECTOR and EFI_IPSEC_SPD_DATA content.\r
257\r
258 @param[in] Selector The pointer to the EFI_IPSEC_SPD_SELECTOR structure.\r
259 @param[in] Data The pointer to the EFI_IPSEC_SPD_DATA structure.\r
260 @param[in] EntryIndex The pointer to the Index in SPD Database.\r
261\r
262 @retval EFI_SUCCESS Dump SPD information successfully.\r
263**/\r
264EFI_STATUS\r
265DumpSpdEntry (\r
266 IN EFI_IPSEC_SPD_SELECTOR *Selector,\r
267 IN EFI_IPSEC_SPD_DATA *Data,\r
268 IN UINTN *EntryIndex\r
269 )\r
270{\r
271 BOOLEAN HasPre;\r
272 CHAR16 DataName[128];\r
273 CHAR16 *String1;\r
274 CHAR16 *String2;\r
275 CHAR16 *String3;\r
276 UINT8 Index;\r
277\r
278 Print (L"%d.", (*EntryIndex)++);\r
279\r
280 //\r
281 // xxx.xxx.xxx.xxx/yy -> xxx.xxx.xxx.xx/yy proto:23 port:100~300 -> 300~400\r
282 // Protect PF:0x34323423 Name:First Entry\r
283 // ext-sequence sequence-overflow fragcheck life:[B0,S1024,H3600]\r
284 // ESP algo1 algo2 Tunnel [xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx set]\r
285 //\r
286\r
287 DumpSpdSelector (Selector);\r
288 Print (L"\n ");\r
289\r
290 Print (L"%s ", MapIntegerToString (Data->Action, mMapIpSecAction));\r
291 Print (L"PF:%08x ", Data->PackageFlag);\r
292\r
293 Index = 0;\r
294 while (Data->Name[Index] != 0) {\r
295 DataName[Index] = (CHAR16) Data->Name[Index];\r
296 Index++;\r
297 ASSERT (Index < 128);\r
298 }\r
299 DataName[Index] = L'\0';\r
300\r
301 Print (L"Name:%s", DataName);\r
302\r
303 if (Data->Action == EfiIPsecActionProtect) {\r
304 Print (L"\n ");\r
305 if (Data->ProcessingPolicy->ExtSeqNum) {\r
306 Print (L"ext-sequence ");\r
307 }\r
308\r
309 if (Data->ProcessingPolicy->SeqOverflow) {\r
310 Print (L"sequence-overflow ");\r
311 }\r
312\r
313 if (Data->ProcessingPolicy->FragCheck) {\r
314 Print (L"fragment-check ");\r
315 }\r
316\r
317 HasPre = FALSE;\r
318 if (Data->ProcessingPolicy->SaLifetime.ByteCount != 0) {\r
319 Print (HasPre ? L"," : L"life:[");\r
320 Print (L"%lxB", Data->ProcessingPolicy->SaLifetime.ByteCount);\r
321 HasPre = TRUE;\r
322 }\r
323\r
324 if (Data->ProcessingPolicy->SaLifetime.SoftLifetime != 0) {\r
325 Print (HasPre ? L"," : L"life:[");\r
326 Print (L"%lxs", Data->ProcessingPolicy->SaLifetime.SoftLifetime);\r
327 HasPre = TRUE;\r
328 }\r
329\r
330 if (Data->ProcessingPolicy->SaLifetime.HardLifetime != 0) {\r
331 Print (HasPre ? L"," : L"life:[");\r
332 Print (L"%lxS", Data->ProcessingPolicy->SaLifetime.HardLifetime);\r
333 HasPre = TRUE;\r
334 }\r
335\r
336 if (HasPre) {\r
337 Print (L"]");\r
338 }\r
339\r
340 if (HasPre || Data->ProcessingPolicy->ExtSeqNum ||\r
341 Data->ProcessingPolicy->SeqOverflow || Data->ProcessingPolicy->FragCheck) {\r
342 Print (L"\n ");\r
343 }\r
344\r
345 String1 = MapIntegerToString (Data->ProcessingPolicy->Proto, mMapIpSecProtocol);\r
346 String2 = MapIntegerToString (Data->ProcessingPolicy->AuthAlgoId, mMapAuthAlgo);\r
347 String3 = MapIntegerToString (Data->ProcessingPolicy->EncAlgoId, mMapEncAlgo);\r
348 Print (\r
349 L"%s Auth:%s Encrypt:%s ",\r
350 String1,\r
351 String2,\r
352 String3\r
353 );\r
354\r
355 Print (L"%s ", MapIntegerToString (Data->ProcessingPolicy->Mode, mMapIpSecMode));\r
356 if (Data->ProcessingPolicy->Mode == EfiIPsecTunnel) {\r
357 Print (L"[");\r
358 DumpIpAddress (&Data->ProcessingPolicy->TunnelOption->LocalTunnelAddress);\r
359 Print (L" -> ");\r
360 DumpIpAddress (&Data->ProcessingPolicy->TunnelOption->RemoteTunnelAddress);\r
361 Print (L" %s]", MapIntegerToString (Data->ProcessingPolicy->TunnelOption->DF, mMapDfOption));\r
362 }\r
363 }\r
364\r
365 Print (L"\n");\r
366\r
367 return EFI_SUCCESS;\r
368}\r
369\r
370/**\r
64b2d0e5 371 Print EFI_IPSEC_SA_ID and EFI_IPSEC_SA_DATA2 content.\r
a3bcde70
HT
372\r
373 @param[in] SaId The pointer to the EFI_IPSEC_SA_ID structure.\r
64b2d0e5 374 @param[in] Data The pointer to the EFI_IPSEC_SA_DATA2 structure.\r
a3bcde70
HT
375 @param[in] EntryIndex The pointer to the Index in the SAD Database.\r
376\r
377 @retval EFI_SUCCESS Dump SAD information successfully.\r
378**/\r
379EFI_STATUS\r
380DumpSadEntry (\r
381 IN EFI_IPSEC_SA_ID *SaId,\r
64b2d0e5 382 IN EFI_IPSEC_SA_DATA2 *Data,\r
a3bcde70
HT
383 IN UINTN *EntryIndex\r
384 )\r
385{\r
386 BOOLEAN HasPre;\r
64b2d0e5 387 CHAR16 *AuthAlgoStr;\r
388 CHAR16 *EncAlgoStr;\r
64b2d0e5 389\r
390 AuthAlgoStr = NULL;\r
391 EncAlgoStr = NULL;\r
a3bcde70
HT
392\r
393 //\r
394 // SPI:1234 ESP Destination:xxx.xxx.xxx.xxx\r
395 // Mode:Transport SeqNum:134 AntiReplayWin:64 life:[0B,1023s,3400S] PathMTU:34\r
396 // Auth:xxxx/password Encrypt:yyyy/password\r
397 // xxx.xxx.xxx.xxx/yy -> xxx.xxx.xxx.xx/yy proto:23 port:100~300 -> 300~400\r
398 //\r
399\r
400 Print (L"%d.", (*EntryIndex)++);\r
401 Print (L"0x%x %s ", (UINTN) SaId->Spi, MapIntegerToString (SaId->Proto, mMapIpSecProtocol));\r
64b2d0e5 402 if (Data->Mode == EfiIPsecTunnel) {\r
403 Print (L"TunnelSourceAddress:");\r
404 DumpIpAddress (&Data->TunnelSourceAddress);\r
405 Print (L"\n");\r
22441982 406 Print (L" TunnelDestination:");\r
64b2d0e5 407 DumpIpAddress (&Data->TunnelDestinationAddress);\r
408 Print (L"\n");\r
409 }\r
a3bcde70
HT
410\r
411 Print (\r
412 L" Mode:%s SeqNum:%lx AntiReplayWin:%d ",\r
413 MapIntegerToString (Data->Mode, mMapIpSecMode),\r
414 Data->SNCount,\r
415 (UINTN) Data->AntiReplayWindows\r
416 );\r
417\r
418 HasPre = FALSE;\r
419 if (Data->SaLifetime.ByteCount != 0) {\r
420 Print (HasPre ? L"," : L"life:[");\r
421 Print (L"%lxB", Data->SaLifetime.ByteCount);\r
422 HasPre = TRUE;\r
423 }\r
424\r
425 if (Data->SaLifetime.SoftLifetime != 0) {\r
426 Print (HasPre ? L"," : L"life:[");\r
427 Print (L"%lxs", Data->SaLifetime.SoftLifetime);\r
428 HasPre = TRUE;\r
429 }\r
430\r
431 if (Data->SaLifetime.HardLifetime != 0) {\r
432 Print (HasPre ? L"," : L"life:[");\r
433 Print (L"%lxS", Data->SaLifetime.HardLifetime);\r
434 HasPre = TRUE;\r
435 }\r
436\r
437 if (HasPre) {\r
438 Print (L"] ");\r
439 }\r
440\r
441 Print (L"PathMTU:%d\n", (UINTN) Data->PathMTU);\r
442\r
443 if (SaId->Proto == EfiIPsecAH) {\r
444 Print (\r
445 L" Auth:%s/%s\n",\r
446 MapIntegerToString (Data->AlgoInfo.AhAlgoInfo.AuthAlgoId, mMapAuthAlgo),\r
447 Data->AlgoInfo.AhAlgoInfo.AuthKey\r
448 );\r
449 } else {\r
64b2d0e5 450 AuthAlgoStr = MapIntegerToString (Data->AlgoInfo.EspAlgoInfo.AuthAlgoId, mMapAuthAlgo);\r
451 EncAlgoStr = MapIntegerToString (Data->AlgoInfo.EspAlgoInfo.EncAlgoId, mMapEncAlgo);\r
452\r
22441982 453 if (Data->ManualSet) {\r
454 //\r
455 // if the SAD is set manually the key is a Ascii string in most of time.\r
456 // Print the Key in Ascii string format.\r
457 //\r
458 Print (L" Auth:%s/",AuthAlgoStr);\r
459 DumpAsciiString (\r
460 Data->AlgoInfo.EspAlgoInfo.AuthKey, \r
461 Data->AlgoInfo.EspAlgoInfo.AuthKeyLength\r
462 );\r
463 Print (L"\n Encrypt:%s/",EncAlgoStr);\r
464 DumpAsciiString (\r
465 Data->AlgoInfo.EspAlgoInfo.EncKey, \r
466 Data->AlgoInfo.EspAlgoInfo.EncKeyLength\r
467 );\r
468 } else {\r
469 //\r
470 // if the SAD is created by IKE, the key is a set of hex value in buffer.\r
471 // Print the Key in Hex format.\r
472 //\r
473 Print (L" Auth:%s/",AuthAlgoStr);\r
474 DumpBuf ((UINT8 *)(Data->AlgoInfo.EspAlgoInfo.AuthKey), Data->AlgoInfo.EspAlgoInfo.AuthKeyLength);\r
475 \r
476 Print (L"\n Encrypt:%s/",EncAlgoStr);\r
477 DumpBuf ((UINT8 *)(Data->AlgoInfo.EspAlgoInfo.EncKey), Data->AlgoInfo.EspAlgoInfo.EncKeyLength); \r
478 }\r
a3bcde70 479 }\r
a3bcde70 480 if (Data->SpdSelector != NULL) {\r
22441982 481 Print (L"\n ");\r
a3bcde70
HT
482 DumpSpdSelector (Data->SpdSelector);\r
483 Print (L"\n");\r
484 }\r
485\r
486 return EFI_SUCCESS;\r
487}\r
488\r
489/**\r
490 Print EFI_IPSEC_PAD_ID and EFI_IPSEC_PAD_DATA content.\r
491\r
492 @param[in] PadId The pointer to the EFI_IPSEC_PAD_ID structure.\r
493 @param[in] Data The pointer to the EFI_IPSEC_PAD_DATA structure.\r
494 @param[in] EntryIndex The pointer to the Index in the PAD Database.\r
495\r
496 @retval EFI_SUCCESS Dump PAD information successfully.\r
497**/\r
498EFI_STATUS\r
499DumpPadEntry (\r
500 IN EFI_IPSEC_PAD_ID *PadId,\r
501 IN EFI_IPSEC_PAD_DATA *Data,\r
502 IN UINTN *EntryIndex\r
503 )\r
504{\r
505 CHAR16 *String1;\r
506 CHAR16 *String2;\r
507\r
508 //\r
509 // ADDR:10.23.17.34/15\r
510 // IDEv1 PreSharedSecret IKE-ID\r
511 // password\r
512 //\r
513\r
514 Print (L"%d.", (*EntryIndex)++);\r
515\r
516 if (PadId->PeerIdValid) {\r
517 Print (L"ID:%s", PadId->Id.PeerId);\r
518 } else {\r
519 Print (L"ADDR:");\r
520 DumpAddressInfo (&PadId->Id.IpAddress);\r
521 }\r
522\r
523 Print (L"\n");\r
524\r
525 String1 = MapIntegerToString (Data->AuthProtocol, mMapAuthProto);\r
526 String2 = MapIntegerToString (Data->AuthMethod, mMapAuthMethod);\r
527 Print (\r
528 L" %s %s",\r
529 String1,\r
530 String2\r
531 );\r
532\r
533 if (Data->IkeIdFlag) {\r
534 Print (L"IKE-ID");\r
535 }\r
536\r
537 Print (L"\n");\r
538\r
539 if (Data->AuthData != NULL) {\r
540 DumpAsciiString (Data->AuthData, Data->AuthDataSize);\r
541 Print (L"\n");\r
542 }\r
543\r
544 if (Data->RevocationData != NULL) {\r
545 Print (L" %s\n", Data->RevocationData);\r
546 }\r
547\r
548 return EFI_SUCCESS;\r
549\r
550}\r
551\r
552VISIT_POLICY_ENTRY mDumpPolicyEntry[] = {\r
553 (VISIT_POLICY_ENTRY) DumpSpdEntry,\r
554 (VISIT_POLICY_ENTRY) DumpSadEntry,\r
555 (VISIT_POLICY_ENTRY) DumpPadEntry\r
556};\r
557\r
558/**\r
559 Print all entry information in the database according to datatype.\r
560\r
561 @param[in] DataType The value of EFI_IPSEC_CONFIG_DATA_TYPE.\r
562 @param[in] ParamPackage The pointer to the ParamPackage list.\r
563\r
564 @retval EFI_SUCCESS Dump all information successfully.\r
565 @retval Others Some mistaken case.\r
566**/\r
567EFI_STATUS\r
568ListPolicyEntry (\r
569 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,\r
570 IN LIST_ENTRY *ParamPackage\r
571 )\r
572{\r
573 UINTN EntryIndex;\r
574\r
575 EntryIndex = 0;\r
576 return ForeachPolicyEntry (DataType, mDumpPolicyEntry[DataType], &EntryIndex);\r
577}\r
578\r