]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / SysCall / UnitTestHostCrtWrapper.c
1 /** @file
2 C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based
3 Cryptographic Library.
4
5 Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
6 Copyright (c) Microsoft Corporation
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #include <stdio.h>
12
13 #include <Base.h>
14 #include <Library/DebugLib.h>
15
16 /* Convert character to lowercase */
17 int
18 tolower (
19 int c
20 )
21 {
22 if (('A' <= (c)) && ((c) <= 'Z')) {
23 return (c - ('A' - 'a'));
24 }
25
26 return (c);
27 }
28
29 /* Compare first n bytes of string s1 with string s2, ignoring case */
30 int
31 strncasecmp (
32 const char *s1,
33 const char *s2,
34 size_t n
35 )
36 {
37 int Val;
38
39 ASSERT (s1 != NULL);
40 ASSERT (s2 != NULL);
41
42 if (n != 0) {
43 do {
44 Val = tolower (*s1) - tolower (*s2);
45 if (Val != 0) {
46 return Val;
47 }
48
49 ++s1;
50 ++s2;
51 if (*s1 == '\0') {
52 break;
53 }
54 } while (--n != 0);
55 }
56
57 return 0;
58 }
59
60 /* Read formatted data from a string */
61 int
62 sscanf (
63 const char *buffer,
64 const char *format,
65 ...
66 )
67 {
68 //
69 // Null sscanf() function implementation to satisfy the linker, since
70 // no direct functionality logic dependency in present UEFI cases.
71 //
72 return 0;
73 }
74
75 //
76 // -- Dummy OpenSSL Support Routines --
77 //
78
79 int
80 BIO_printf (
81 void *bio,
82 const char *format,
83 ...
84 )
85 {
86 return 0;
87 }
88
89 int
90 BIO_snprintf (
91 char *buf,
92 size_t n,
93 const char *format,
94 ...
95 )
96 {
97 return 0;
98 }
99
100 uid_t
101 getuid (
102 void
103 )
104 {
105 return 0;
106 }
107
108 uid_t
109 geteuid (
110 void
111 )
112 {
113 return 0;
114 }
115
116 gid_t
117 getgid (
118 void
119 )
120 {
121 return 0;
122 }
123
124 gid_t
125 getegid (
126 void
127 )
128 {
129 return 0;
130 }
131
132 int errno = 0;