Merge "libhidl: Add wifi keystore HAL" into oc-dev
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index f6ce09b..a8eae8c 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -123,8 +123,8 @@
 private:
     void freeHandle();
 
-    details::hidl_pointer<const native_handle_t> mHandle;
-    bool mOwnsHandle;
+    details::hidl_pointer<const native_handle_t> mHandle __attribute__ ((aligned(8)));
+    bool mOwnsHandle __attribute ((aligned(8)));
 };
 
 struct hidl_string {
diff --git a/base/include/hidl/MQDescriptor.h b/base/include/hidl/MQDescriptor.h
index bf2f8a4..3ed3685 100644
--- a/base/include/hidl/MQDescriptor.h
+++ b/base/include/hidl/MQDescriptor.h
@@ -120,6 +120,14 @@
         if (kAlignmentSize % __WORDSIZE != 0) {
             details::logAlwaysFatal("Incompatible word size");
         }
+
+        /*
+         * Check if alignment to word boundary would cause an overflow.
+         */
+        if (length > SIZE_MAX - kAlignmentSize/8 + 1) {
+            details::logAlwaysFatal("Queue size too large");
+        }
+
         return (length + kAlignmentSize/8 - 1) & ~(kAlignmentSize/8 - 1U);
     }
 
diff --git a/transport/base/1.0/IBase.hal b/transport/base/1.0/IBase.hal
index 9301c65..e862ec8 100644
--- a/transport/base/1.0/IBase.hal
+++ b/transport/base/1.0/IBase.hal
@@ -41,7 +41,7 @@
      *     package android.hardware.foo@1.0;
      *     interface IParent {};
      *     interface IChild extends IParent {};
-     * Calling interfaceChain on an IChild object will yield the following:
+     * Calling interfaceChain on an IChild object must yield the following:
      *     ["android.hardware.foo@1.0::IChild",
      *      "android.hardware.foo@1.0::IParent"
      *      "android.hidl.base@1.0::IBase"]
@@ -57,7 +57,7 @@
      *     package android.hardware.foo@1.0;
      *     interface IParent {};
      *     interface IChild extends IParent {};
-     * Calling interfaceDescriptor on an IChild object will yield
+     * Calling interfaceDescriptor on an IChild object must yield
      *     "android.hardware.foo@1.0::IChild"
      *
      * @return descriptor a descriptor of the run-time type of the
@@ -116,4 +116,23 @@
      *                Must support empty for default debug information.
      */
     debug(handle fd, vec<string> options);
+
+    /*
+     * Returns hashes of the source HAL files that define the interfaces of the
+     * runtime type information on the object.
+     * For example, for the following interface definition:
+     *     package android.hardware.foo@1.0;
+     *     interface IParent {};
+     *     interface IChild extends IParent {};
+     * Calling interfaceChain on an IChild object must yield the following:
+     *     [(hash of IChild.hal),
+     *      (hash of IParent.hal)
+     *      (hash of IBase.hal)].
+     *
+     * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
+     * according to SHA-256 standard.
+     *
+     * @return hashchain a vector of SHA-1 digests
+     */
+    getHashChain() generates (vec<uint8_t[32]> hashchain);
 };