mirror of https://github.com/acidanthera/audk.git
SecurityPkg: Use safe string function.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Yao Jiewen <Jiewen.Yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18344 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c91c8ba803
commit
d2e8af9714
|
@ -307,33 +307,33 @@ AppendBufferWithTpmAlgHash (
|
||||||
switch (TpmAlgHash) {
|
switch (TpmAlgHash) {
|
||||||
case TPM_ALG_SHA1:
|
case TPM_ALG_SHA1:
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA1", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA1");
|
||||||
break;
|
break;
|
||||||
case TPM_ALG_SHA256:
|
case TPM_ALG_SHA256:
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA256", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA256");
|
||||||
break;
|
break;
|
||||||
case TPM_ALG_SHA384:
|
case TPM_ALG_SHA384:
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA384", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA384");
|
||||||
break;
|
break;
|
||||||
case TPM_ALG_SHA512:
|
case TPM_ALG_SHA512:
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA512", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA512");
|
||||||
break;
|
break;
|
||||||
case TPM_ALG_SM3_256:
|
case TPM_ALG_SM3_256:
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SM3_256", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SM3_256");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,33 +356,33 @@ FillBufferWithBootHashAlg (
|
||||||
Buffer[0] = 0;
|
Buffer[0] = 0;
|
||||||
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA1) != 0) {
|
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA1) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA1", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA1");
|
||||||
}
|
}
|
||||||
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA256) != 0) {
|
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA256) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA256", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA256");
|
||||||
}
|
}
|
||||||
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA384) != 0) {
|
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA384) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA384", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA384");
|
||||||
}
|
}
|
||||||
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA512) != 0) {
|
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA512) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SHA512", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA512");
|
||||||
}
|
}
|
||||||
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SM3_256) != 0) {
|
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SM3_256) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"SM3_256", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SM3_256");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,21 +404,21 @@ FillBufferWithTCG2EventLogFormat (
|
||||||
Buffer[0] = 0;
|
Buffer[0] = 0;
|
||||||
if ((TCG2EventLogFormat & EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2) != 0) {
|
if ((TCG2EventLogFormat & EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"TCG_1_2", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"TCG_1_2");
|
||||||
}
|
}
|
||||||
if ((TCG2EventLogFormat & EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) != 0) {
|
if ((TCG2EventLogFormat & EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"TCG_2", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"TCG_2");
|
||||||
}
|
}
|
||||||
if ((TCG2EventLogFormat & (~EFI_TCG2_EVENT_LOG_FORMAT_ALL)) != 0) {
|
if ((TCG2EventLogFormat & (~EFI_TCG2_EVENT_LOG_FORMAT_ALL)) != 0) {
|
||||||
if (Buffer[0] != 0) {
|
if (Buffer[0] != 0) {
|
||||||
StrnCat (Buffer, L", ", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
|
||||||
}
|
}
|
||||||
StrnCat (Buffer, L"UNKNOWN", (BufferSize / sizeof (CHAR16)) - StrLen (Buffer) - 1);
|
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"UNKNOWN");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue