- AuthKeyAsciiStr = AllocateZeroPool (Data->AlgoInfo.EspAlgoInfo.AuthKeyLength + 1);\r
- ASSERT (AuthKeyAsciiStr != NULL);\r
- CopyMem (AuthKeyAsciiStr, Data->AlgoInfo.EspAlgoInfo.AuthKey, Data->AlgoInfo.EspAlgoInfo.AuthKeyLength);\r
- AuthKeyAsciiStr[Data->AlgoInfo.EspAlgoInfo.AuthKeyLength] = '\0';\r
-\r
- EncKeyAsciiStr = AllocateZeroPool (Data->AlgoInfo.EspAlgoInfo.EncKeyLength + 1);\r
- ASSERT (EncKeyAsciiStr != NULL) ;\r
- CopyMem (EncKeyAsciiStr, Data->AlgoInfo.EspAlgoInfo.EncKey, Data->AlgoInfo.EspAlgoInfo.EncKeyLength);\r
- EncKeyAsciiStr[Data->AlgoInfo.EspAlgoInfo.EncKeyLength] = '\0';\r
-\r
- Print (\r
- L" Auth:%s/%a Encrypt:%s/%a\n",\r
- AuthAlgoStr, \r
- AuthKeyAsciiStr,\r
- EncAlgoStr,\r
- EncKeyAsciiStr\r
- );\r
- \r
- FreePool (AuthKeyAsciiStr);\r
- FreePool (EncKeyAsciiStr);\r
+ if (Data->ManualSet) {\r
+ //\r
+ // if the SAD is set manually the key is a Ascii string in most of time.\r
+ // Print the Key in Ascii string format.\r
+ //\r
+ Print (L" Auth:%s/",AuthAlgoStr);\r
+ DumpAsciiString (\r
+ Data->AlgoInfo.EspAlgoInfo.AuthKey, \r
+ Data->AlgoInfo.EspAlgoInfo.AuthKeyLength\r
+ );\r
+ Print (L"\n Encrypt:%s/",EncAlgoStr);\r
+ DumpAsciiString (\r
+ Data->AlgoInfo.EspAlgoInfo.EncKey, \r
+ Data->AlgoInfo.EspAlgoInfo.EncKeyLength\r
+ );\r
+ } else {\r
+ //\r
+ // if the SAD is created by IKE, the key is a set of hex value in buffer.\r
+ // Print the Key in Hex format.\r
+ //\r
+ Print (L" Auth:%s/",AuthAlgoStr);\r
+ DumpBuf ((UINT8 *)(Data->AlgoInfo.EspAlgoInfo.AuthKey), Data->AlgoInfo.EspAlgoInfo.AuthKeyLength);\r
+ \r
+ Print (L"\n Encrypt:%s/",EncAlgoStr);\r
+ DumpBuf ((UINT8 *)(Data->AlgoInfo.EspAlgoInfo.EncKey), Data->AlgoInfo.EspAlgoInfo.EncKeyLength); \r
+ }\r