diff options
| author | Steve Langasek <steve.langasek@ubuntu.com> | 2012-08-29 16:51:10 -0700 |
|---|---|---|
| committer | Steve Langasek <steve.langasek@canonical.com> | 2012-08-29 16:51:10 -0700 |
| commit | 3e5756512efd00beca8e76ea70d5924056aa4714 (patch) | |
| tree | 0ec3924871c45ea16b10e5ff536e21b7a77af7c9 /Cryptlib/SysCall/BaseStrings.c | |
| download | efi-boot-shim-3e5756512efd00beca8e76ea70d5924056aa4714.tar.gz efi-boot-shim-3e5756512efd00beca8e76ea70d5924056aa4714.zip | |
Import upstream version 0~20120728.3df9e294
Diffstat (limited to 'Cryptlib/SysCall/BaseStrings.c')
| -rw-r--r-- | Cryptlib/SysCall/BaseStrings.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/Cryptlib/SysCall/BaseStrings.c b/Cryptlib/SysCall/BaseStrings.c new file mode 100644 index 00000000..43875712 --- /dev/null +++ b/Cryptlib/SysCall/BaseStrings.c @@ -0,0 +1,67 @@ +#include <OpenSslSupport.h> + +CHAR8 * +AsciiStrCat(CHAR8 *Destination, CHAR8 *Source) +{ + UINTN dest_len = strlena(Destination); + UINTN i; + + for (i = 0; Source[i] != '\0'; i++) + Destination[dest_len + i] = Source[i]; + Destination[dest_len + i] = '\0'; + + return Destination; +} + +CHAR8 * +AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source) +{ + UINTN i; + + for (i=0; Source[i] != '\0'; i++) + Destination[i] = Source[i]; + Destination[i] = '\0'; + + return Destination; +} + +CHAR8 * +AsciiStrnCpy(CHAR8 *Destination, CHAR8 *Source, UINTN count) +{ + UINTN i; + + for (i=0; i < count && Source[i] != '\0'; i++) + Destination[i] = Source[i]; + for ( ; i < count; i++) + Destination[i] = '\0'; + + return Destination; +} + +CHAR8 * +ScanMem8(CHAR8 *str, UINTN count, CHAR8 ch) +{ + UINTN i; + + for (i = 0; i < count; i++) { + if (str[i] == ch) + return str + i; + } + return NULL; +} + +UINT32 +WriteUnaligned32(UINT32 *Buffer, UINT32 Value) +{ + *Buffer = Value; + + return Value; +} + +UINTN +AsciiStrSize(CHAR8 *string) +{ + return strlena(string) + 1; +} + + |
