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

Commit e2e7470e authored by Victor Hsieh's avatar Victor Hsieh
Browse files

Include linux/fsverity.h and remove inlined definition

aosp/1184798 has updated kernel header to 5.4.

Test: atest com.android.apkverity.ApkVerityTest
Bug: None
Change-Id: If9ae25d84ecc20aed8c733fb2ebd640b4a26d9f7
parent 39424f4b
Loading
Loading
Loading
Loading
+1 −34
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

#include <errno.h>
#include <fcntl.h>
#include <linux/fsverity.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
@@ -31,40 +32,6 @@

#include <android-base/unique_fd.h>

// TODO(112037636): Always include once fsverity.h is upstreamed.
#if __has_include(<linux/fsverity.h>)
#include <linux/fsverity.h>
#else

#include <linux/limits.h>
#include <linux/ioctl.h>
#include <linux/types.h>

#define FS_VERITY_HASH_ALG_SHA256	1

struct fsverity_enable_arg {
	__u32 version;
	__u32 hash_algorithm;
	__u32 block_size;
	__u32 salt_size;
	__u64 salt_ptr;
	__u32 sig_size;
	__u32 __reserved1;
	__u64 sig_ptr;
	__u64 __reserved2[11];
};

struct fsverity_digest {
    __u16 digest_algorithm;
    __u16 digest_size; /* input/output */
    __u8 digest[];
};

#define FS_IOC_ENABLE_VERITY	_IOW('f', 133, struct fsverity_enable_arg)
#define FS_IOC_MEASURE_VERITY	_IOWR('f', 134, struct fsverity_digest)

#endif

const int kSha256Bytes = 32;

namespace android {