Keystore 2.0: Add safe crypto wrapper

 * Adds safe wrappers for AES_gcm_decrypt and AES_gcm_encrypt.
 * Adds AES256 key generation.
 * Adds ZVec, a simple fixed size owned vector type that locks
   the backing memory in place with mlock and zeroes the buffer
   before freeing it.

Test: keystore2_test
Bug: 173545997
Change-Id: Id7e30d50b024da1fa8aa58a07cd9bb7a861f81f0
diff --git a/keystore2/src/crypto/Android.bp b/keystore2/src/crypto/Android.bp
index 061cf9a..03c42b2 100644
--- a/keystore2/src/crypto/Android.bp
+++ b/keystore2/src/crypto/Android.bp
@@ -18,9 +18,14 @@
     srcs: ["lib.rs"],
     rustlibs: [
         "libkeystore2_crypto_bindgen",
+        "liblog_rust",
+        "libnix",
+        "libthiserror",
     ],
-    static_libs: ["libkeystore2_crypto"],
-    shared_libs: ["libcrypto"],
+    shared_libs: [
+        "libkeystore2_crypto",
+        "libcrypto",
+    ],
 }
 
 cc_library {
@@ -29,7 +34,7 @@
         "crypto.cpp",
         "certificate_utils.cpp",
     ],
-    export_include_dirs: ["include",],
+    export_include_dirs: ["include"],
     shared_libs: [
         "libcrypto",
         "liblog",
@@ -52,7 +57,9 @@
     auto_gen_config: true,
     rustlibs: [
         "libkeystore2_crypto_bindgen",
-        "libkeystore2_crypto_rust",
+        "liblog_rust",
+        "libnix",
+        "libthiserror",
     ],
     static_libs: [
         "libkeystore2_crypto",
@@ -60,11 +67,12 @@
     shared_libs: [
         "libc++",
         "libcrypto",
-	"liblog",
+        "liblog",
     ],
 }
 
 cc_test {
+    name: "keystore2_crypto_test",
     cflags: [
         "-Wall",
         "-Werror",
@@ -74,11 +82,11 @@
         "tests/certificate_utils_test.cpp",
         "tests/gtest_main.cpp",
     ],
+    test_suites: ["general-tests"],
     static_libs: [
         "libkeystore2_crypto",
     ],
     shared_libs: [
         "libcrypto",
     ],
-    name: "keystore2_crypto_test",
 }