Fix OpenSSL build for the Windows SDK
Add missing file from OpenSSL 1.0.1c and fix flags since Windows
does not have dlfcn.h.
(cherry-picked from b4f245f7519f2f8b8dd7fa0b3897220eda17a7ef)
Change-Id: I937c1effd937dfe7922d6472c7adec063103c924
diff --git a/Crypto.mk b/Crypto.mk
index ccbf97a..e93994f 100644
--- a/Crypto.mk
+++ b/Crypto.mk
@@ -417,6 +417,7 @@
crypto/rand/rand_err.c \
crypto/rand/rand_lib.c \
crypto/rand/rand_unix.c \
+ crypto/rand/rand_win.c \
crypto/rand/randfile.c \
crypto/rc2/rc2_cbc.c \
crypto/rc2/rc2_ecb.c \
diff --git a/android-config.mk b/android-config.mk
index c751fd7..08f161d 100644
--- a/android-config.mk
+++ b/android-config.mk
@@ -5,7 +5,11 @@
#
# From CLFAG=
-LOCAL_CFLAGS += -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN #-DTERMIO
+LOCAL_CFLAGS += -DOPENSSL_THREADS -D_REENTRANT -DL_ENDIAN #-DTERMIO
+
+ifneq ($(HOST_OS),windows)
+LOCAL_CFLAGS += -DDSO_DLFCN -DHAVE_DLFCN_H
+endif
# From DEPFLAG=
LOCAL_CFLAGS += -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CAST -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_IDEA -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_SHA0 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED -DOPENSSL_NO_STORE -DOPENSSL_NO_WHIRLPOOL
diff --git a/crypto/LPdir_win32.c b/crypto/LPdir_win32.c
new file mode 100644
index 0000000..e39872d
--- /dev/null
+++ b/crypto/LPdir_win32.c
@@ -0,0 +1,30 @@
+/* $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */
+/*
+ * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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
+ * OWNER 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.
+ */
+
+#define LP_SYS_WIN32
+#define LP_MULTIBYTE_AVAILABLE
+#include "LPdir_win.c"
diff --git a/openssl.config b/openssl.config
index bf7489a..dd7716e 100644
--- a/openssl.config
+++ b/openssl.config
@@ -69,7 +69,6 @@
apps/vms_decc_init.c \
config \
crypto/LPdir_vms.c \
-crypto/LPdir_win32.c \
crypto/Makefile \
crypto/aes/Makefile \
crypto/armcap.c \