diff options
author | Amy Chan <amy.chan@intel.com> | 2025-01-10 13:56:24 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-01-11 16:17:10 +0000 |
commit | 11cffd9c3f563c68e549526a79f89a074fb516b5 (patch) | |
tree | 3d6a6d9e489cab92583e32d421f07ff355fab4cb /CryptoPkg | |
parent | c0533b7e227b2bb6369055043aa837253a61d86a (diff) | |
download | edk2-11cffd9c3f563c68e549526a79f89a074fb516b5.tar.gz |
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>
Diffstat (limited to 'CryptoPkg')
-rw-r--r-- | CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/CrtWrapper.c | 20 | ||||
-rw-r--r-- | CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/DummyOpensslSupport.c | 20 |
2 files changed, 20 insertions, 20 deletions
diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/CrtWrapper.c index f1d9b9c35c..9352ffcbda 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/CrtWrapper.c @@ -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 (
diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/DummyOpensslSupport.c b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/DummyOpensslSupport.c index 3b5f430378..8c34f34df6 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/DummyOpensslSupport.c +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/SysCall/DummyOpensslSupport.c @@ -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 --
//
|