]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
Add new interfaces to support PKCS7#7 signed data and authenticode signature. Update...
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / SysCall / CrtWrapper.c
index 4bef42ee7a79b6ecf87bbb808d053dff131220cb..fb446b677044c35764c9e86bf1c7e8782ced1901 100644 (file)
@@ -2,7 +2,7 @@
   C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based\r
   Cryptographic Library.\r
 \r
   C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based\r
   Cryptographic Library.\r
 \r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -15,6 +15,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <OpenSslSupport.h>\r
 \r
 \r
 #include <OpenSslSupport.h>\r
 \r
+int errno = 0;\r
+\r
+FILE  *stderr = NULL;\r
+FILE  *stdin  = NULL;\r
+FILE  *stdout = NULL;\r
+\r
 typedef\r
 INTN\r
 (*SORT_COMPARE)(\r
 typedef\r
 INTN\r
 (*SORT_COMPARE)(\r
@@ -238,7 +244,10 @@ void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, c
   ASSERT (base    != NULL);\r
   ASSERT (compare != NULL);\r
 \r
   ASSERT (base    != NULL);\r
   ASSERT (compare != NULL);\r
 \r
-  Buffer = AllocatePool (width);\r
+  //\r
+  // Use CRT-style malloc to cover BS and RT memory allocation.\r
+  //\r
+  Buffer = malloc (width);\r
   ASSERT (Buffer != NULL);\r
 \r
   //\r
   ASSERT (Buffer != NULL);\r
 \r
   //\r
@@ -246,7 +255,7 @@ void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, c
   //\r
   QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer);\r
 \r
   //\r
   QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer);\r
 \r
-  FreePool (Buffer);\r
+  free (Buffer);\r
   return;\r
 }\r
 \r
   return;\r
 }\r
 \r
@@ -279,3 +288,163 @@ size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream)
 {\r
   return 0;\r
 }\r
 {\r
   return 0;\r
 }\r
+\r
+//\r
+//  -- Dummy OpenSSL Support Routines --\r
+//\r
+\r
+int BIO_printf (void *bio, const char *format, ...)\r
+{\r
+  return 0;\r
+}\r
+\r
+int BIO_snprintf(char *buf, size_t n, const char *format, ...)\r
+{\r
+  return 0;\r
+}\r
+\r
+void *UI_OpenSSL(void)\r
+{\r
+  return NULL;\r
+}\r
+\r
+int X509_load_cert_file (VOID *ctx, const char *file, int type)\r
+{\r
+  return 0;\r
+}\r
+\r
+int X509_load_crl_file (VOID *ctx, const char *file, int type)\r
+{\r
+  return 0;\r
+}\r
+\r
+int chmod (const char *c, mode_t m)\r
+{\r
+  return -1;\r
+}\r
+\r
+int close (int f)\r
+{\r
+  return -1;\r
+}\r
+\r
+void closelog (void)\r
+{\r
+\r
+}\r
+\r
+#ifdef __GNUC__\r
+\r
+typedef\r
+VOID\r
+(EFIAPI *NoReturnFuncPtr)(\r
+  VOID\r
+  ) __attribute__((__noreturn__));\r
+\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+NopFunction (\r
+  VOID\r
+  )\r
+{\r
+}\r
+\r
+\r
+void exit (int e)\r
+{\r
+  NoReturnFuncPtr NoReturnFunc;\r
+\r
+  NoReturnFunc = (NoReturnFuncPtr) NopFunction;\r
+\r
+  NoReturnFunc ();\r
+}\r
+\r
+#else\r
+\r
+void exit (int e)\r
+{\r
+}\r
+\r
+#endif\r
+\r
+int fclose (FILE *f)\r
+{\r
+  return 0;\r
+}\r
+\r
+FILE *fopen (const char *c, const char *m)\r
+{\r
+  return NULL;\r
+}\r
+\r
+size_t fread (void *b, size_t c, size_t i, FILE *f)\r
+{\r
+  return 0;\r
+}\r
+\r
+int fprintf (FILE *f, const char *s, ...)\r
+{\r
+  return 0;\r
+}\r
+\r
+uid_t getuid (void)\r
+{\r
+  return 0;\r
+}\r
+\r
+uid_t geteuid (void)\r
+{\r
+  return 0;\r
+}\r
+\r
+gid_t getgid (void)\r
+{\r
+  return 0;\r
+}\r
+\r
+gid_t getegid (void)\r
+{\r
+  return 0;\r
+}\r
+\r
+off_t lseek (int a, off_t o, int d)\r
+{\r
+  return 0;\r
+}\r
+\r
+void openlog (const char *c, int a, int b)\r
+{\r
+\r
+}\r
+\r
+ssize_t read (int f, void *b, size_t c)\r
+{\r
+  return 0;\r
+}\r
+\r
+int stat (const char *c, struct stat *s)\r
+{\r
+  return -1;\r
+}\r
+\r
+int strcasecmp (const char *c, const char *s)\r
+{\r
+  return 0;\r
+}\r
+\r
+int strncasecmp (const char *c, const char *s, size_t l)\r
+{\r
+  return 0;\r
+}\r
+\r
+void syslog (int a, const char *c, ...)\r
+{\r
+\r
+}\r
+\r
+ssize_t write (int f, const void *b, size_t l)\r
+{\r
+  return 0;\r
+}\r