authfs: Add FFI to libcrypto

The FFI is currently used for accessing SHA256 related functions, as
well as SHA256_CTX struct. The whole header is included for bindgen
since we wouldn't want to inline the internal struct definition of
SHA256_CTX.

Bug: 171310075
Test: atest authfs_host_test_src_lib

Change-Id: I0bdec7956d4d0ee407122395fe2b48a437214f3f
diff --git a/authfs/Android.bp b/authfs/Android.bp
index 3edd800..fe038cd 100644
--- a/authfs/Android.bp
+++ b/authfs/Android.bp
@@ -6,12 +6,29 @@
     ],
     edition: "2018",
     rustlibs: [
+        "libauthfs_crypto_bindgen",
         "liblibc",
+        "libthiserror",
     ],
     host_supported: true,
+    shared_libs: ["libcrypto"],
     clippy_lints: "android",
 }
 
+// TODO(b/172687320): remove once there is a canonical bindgen.
+rust_bindgen {
+    name: "libauthfs_crypto_bindgen",
+    wrapper_src: "src/crypto.hpp",
+    crate_name: "authfs_crypto_bindgen",
+    source_stem: "bindings",
+    shared_libs: [
+        "libcrypto",
+    ],
+    bindgen_flags: ["--size_t-is-usize"],
+    cflags: ["-D BORINGSSL_NO_CXX"],
+    host_supported: true,
+}
+
 rust_library {
     name: "libauthfs",
     defaults: ["authfs_defaults"],