Change key derivation to scrypt

scrypt is a sequential memory-hard key derivation algorithm that makes
it more difficult for adversaries to brute force passwords using
specialized equipment. See http://www.tarsnap.com/scrypt/scrypt.pdf for
more details of the algorithm.

This adds support for initializing disk encryption using scrypt and
upgrading from the previous PBKDF2 algorithm.

Change-Id: I1d26db4eb9d27fea7310be3e49c8e6219e6d2c3b
diff --git a/Android.mk b/Android.mk
index 71113df..ba9b0a1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,7 +22,8 @@
 common_c_includes := \
 	$(KERNEL_HEADERS) \
 	system/extras/ext4_utils \
-	external/openssl/include
+	external/openssl/include \
+	external/scrypt/lib/crypto
 
 common_shared_libraries := \
 	libsysutils \
@@ -33,6 +34,10 @@
 	liblogwrap \
 	libcrypto
 
+common_static_libraries := \
+	libfs_mgr \
+	libscrypt_static
+
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := libvold
@@ -43,7 +48,7 @@
 
 LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
 
-LOCAL_STATIC_LIBRARIES := libfs_mgr
+LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
 
 LOCAL_MODULE_TAGS := eng tests
 
@@ -63,7 +68,7 @@
 
 LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
 
-LOCAL_STATIC_LIBRARIES := libfs_mgr
+LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
 
 include $(BUILD_EXECUTABLE)