am 62544224: Add hack to fix RC4_INT problems

* commit '625442248392e82d250cefaa91e70bcbaab3d2df':
  Add hack to fix RC4_INT problems
diff --git a/Apps-config-host.mk b/Apps-config-host.mk
index 2520f11..c6ebf81 100644
--- a/Apps-config-host.mk
+++ b/Apps-config-host.mk
@@ -74,30 +74,40 @@
   external/openssl/. \
   external/openssl/include \
 
+arm_clang_asflags :=
+
 arm_cflags :=
 
 arm_src_files :=
 
 arm_exclude_files :=
 
+arm64_clang_asflags :=
+
 arm64_cflags :=
 
 arm64_src_files :=
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags :=
 
 x86_src_files :=
 
 x86_exclude_files :=
 
+x86_64_clang_asflags :=
+
 x86_64_cflags :=
 
 x86_64_src_files :=
 
 x86_64_exclude_files :=
 
+mips_clang_asflags :=
+
 mips_cflags :=
 
 mips_src_files :=
diff --git a/Apps-config-target.mk b/Apps-config-target.mk
index b74c3ba..fe600c0 100644
--- a/Apps-config-target.mk
+++ b/Apps-config-target.mk
@@ -74,30 +74,40 @@
   external/openssl/. \
   external/openssl/include \
 
+arm_clang_asflags :=
+
 arm_cflags :=
 
 arm_src_files :=
 
 arm_exclude_files :=
 
+arm64_clang_asflags :=
+
 arm64_cflags :=
 
 arm64_src_files :=
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags :=
 
 x86_src_files :=
 
 x86_exclude_files :=
 
+x86_64_clang_asflags :=
+
 x86_64_cflags :=
 
 x86_64_src_files :=
 
 x86_64_exclude_files :=
 
+mips_clang_asflags :=
+
 mips_cflags :=
 
 mips_src_files :=
@@ -110,15 +120,20 @@
 
 LOCAL_SRC_FILES_arm += $(filter-out $(arm_exclude_files),$(common_src_files) $(arm_src_files))
 LOCAL_CFLAGS_arm += $(arm_cflags)
+LOCAL_CLANG_ASFLAGS_arm += $(arm_clang_asflags)
 
 LOCAL_SRC_FILES_arm64 += $(filter-out $(arm64_exclude_files),$(common_src_files) $(arm64_src_files))
 LOCAL_CFLAGS_arm64 += $(arm64_cflags)
+LOCAL_CLANG_ASFLAGS_arm64 += $(arm64_clang_asflags)
 
 LOCAL_SRC_FILES_x86 += $(filter-out $(x86_exclude_files),$(common_src_files) $(x86_src_files))
 LOCAL_CFLAGS_x86 += $(x86_cflags)
+LOCAL_CLANG_ASFLAGS_x86 += $(x86_clang_asflags)
 
 LOCAL_SRC_FILES_x86_64 += $(filter-out $(x86_64_exclude_files),$(common_src_files) $(x86_64_src_files))
 LOCAL_CFLAGS_x86_64 += $(x86_64_cflags)
+LOCAL_CLANG_ASFLAGS_x86_64 += $(x86_64_clang_asflags)
 
 LOCAL_SRC_FILES_mips += $(filter-out $(mips_exclude_files),$(common_src_files) $(mips_src_files))
 LOCAL_CFLAGS_mips += $(mips_cflags)
+LOCAL_CLANG_ASFLAGS_mips += $(mips_clang_asflags)
diff --git a/Crypto-config-host.mk b/Crypto-config-host.mk
index 5c63e9e..50b889a 100644
--- a/Crypto-config-host.mk
+++ b/Crypto-config-host.mk
@@ -541,6 +541,9 @@
   external/openssl/include \
   external/openssl/include/openssl \
 
+arm_clang_asflags := \
+  -no-integrated-as \
+
 arm_cflags := \
   -DAES_ASM \
   -DBSAES_ASM \
@@ -571,6 +574,9 @@
   crypto/aes/aes_core.c \
   crypto/mem_clr.c \
 
+arm64_clang_asflags := \
+  -no-integrated-as \
+
 arm64_cflags := \
   -DDES_UNROLL \
   -DOPENSSL_CPUID_OBJ \
@@ -589,6 +595,8 @@
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags := \
   -DAES_ASM \
   -DDES_PTR \
@@ -635,6 +643,8 @@
   crypto/des/fcrypt_b.c \
   crypto/mem_clr.c \
 
+x86_64_clang_asflags :=
+
 x86_64_cflags := \
   -DAES_ASM \
   -DBSAES_ASM \
@@ -679,6 +689,8 @@
   crypto/rc4/rc4_enc.c \
   crypto/rc4/rc4_skey.c \
 
+mips_clang_asflags :=
+
 mips_cflags := \
   -DAES_ASM \
   -DOPENSSL_BN_ASM_MONT \
diff --git a/Crypto-config-target.mk b/Crypto-config-target.mk
index 6fee75b..00682c0 100644
--- a/Crypto-config-target.mk
+++ b/Crypto-config-target.mk
@@ -541,6 +541,9 @@
   external/openssl/include \
   external/openssl/include/openssl \
 
+arm_clang_asflags := \
+  -no-integrated-as \
+
 arm_cflags := \
   -DAES_ASM \
   -DBSAES_ASM \
@@ -571,6 +574,9 @@
   crypto/aes/aes_core.c \
   crypto/mem_clr.c \
 
+arm64_clang_asflags := \
+  -no-integrated-as \
+
 arm64_cflags := \
   -DDES_UNROLL \
   -DOPENSSL_CPUID_OBJ \
@@ -589,6 +595,8 @@
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags := \
   -DAES_ASM \
   -DDES_PTR \
@@ -635,6 +643,8 @@
   crypto/des/fcrypt_b.c \
   crypto/mem_clr.c \
 
+x86_64_clang_asflags :=
+
 x86_64_cflags := \
   -DAES_ASM \
   -DBSAES_ASM \
@@ -679,6 +689,8 @@
   crypto/rc4/rc4_enc.c \
   crypto/rc4/rc4_skey.c \
 
+mips_clang_asflags :=
+
 mips_cflags := \
   -DAES_ASM \
   -DOPENSSL_BN_ASM_MONT \
@@ -705,15 +717,20 @@
 
 LOCAL_SRC_FILES_arm += $(filter-out $(arm_exclude_files),$(common_src_files) $(arm_src_files))
 LOCAL_CFLAGS_arm += $(arm_cflags)
+LOCAL_CLANG_ASFLAGS_arm += $(arm_clang_asflags)
 
 LOCAL_SRC_FILES_arm64 += $(filter-out $(arm64_exclude_files),$(common_src_files) $(arm64_src_files))
 LOCAL_CFLAGS_arm64 += $(arm64_cflags)
+LOCAL_CLANG_ASFLAGS_arm64 += $(arm64_clang_asflags)
 
 LOCAL_SRC_FILES_x86 += $(filter-out $(x86_exclude_files),$(common_src_files) $(x86_src_files))
 LOCAL_CFLAGS_x86 += $(x86_cflags)
+LOCAL_CLANG_ASFLAGS_x86 += $(x86_clang_asflags)
 
 LOCAL_SRC_FILES_x86_64 += $(filter-out $(x86_64_exclude_files),$(common_src_files) $(x86_64_src_files))
 LOCAL_CFLAGS_x86_64 += $(x86_64_cflags)
+LOCAL_CLANG_ASFLAGS_x86_64 += $(x86_64_clang_asflags)
 
 LOCAL_SRC_FILES_mips += $(filter-out $(mips_exclude_files),$(common_src_files) $(mips_src_files))
 LOCAL_CFLAGS_mips += $(mips_cflags)
+LOCAL_CLANG_ASFLAGS_mips += $(mips_clang_asflags)
diff --git a/Crypto-config-trusty.mk b/Crypto-config-trusty.mk
index aa67ede..c1b01d5 100644
--- a/Crypto-config-trusty.mk
+++ b/Crypto-config-trusty.mk
@@ -199,6 +199,8 @@
   external/openssl/include \
   external/openssl/include/openssl \
 
+arm_clang_asflags :=
+
 arm_cflags := \
   -DAES_ASM \
   -DGHASH_ASM \
@@ -218,24 +220,32 @@
 
 arm_exclude_files :=
 
+arm64_clang_asflags :=
+
 arm64_cflags :=
 
 arm64_src_files :=
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags :=
 
 x86_src_files :=
 
 x86_exclude_files :=
 
+x86_64_clang_asflags :=
+
 x86_64_cflags :=
 
 x86_64_src_files :=
 
 x86_64_exclude_files :=
 
+mips_clang_asflags :=
+
 mips_cflags :=
 
 mips_src_files :=
@@ -248,15 +258,20 @@
 
 LOCAL_SRC_FILES_arm += $(filter-out $(arm_exclude_files),$(common_src_files) $(arm_src_files))
 LOCAL_CFLAGS_arm += $(arm_cflags)
+LOCAL_CLANG_ASFLAGS_arm += $(arm_clang_asflags)
 
 LOCAL_SRC_FILES_arm64 += $(filter-out $(arm64_exclude_files),$(common_src_files) $(arm64_src_files))
 LOCAL_CFLAGS_arm64 += $(arm64_cflags)
+LOCAL_CLANG_ASFLAGS_arm64 += $(arm64_clang_asflags)
 
 LOCAL_SRC_FILES_x86 += $(filter-out $(x86_exclude_files),$(common_src_files) $(x86_src_files))
 LOCAL_CFLAGS_x86 += $(x86_cflags)
+LOCAL_CLANG_ASFLAGS_x86 += $(x86_clang_asflags)
 
 LOCAL_SRC_FILES_x86_64 += $(filter-out $(x86_64_exclude_files),$(common_src_files) $(x86_64_src_files))
 LOCAL_CFLAGS_x86_64 += $(x86_64_cflags)
+LOCAL_CLANG_ASFLAGS_x86_64 += $(x86_64_clang_asflags)
 
 LOCAL_SRC_FILES_mips += $(filter-out $(mips_exclude_files),$(common_src_files) $(mips_src_files))
 LOCAL_CFLAGS_mips += $(mips_cflags)
+LOCAL_CLANG_ASFLAGS_mips += $(mips_clang_asflags)
diff --git a/Crypto.mk b/Crypto.mk
index c0cef25..49e6a4a 100644
--- a/Crypto.mk
+++ b/Crypto.mk
@@ -2,6 +2,7 @@
 # target static library
 include $(CLEAR_VARS)
 LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
 
 # The static library should be used in only unbundled apps
 # and we don't have clang in unbundled build yet.
@@ -22,6 +23,7 @@
 # target shared library
 include $(CLEAR_VARS)
 LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
 
 # If we're building an unbundled build, don't try to use clang since it's not
 # in the NDK yet. This can be removed when a clang version that is fast enough
@@ -48,6 +50,7 @@
 # host shared library
 include $(CLEAR_VARS)
 LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
 LOCAL_CFLAGS += -DPURIFY
 LOCAL_LDLIBS += -ldl
 LOCAL_MODULE_TAGS := optional
@@ -63,6 +66,7 @@
 
 include $(CLEAR_VARS)
 LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
 LOCAL_CFLAGS += -DPURIFY
 LOCAL_LDLIBS += -ldl
 LOCAL_MODULE_TAGS := optional
diff --git a/Ssl-config-host.mk b/Ssl-config-host.mk
index 1785ea2..83c6026 100644
--- a/Ssl-config-host.mk
+++ b/Ssl-config-host.mk
@@ -68,30 +68,40 @@
   external/openssl/crypto \
   external/openssl/include \
 
+arm_clang_asflags :=
+
 arm_cflags :=
 
 arm_src_files :=
 
 arm_exclude_files :=
 
+arm64_clang_asflags :=
+
 arm64_cflags :=
 
 arm64_src_files :=
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags :=
 
 x86_src_files :=
 
 x86_exclude_files :=
 
+x86_64_clang_asflags :=
+
 x86_64_cflags :=
 
 x86_64_src_files :=
 
 x86_64_exclude_files :=
 
+mips_clang_asflags :=
+
 mips_cflags :=
 
 mips_src_files :=
diff --git a/Ssl-config-target.mk b/Ssl-config-target.mk
index 288b42b..4652673 100644
--- a/Ssl-config-target.mk
+++ b/Ssl-config-target.mk
@@ -68,30 +68,40 @@
   external/openssl/crypto \
   external/openssl/include \
 
+arm_clang_asflags :=
+
 arm_cflags :=
 
 arm_src_files :=
 
 arm_exclude_files :=
 
+arm64_clang_asflags :=
+
 arm64_cflags :=
 
 arm64_src_files :=
 
 arm64_exclude_files :=
 
+x86_clang_asflags :=
+
 x86_cflags :=
 
 x86_src_files :=
 
 x86_exclude_files :=
 
+x86_64_clang_asflags :=
+
 x86_64_cflags :=
 
 x86_64_src_files :=
 
 x86_64_exclude_files :=
 
+mips_clang_asflags :=
+
 mips_cflags :=
 
 mips_src_files :=
@@ -104,15 +114,20 @@
 
 LOCAL_SRC_FILES_arm += $(filter-out $(arm_exclude_files),$(common_src_files) $(arm_src_files))
 LOCAL_CFLAGS_arm += $(arm_cflags)
+LOCAL_CLANG_ASFLAGS_arm += $(arm_clang_asflags)
 
 LOCAL_SRC_FILES_arm64 += $(filter-out $(arm64_exclude_files),$(common_src_files) $(arm64_src_files))
 LOCAL_CFLAGS_arm64 += $(arm64_cflags)
+LOCAL_CLANG_ASFLAGS_arm64 += $(arm64_clang_asflags)
 
 LOCAL_SRC_FILES_x86 += $(filter-out $(x86_exclude_files),$(common_src_files) $(x86_src_files))
 LOCAL_CFLAGS_x86 += $(x86_cflags)
+LOCAL_CLANG_ASFLAGS_x86 += $(x86_clang_asflags)
 
 LOCAL_SRC_FILES_x86_64 += $(filter-out $(x86_64_exclude_files),$(common_src_files) $(x86_64_src_files))
 LOCAL_CFLAGS_x86_64 += $(x86_64_cflags)
+LOCAL_CLANG_ASFLAGS_x86_64 += $(x86_64_clang_asflags)
 
 LOCAL_SRC_FILES_mips += $(filter-out $(mips_exclude_files),$(common_src_files) $(mips_src_files))
 LOCAL_CFLAGS_mips += $(mips_cflags)
+LOCAL_CLANG_ASFLAGS_mips += $(mips_clang_asflags)
diff --git a/Ssl.mk b/Ssl.mk
index 22a61e0..c80ed61 100644
--- a/Ssl.mk
+++ b/Ssl.mk
@@ -1,6 +1,8 @@
 #######################################
 # target static library
 include $(CLEAR_VARS)
+LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
 
 # The static library should be used in only unbundled apps
 # and we don't have clang in unbundled build yet.
@@ -9,7 +11,6 @@
 LOCAL_SRC_FILES += $(target_src_files)
 LOCAL_CFLAGS += $(target_c_flags)
 LOCAL_C_INCLUDES += $(target_c_includes)
-LOCAL_SHARED_LIBRARIES = $(log_shared_libraries)
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := libssl_static
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/android-config.mk $(LOCAL_PATH)/Ssl.mk
@@ -20,6 +21,8 @@
 #######################################
 # target shared library
 include $(CLEAR_VARS)
+LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
 
 # If we're building an unbundled build, don't try to use clang since it's not
 # in the NDK yet. This can be removed when a clang version that is fast enough
@@ -30,7 +33,7 @@
 LOCAL_SDK_VERSION := 9
 endif
 
-LOCAL_SHARED_LIBRARIES += libcrypto $(log_shared_libraries)
+LOCAL_SHARED_LIBRARIES += libcrypto
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := libssl
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/android-config.mk $(LOCAL_PATH)/Ssl.mk
@@ -41,7 +44,10 @@
 #######################################
 # host shared library
 include $(CLEAR_VARS)
-LOCAL_SHARED_LIBRARIES += libcrypto-host $(log_shared_libraries)
+LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
+
+LOCAL_SHARED_LIBRARIES += libcrypto-host
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := libssl-host
 LOCAL_MULTILIB := both
@@ -53,8 +59,11 @@
 #######################################
 # ssltest
 include $(CLEAR_VARS)
+LOCAL_SHARED_LIBRARIES := $(log_shared_libraries)
+LOCAL_C_INCLUDES := $(log_c_includes)
+
 LOCAL_SRC_FILES := ssl/ssltest.c
-LOCAL_SHARED_LIBRARIES := libssl libcrypto $(log_shared_libraries)
+LOCAL_SHARED_LIBRARIES := libssl libcrypto
 LOCAL_MODULE := ssltest
 LOCAL_MULTILIB := both
 LOCAL_MODULE_STEM_32 := ssltest
diff --git a/flavor.mk b/flavor.mk
new file mode 100644
index 0000000..f32fe41
--- /dev/null
+++ b/flavor.mk
@@ -0,0 +1,4 @@
+# This makefile exists to be included by makefiles in other directories so that
+# they can detect whether BoringSSL or OpenSSL is being used.
+
+OPENSSL_FLAVOR=OpenSSL
diff --git a/import_openssl.sh b/import_openssl.sh
index ea5f361..1844c5b 100755
--- a/import_openssl.sh
+++ b/import_openssl.sh
@@ -439,6 +439,9 @@
     print_vardef_with_prefix_in_mk common_c_includes external/openssl/ $common_includes
 
     for arch in $all_archs; do
+      arch_clang_asflags=$(var_sorted_value OPENSSL_${prefix}_CLANG_ASFLAGS_${arch})
+      print_vardef_in_mk ${arch}_clang_asflags $arch_clang_asflags
+
       arch_defines=$(var_sorted_value OPENSSL_${prefix}_DEFINES_${arch})
       print_defines_in_mk ${arch}_cflags $arch_defines
 
@@ -463,7 +466,8 @@
       for arch in $all_archs; do
         echo "
 LOCAL_SRC_FILES_${arch} += \$(filter-out \$(${arch}_exclude_files),\$(common_src_files) \$(${arch}_src_files))
-LOCAL_CFLAGS_${arch} += \$(${arch}_cflags)"
+LOCAL_CFLAGS_${arch} += \$(${arch}_cflags)
+LOCAL_CLANG_ASFLAGS_${arch} += \$(${arch}_clang_asflags)"
       done
     else
       echo "
diff --git a/openssl.config b/openssl.config
index ae390fb..9edd51e 100644
--- a/openssl.config
+++ b/openssl.config
@@ -239,6 +239,10 @@
 NO_WINDOWS_BRAINDEATH \
 "
 
+OPENSSL_CRYPTO_CLANG_ASFLAGS_arm="\
+-no-integrated-as \
+"
+
 OPENSSL_CRYPTO_DEFINES_arm="\
 AES_ASM \
 BSAES_ASM \
@@ -252,6 +256,10 @@
 SHA512_ASM \
 "
 
+OPENSSL_CRYPTO_CLANG_ASFLAGS_arm64="\
+-no-integrated-as \
+"
+
 OPENSSL_CRYPTO_DEFINES_arm64="\
 DES_UNROLL \
 OPENSSL_CPUID_OBJ \
diff --git a/rules.mk b/rules.mk
index 252dbbb..1c3ae64 100644
--- a/rules.mk
+++ b/rules.mk
@@ -26,6 +26,8 @@
 
 MODULE_CFLAGS += $(LOCAL_CFLAGS)
 MODULE_CFLAGS += -Wno-error=implicit-function-declaration
+MODULE_CFLAGS += -Wno-empty-body
+MODULE_CFLAGS += -Wno-missing-field-initializers
 
 # Global for other modules which include openssl headers
 GLOBAL_DEFINES += OPENSSL_SYS_TRUSTY