mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
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:
parent
c0533b7e22
commit
11cffd9c3f
@ -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 (
|
||||
|
@ -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 --
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user