return FALSE;\r
}\r
\r
-STATIC\r
-CHAR16\r
-NibbleToHexChar (\r
- IN UINT8 Nibble\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Converts the low nibble of a byte to hex unicode character.\r
-\r
- Arguments:\r
- Nibble - lower nibble of a byte.\r
-\r
- Returns:\r
- Hex unicode character.\r
-\r
---*/\r
-{\r
- Nibble &= 0x0F;\r
- if (Nibble <= 0x9) {\r
- return (CHAR16)(Nibble + L'0');\r
- }\r
-\r
- return (CHAR16)(Nibble - 0xA + L'A');\r
-}\r
-\r
STATIC\r
EFI_STATUS\r
HexStringToBuf (\r
return EFI_SUCCESS;\r
}\r
\r
-STATIC\r
-EFI_STATUS\r
-BufToHexString (\r
- IN OUT CHAR16 *Str,\r
- IN OUT UINTN *HexStringBufferLength,\r
- IN UINT8 *Buf,\r
- IN UINTN Len\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Converts binary buffer to Unicode string.\r
- At a minimum, any blob of data could be represented as a hex string.\r
-\r
- Arguments:\r
- Str - Pointer to the string.\r
- HexStringBufferLength - Length in bytes of buffer to hold the hex string. Includes tailing '\0' character.\r
- If routine return with EFI_SUCCESS, containing length of hex string buffer.\r
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string buffer desired.\r
- Buf - Buffer to be converted from.\r
- Len - Length in bytes of the buffer to be converted.\r
-\r
- Returns:\r
- EFI_SUCCESS: Routine success.\r
- EFI_BUFFER_TOO_SMALL: The hex string buffer is too small.\r
-\r
---*/\r
-{\r
- UINTN Idx;\r
- UINT8 Byte;\r
- UINTN StrLen;\r
-\r
- //\r
- // Make sure string is either passed or allocate enough.\r
- // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.\r
- // Plus the Unicode termination character.\r
- //\r
- StrLen = Len * 2;\r
- if (StrLen > ((*HexStringBufferLength) - 1)) {\r
- *HexStringBufferLength = StrLen + 1;\r
- return EFI_BUFFER_TOO_SMALL;\r
- }\r
-\r
- *HexStringBufferLength = StrLen + 1;\r
- //\r
- // Ends the string.\r
- //\r
- Str[StrLen] = L'\0'; \r
-\r
- for (Idx = 0; Idx < Len; Idx++) {\r
-\r
- Byte = Buf[Idx];\r
- Str[StrLen - 1 - Idx * 2] = NibbleToHexChar (Byte);\r
- Str[StrLen - 2 - Idx * 2] = NibbleToHexChar ((UINT8)(Byte >> 4));\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
STATIC\r
CHAR16 *\r
TrimHexStr (\r