Fix updater binary for 7.0

Note: updater is currently not backwards compatible with older trees. Maybe
later...

Change-Id: I3c2a5ef69cfa9005502408f7054e3096a64ba34b
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 48eab01..581e53a 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -34,7 +34,7 @@
 LOCAL_MODULE := libapplypatch
 LOCAL_MODULE_TAGS := eng
 LOCAL_C_INCLUDES += bootable/recovery
-LOCAL_STATIC_LIBRARIES += libbase libotafault libmtdutils libmincrypttwrp libbz libz
+LOCAL_STATIC_LIBRARIES += libbase libotafault libmtdutils libcrypto_static libbz libz
 
 include $(BUILD_STATIC_LIBRARY)
 
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index cc28585..c2fe11b 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -119,7 +119,7 @@
         type = MTD;
     } else if (pieces[0] == "EMMC") {
         type = EMMC;
-    } else if (strcmp(magic, "BML") == 0) {
+    } else if (pieces[0] == "BML") {
         type = EMMC;
     } else {
         printf("LoadPartitionContents called with bad filename (%s)\n", filename);
@@ -127,7 +127,7 @@
     }
     const char* partition = pieces[1].c_str();
 
-    if (strcmp(magic, "BML") == 0) {
+    if (pieces[0] == "BML") {
         if (strcmp(partition, "boot") == 0) {
             partition = BOARD_BML_BOOT;
         } else if (strcmp(partition, "recovery") == 0) {
@@ -331,7 +331,7 @@
         type = MTD;
     } else if (pieces[0] == "EMMC") {
         type = EMMC;
-    } else if (strcmp(magic, "BML") == 0) {
+    } else if (pieces[0] == "BML") {
         type = EMMC;
     } else {
         printf("WriteToPartition called with bad target (%s)\n", target);
@@ -340,7 +340,7 @@
 
     const char* partition = pieces[1].c_str();
 
-    if (strcmp(magic, "BML") == 0) {
+    if (pieces[0] == "BML") {
         if (strcmp(partition, "boot") == 0) {
             partition = BOARD_BML_BOOT;
         } else if (strcmp(partition, "recovery") == 0) {
diff --git a/mtdutils/mounts.h b/mtdutils/mounts.h
index 30b2927..d721355 100644
--- a/mtdutils/mounts.h
+++ b/mtdutils/mounts.h
@@ -17,6 +17,10 @@
 #ifndef MTDUTILS_MOUNTS_H_
 #define MTDUTILS_MOUNTS_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct MountedVolume MountedVolume;
 
 int scan_mounted_volumes(void);
@@ -30,4 +34,8 @@
 
 int remount_read_only(const MountedVolume* volume);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  // MTDUTILS_MOUNTS_H_
diff --git a/mtdutils/mtdutils.h b/mtdutils/mtdutils.h
index 6cbf37e..235cbe7 100644
--- a/mtdutils/mtdutils.h
+++ b/mtdutils/mtdutils.h
@@ -19,6 +19,10 @@
 
 #include <sys/types.h>  // for size_t, etc.
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct MtdPartition MtdPartition;
 
 int mtd_scan_partitions(void);
@@ -58,4 +62,8 @@
     char *name;
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  // MTDUTILS_H_
diff --git a/updater/Android.mk b/updater/Android.mk
index b85fe55..23ba592 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -33,27 +33,13 @@
 
 LOCAL_SRC_FILES := $(updater_src_files)
 
-LOCAL_STATIC_LIBRARIES += libfec libfec_rs libext4_utils_static libsquashfs_utils libcrypto_static
+LOCAL_STATIC_LIBRARIES += libfec libfec_rs libsquashfs_utils libcrypto_static
 
 ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
 LOCAL_CFLAGS += -DUSE_EXT4
 LOCAL_CFLAGS += -Wno-unused-parameter
 LOCAL_C_INCLUDES += system/extras/ext4_utils
-LOCAL_STATIC_LIBRARIES += \
-    libext4_utils \
-    libz
-ifneq ($(wildcard system/core/libmincrypt/rsa_e_3.c),)
-LOCAL_STATIC_LIBRARIES = \
-    libext4_utils_static \
-    libsparse_static \
-    libz
-endif
-ifneq ($(wildcard system/core/include/mincrypt/sha256.h),)
-LOCAL_STATIC_LIBRARIES = \
-    libext4_utils_static \
-    libsparse_static \
-    libz
-endif
+LOCAL_STATIC_LIBRARIES += libext4_utils_static libsparse_static
 ifneq ($(wildcard external/lz4/Android.mk),)
     LOCAL_STATIC_LIBRARIES += liblz4
 endif
@@ -62,7 +48,7 @@
 LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
 LOCAL_STATIC_LIBRARIES += libapplypatch libbase libotafault libedify libmtdutils libminzip libz
 LOCAL_STATIC_LIBRARIES += libflashutils libmmcutils libbmlutils
-LOCAL_STATIC_LIBRARIES += libmincrypttwrp libbz
+LOCAL_STATIC_LIBRARIES += libbz
 LOCAL_STATIC_LIBRARIES += libcutils liblog libc
 LOCAL_STATIC_LIBRARIES += libselinux