summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi
diff options
context:
space:
mode:
authorChong Cai <chongc@google.com>2020-09-30 14:43:06 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-30 14:45:12 -0700
commit38704d9b667b9ebabc3f694a6508b37ead567b6f (patch)
tree87cc1667bd696ded139a04117f5158e93fc95c6c /pkg/abi
parent490a1fc1007e6fabdecd02b7e104f5e1482f31c3 (diff)
Implement ioctl with measure in verity fs
PiperOrigin-RevId: 334682753
Diffstat (limited to 'pkg/abi')
-rw-r--r--pkg/abi/linux/ioctl.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/pkg/abi/linux/ioctl.go b/pkg/abi/linux/ioctl.go
index dc9ac7e7c..7df02dd6d 100644
--- a/pkg/abi/linux/ioctl.go
+++ b/pkg/abi/linux/ioctl.go
@@ -121,9 +121,27 @@ const (
// Constants from uapi/linux/fsverity.h.
const (
- FS_IOC_ENABLE_VERITY = 1082156677
+ FS_IOC_ENABLE_VERITY = 1082156677
+ FS_IOC_MEASURE_VERITY = 3221513862
)
+// DigestMetadata is a helper struct for VerityDigest.
+//
+// +marshal
+type DigestMetadata struct {
+ DigestAlgorithm uint16
+ DigestSize uint16
+}
+
+// SizeOfDigestMetadata is the size of struct DigestMetadata.
+const SizeOfDigestMetadata = 4
+
+// VerityDigest is struct from uapi/linux/fsverity.h.
+type VerityDigest struct {
+ Metadata DigestMetadata
+ Digest []byte
+}
+
// IOC outputs the result of _IOC macro in asm-generic/ioctl.h.
func IOC(dir, typ, nr, size uint32) uint32 {
return uint32(dir)<<_IOC_DIRSHIFT | typ<<_IOC_TYPESHIFT | nr<<_IOC_NRSHIFT | size<<_IOC_SIZESHIFT