Add certificate utils to keystore2 crypto

This patch adds code for certificate generation with boringssl.
This is required for the Keymaster to KeyMint legacy wrapper.

Bug: 171351607
Test: keystore2_crypto_test
Change-Id: Id2d35be04cb5ab8c4e6b0597f5a970150ab9e69b
diff --git a/keystore2/Android.bp b/keystore2/Android.bp
index 526fd86..5939adf 100644
--- a/keystore2/Android.bp
+++ b/keystore2/Android.bp
@@ -57,7 +57,11 @@
 
 cc_library {
     name: "libkeystore2_crypto",
-    srcs: ["src/crypto.cpp"],
+    srcs: [
+        "src/crypto.cpp",
+        "src/certificate_utils.cpp",
+    ],
+    export_include_dirs: ["include",],
     shared_libs: [
         "libcrypto",
         "liblog",
@@ -84,6 +88,25 @@
     init_rc: ["keystore2.rc"],
 }
 
+cc_test {
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wextra",
+    ],
+    srcs: [
+        "src/tests/certificate_utils_test.cpp",
+        "src/tests/gtest_main.cpp",
+    ],
+    static_libs: [
+        "libkeystore2_crypto",
+    ],
+    shared_libs: [
+        "libcrypto",
+    ],
+    name: "keystore2_crypto_test",
+}
+
 // This is a placeholder for the libraries that will be generated from the AIDL specs
 // eventually.
 rust_library {
@@ -97,3 +120,4 @@
         "liblazy_static",
     ],
 }
+