Loading core/java/com/android/internal/security/VerityUtils.java +9 −2 Original line number Diff line number Diff line Loading @@ -90,8 +90,15 @@ public abstract class VerityUtils { return (retval == 1); } /** Returns hash of a root node for the fs-verity enabled file. */ public static byte[] getFsverityRootHash(@NonNull String filePath) { /** * Returns fs-verity digest for the file if enabled, otherwise returns null. The digest is a * hash of root hash of fs-verity's Merkle tree with extra metadata. * * @see <a href="https://www.kernel.org/doc/html/latest/filesystems/fsverity.html#file-digest-computation"> * File digest computation in Linux kernel documentation</a> * @return Bytes of fs-verity digest */ public static byte[] getFsverityDigest(@NonNull String filePath) { byte[] result = new byte[HASH_SIZE_BYTES]; int retval = measureFsverityNative(filePath, result); if (retval < 0) { Loading services/core/java/com/android/server/pm/ApkChecksums.java +1 −1 Original line number Diff line number Diff line Loading @@ -650,7 +650,7 @@ public class ApkChecksums { // Skip /product folder. // TODO(b/231354111): remove this hack once we are allowed to change SELinux rules. if (!containsFile(Environment.getProductDirectory(), filePath)) { byte[] verityHash = VerityUtils.getFsverityRootHash(filePath); byte[] verityHash = VerityUtils.getFsverityDigest(filePath); if (verityHash != null) { return new ApkChecksum(split, TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, verityHash); } Loading Loading
core/java/com/android/internal/security/VerityUtils.java +9 −2 Original line number Diff line number Diff line Loading @@ -90,8 +90,15 @@ public abstract class VerityUtils { return (retval == 1); } /** Returns hash of a root node for the fs-verity enabled file. */ public static byte[] getFsverityRootHash(@NonNull String filePath) { /** * Returns fs-verity digest for the file if enabled, otherwise returns null. The digest is a * hash of root hash of fs-verity's Merkle tree with extra metadata. * * @see <a href="https://www.kernel.org/doc/html/latest/filesystems/fsverity.html#file-digest-computation"> * File digest computation in Linux kernel documentation</a> * @return Bytes of fs-verity digest */ public static byte[] getFsverityDigest(@NonNull String filePath) { byte[] result = new byte[HASH_SIZE_BYTES]; int retval = measureFsverityNative(filePath, result); if (retval < 0) { Loading
services/core/java/com/android/server/pm/ApkChecksums.java +1 −1 Original line number Diff line number Diff line Loading @@ -650,7 +650,7 @@ public class ApkChecksums { // Skip /product folder. // TODO(b/231354111): remove this hack once we are allowed to change SELinux rules. if (!containsFile(Environment.getProductDirectory(), filePath)) { byte[] verityHash = VerityUtils.getFsverityRootHash(filePath); byte[] verityHash = VerityUtils.getFsverityDigest(filePath); if (verityHash != null) { return new ApkChecksum(split, TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, verityHash); } Loading