diff options
Diffstat (limited to 'Cryptlib/SysCall')
-rw-r--r-- | Cryptlib/SysCall/BaseStrings.c | 48 | ||||
-rw-r--r-- | Cryptlib/SysCall/CrtWrapper.c | 82 | ||||
-rw-r--r-- | Cryptlib/SysCall/memset.c | 40 |
3 files changed, 9 insertions, 161 deletions
diff --git a/Cryptlib/SysCall/BaseStrings.c b/Cryptlib/SysCall/BaseStrings.c index 252e6db3..29a16100 100644 --- a/Cryptlib/SysCall/BaseStrings.c +++ b/Cryptlib/SysCall/BaseStrings.c @@ -1,9 +1,9 @@ #include <OpenSslSupport.h> -char * -AsciiStrCat(char *Destination, char *Source) +CHAR8 * +AsciiStrCat(CHAR8 *Destination, const CHAR8 *Source) { - UINTN dest_len = strlena((CHAR8 *)Destination); + UINTN dest_len = strlen((CHAR8 *)Destination); UINTN i; for (i = 0; Source[i] != '\0'; i++) @@ -14,7 +14,7 @@ AsciiStrCat(char *Destination, char *Source) } CHAR8 * -AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source) +AsciiStrCpy(CHAR8 *Destination, const CHAR8 *Source) { UINTN i; @@ -25,8 +25,8 @@ AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source) return Destination; } -char * -AsciiStrnCpy(char *Destination, char *Source, UINTN count) +CHAR8 * +AsciiStrnCpy(CHAR8 *Destination, const CHAR8 *Source, UINTN count) { UINTN i; @@ -59,45 +59,15 @@ WriteUnaligned32(UINT32 *Buffer, UINT32 Value) } UINTN -AsciiStrSize(CHAR8 *string) +AsciiStrSize(const 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; + return strlen(string) + 1; } /* Based on AsciiStrDecimalToUintnS() in edk2 * MdePkg/Library/BaseLib/SafeString.c */ UINTN -AsciiStrDecimalToUintn(const char *String) +AsciiStrDecimalToUintn(const CHAR8 *String) { UINTN Result; diff --git a/Cryptlib/SysCall/CrtWrapper.c b/Cryptlib/SysCall/CrtWrapper.c index 698e1eef..4bdaede9 100644 --- a/Cryptlib/SysCall/CrtWrapper.c +++ b/Cryptlib/SysCall/CrtWrapper.c @@ -121,21 +121,6 @@ QuickSortWorker ( // -- String Manipulation Routines --
//
-/* Scan a string for the last occurrence of a character */
-char *strrchr (const char *str, int c)
-{
- char * save;
-
- for (save = NULL; ; ++str) {
- if (*str == c) {
- save = (char *)str;
- }
- if (*str == 0) {
- return (save);
- }
- }
-}
-
/* Read formatted data from a string */
int sscanf (const char *buffer, const char *format, ...)
{
@@ -147,59 +132,6 @@ int sscanf (const char *buffer, const char *format, ...) }
//
-// -- Character Classification Routines --
-//
-
-/* Determines if a particular character is a decimal-digit character */
-int isdigit (int c)
-{
- //
- // <digit> ::= [0-9]
- //
- return (('0' <= (c)) && ((c) <= '9'));
-}
-
-/* Determine if an integer represents character that is a hex digit */
-int isxdigit (int c)
-{
- //
- // <hexdigit> ::= [0-9] | [a-f] | [A-F]
- //
- return ((('0' <= (c)) && ((c) <= '9')) ||
- (('a' <= (c)) && ((c) <= 'f')) ||
- (('A' <= (c)) && ((c) <= 'F')));
-}
-
-/* Determines if a particular character represents a space character */
-int isspace (int c)
-{
- //
- // <space> ::= [ ]
- //
- return ((c) == ' ');
-}
-
-/* Determine if a particular character is an alphanumeric character */
-int isalnum (int c)
-{
- //
- // <alnum> ::= [0-9] | [a-z] | [A-Z]
- //
- return ((('0' <= (c)) && ((c) <= '9')) ||
- (('a' <= (c)) && ((c) <= 'z')) ||
- (('A' <= (c)) && ((c) <= 'Z')));
-}
-
-/* Determines if a particular character is in upper case */
-int isupper (int c)
-{
- //
- // <uppercase letter> := [A-Z]
- //
- return (('A' <= (c)) && ((c) <= 'Z'));
-}
-
-//
// -- Data Conversion Routines --
//
@@ -223,15 +155,6 @@ unsigned long strtoul (const char *nptr, char **endptr, int base) return 0;
}
-/* Convert character to lowercase */
-int tolower (int c)
-{
- if (('A' <= (c)) && ((c) <= 'Z')) {
- return (c - ('A' - 'a'));
- }
- return (c);
-}
-
//
// -- Searching and Sorting Routines --
//
@@ -424,11 +347,6 @@ int stat (const char *c, struct stat *s) return -1;
}
-int strncasecmp (const char *c, const char *s, size_t l)
-{
- return 0;
-}
-
void syslog (int a, const char *c, ...)
{
diff --git a/Cryptlib/SysCall/memset.c b/Cryptlib/SysCall/memset.c deleted file mode 100644 index 76deed68..00000000 --- a/Cryptlib/SysCall/memset.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2016 SUSE LINUX GmbH <glin@suse.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <efi.h> -#include <efilib.h> - -typedef UINTN size_t; - -void * -memset (void *dest, int ch, size_t count) -{ - SetMem(dest, count, (UINT8)(ch)); - return dest; -} |