Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2af62aa3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix imprecise name of a fs-verity helper function"

parents 3bf2c7e4 c49d0bfa
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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);
            }