summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cryptlib/Include/OpenSslSupport.h1
-rw-r--r--Cryptlib/SysCall/BaseStrings.c28
-rw-r--r--Cryptlib/SysCall/CrtWrapper.c5
3 files changed, 28 insertions, 6 deletions
diff --git a/Cryptlib/Include/OpenSslSupport.h b/Cryptlib/Include/OpenSslSupport.h
index fff6a526..5f85f79b 100644
--- a/Cryptlib/Include/OpenSslSupport.h
+++ b/Cryptlib/Include/OpenSslSupport.h
@@ -366,7 +366,6 @@ extern FILE *stdout;
#define memchr(buf,ch,count) ScanMem8(buf,(UINTN)(count),(UINT8)ch)
#define memcmp(buf1,buf2,count) (int)(CompareMem(buf1,buf2,(UINTN)(count)))
#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
-#define strcmp strcmpa
#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
#define strcpy(strDest,strSource) AsciiStrCpy(strDest,strSource)
#define strncpy(strDest,strSource,count) AsciiStrnCpy(strDest,strSource,(UINTN)count)
diff --git a/Cryptlib/SysCall/BaseStrings.c b/Cryptlib/SysCall/BaseStrings.c
index 43875712..1844a657 100644
--- a/Cryptlib/SysCall/BaseStrings.c
+++ b/Cryptlib/SysCall/BaseStrings.c
@@ -64,4 +64,32 @@ AsciiStrSize(CHAR8 *string)
return strlena(string) + 1;
}
+int
+strcmp (const char *str1, const char *str2)
+{
+ return strcmpa((CHAR8 *)str1,(CHAR8 *)str2);
+}
+
+inline static char
+toupper (char c)
+{
+ return ((c >= 'a' && c <= 'z') ? c - ('a' - 'A') : c);
+}
+/* Based on AsciiStriCmp() in edk2 MdePkg/Library/BaseLib/String.c */
+int
+strcasecmp (const char *str1, const char *str2)
+{
+ char c1, c2;
+
+ c1 = toupper (*str1);
+ c2 = toupper (*str2);
+ while ((*str1 != '\0') && (c1 == c2)) {
+ str1++;
+ str2++;
+ c1 = toupper (*str1);
+ c2 = toupper (*str2);
+ }
+
+ return c1 - c2;
+}
diff --git a/Cryptlib/SysCall/CrtWrapper.c b/Cryptlib/SysCall/CrtWrapper.c
index 1afe319f..698e1eef 100644
--- a/Cryptlib/SysCall/CrtWrapper.c
+++ b/Cryptlib/SysCall/CrtWrapper.c
@@ -424,11 +424,6 @@ int stat (const char *c, struct stat *s)
return -1;
}
-int strcasecmp (const char *c, const char *s)
-{
- return 0;
-}
-
int strncasecmp (const char *c, const char *s, size_t l)
{
return 0;