CryptoPkg/BaseCryptLibMbedTls : Add strncpy() support to SecCryptLib

Mbedtls requires the use of strncpy(), but it is currently included in
DummyOpensslSupport.c, which is not part of Mbedtls SecCryptLib.
To resolve this, move strncpy() to CrtWrapper.c, as Mbedtls SecCryptLib
not depend on OpensslLib

Signed-off-by: Amy Chan <amy.chan@intel.com>
This commit is contained in:
Amy Chan 2025-01-10 13:56:24 +08:00 committed by mergify[bot]
parent c0533b7e22
commit 11cffd9c3f
2 changed files with 20 additions and 20 deletions

View File

@ -47,6 +47,26 @@ strchr (
return ScanMem8 (str, AsciiStrSize (str), (char)ch);
}
char *
strncpy (
char *strDest,
const char *strSource,
size_t count
)
{
UINTN DestMax = MAX_STRING_SIZE;
if (count < MAX_STRING_SIZE) {
DestMax = count + 1;
} else {
count = MAX_STRING_SIZE-1;
}
AsciiStrnCpyS (strDest, DestMax, strSource, (UINTN)count);
return strDest;
}
/**strcmp function. **/
int
strcmp (

View File

@ -262,26 +262,6 @@ strcpy (
return strDest;
}
char *
strncpy (
char *strDest,
const char *strSource,
size_t count
)
{
UINTN DestMax = MAX_STRING_SIZE;
if (count < MAX_STRING_SIZE) {
DestMax = count + 1;
} else {
count = MAX_STRING_SIZE-1;
}
AsciiStrnCpyS (strDest, DestMax, strSource, (UINTN)count);
return strDest;
}
//
// -- Character Classification Routines --
//