From ffbe898d1d42b1cc36def74e86145138fa06c1c3 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Thu, 30 Aug 2018 02:32:37 -0700 Subject: Update Protoc Compiler to 3.6.1 --- metadata/metadata.pb.go | 287 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 215 insertions(+), 72 deletions(-) (limited to 'metadata') diff --git a/metadata/metadata.pb.go b/metadata/metadata.pb.go index 482c740..94d5662 100644 --- a/metadata/metadata.pb.go +++ b/metadata/metadata.pb.go @@ -1,21 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: metadata/metadata.proto -/* -Package metadata is a generated protocol buffer package. - -It is generated from these files: - metadata/metadata.proto - -It has these top-level messages: - HashingCosts - WrappedKeyData - ProtectorData - EncryptionOptions - WrappedPolicyKey - PolicyData - Config -*/ package metadata import proto "github.com/golang/protobuf/proto" @@ -59,7 +44,9 @@ var SourceType_value = map[string]int32{ func (x SourceType) String() string { return proto.EnumName(SourceType_name, int32(x)) } -func (SourceType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (SourceType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{0} +} // Type of encryption; should match declarations of unix.FS_ENCRYPTION_MODE type EncryptionOptions_Mode int32 @@ -96,19 +83,43 @@ var EncryptionOptions_Mode_value = map[string]int32{ func (x EncryptionOptions_Mode) String() string { return proto.EnumName(EncryptionOptions_Mode_name, int32(x)) } -func (EncryptionOptions_Mode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} } +func (EncryptionOptions_Mode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{3, 0} +} // Cost parameters to be used in our hashing functions. type HashingCosts struct { - Time int64 `protobuf:"varint,2,opt,name=time" json:"time,omitempty"` - Memory int64 `protobuf:"varint,3,opt,name=memory" json:"memory,omitempty"` - Parallelism int64 `protobuf:"varint,4,opt,name=parallelism" json:"parallelism,omitempty"` + Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"` + Memory int64 `protobuf:"varint,3,opt,name=memory,proto3" json:"memory,omitempty"` + Parallelism int64 `protobuf:"varint,4,opt,name=parallelism,proto3" json:"parallelism,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *HashingCosts) Reset() { *m = HashingCosts{} } -func (m *HashingCosts) String() string { return proto.CompactTextString(m) } -func (*HashingCosts) ProtoMessage() {} -func (*HashingCosts) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *HashingCosts) Reset() { *m = HashingCosts{} } +func (m *HashingCosts) String() string { return proto.CompactTextString(m) } +func (*HashingCosts) ProtoMessage() {} +func (*HashingCosts) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{0} +} +func (m *HashingCosts) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HashingCosts.Unmarshal(m, b) +} +func (m *HashingCosts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HashingCosts.Marshal(b, m, deterministic) +} +func (dst *HashingCosts) XXX_Merge(src proto.Message) { + xxx_messageInfo_HashingCosts.Merge(dst, src) +} +func (m *HashingCosts) XXX_Size() int { + return xxx_messageInfo_HashingCosts.Size(m) +} +func (m *HashingCosts) XXX_DiscardUnknown() { + xxx_messageInfo_HashingCosts.DiscardUnknown(m) +} + +var xxx_messageInfo_HashingCosts proto.InternalMessageInfo func (m *HashingCosts) GetTime() int64 { if m != nil { @@ -133,15 +144,37 @@ func (m *HashingCosts) GetParallelism() int64 { // This structure is used for our authenticated wrapping/unwrapping of keys. type WrappedKeyData struct { - IV []byte `protobuf:"bytes,1,opt,name=IV,proto3" json:"IV,omitempty"` - EncryptedKey []byte `protobuf:"bytes,2,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` - Hmac []byte `protobuf:"bytes,3,opt,name=hmac,proto3" json:"hmac,omitempty"` + IV []byte `protobuf:"bytes,1,opt,name=IV,proto3" json:"IV,omitempty"` + EncryptedKey []byte `protobuf:"bytes,2,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` + Hmac []byte `protobuf:"bytes,3,opt,name=hmac,proto3" json:"hmac,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WrappedKeyData) Reset() { *m = WrappedKeyData{} } +func (m *WrappedKeyData) String() string { return proto.CompactTextString(m) } +func (*WrappedKeyData) ProtoMessage() {} +func (*WrappedKeyData) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{1} +} +func (m *WrappedKeyData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_WrappedKeyData.Unmarshal(m, b) +} +func (m *WrappedKeyData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_WrappedKeyData.Marshal(b, m, deterministic) +} +func (dst *WrappedKeyData) XXX_Merge(src proto.Message) { + xxx_messageInfo_WrappedKeyData.Merge(dst, src) +} +func (m *WrappedKeyData) XXX_Size() int { + return xxx_messageInfo_WrappedKeyData.Size(m) +} +func (m *WrappedKeyData) XXX_DiscardUnknown() { + xxx_messageInfo_WrappedKeyData.DiscardUnknown(m) } -func (m *WrappedKeyData) Reset() { *m = WrappedKeyData{} } -func (m *WrappedKeyData) String() string { return proto.CompactTextString(m) } -func (*WrappedKeyData) ProtoMessage() {} -func (*WrappedKeyData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_WrappedKeyData proto.InternalMessageInfo func (m *WrappedKeyData) GetIV() []byte { if m != nil { @@ -166,20 +199,42 @@ func (m *WrappedKeyData) GetHmac() []byte { // The associated data for each protector type ProtectorData struct { - ProtectorDescriptor string `protobuf:"bytes,1,opt,name=protector_descriptor,json=protectorDescriptor" json:"protector_descriptor,omitempty"` - Source SourceType `protobuf:"varint,2,opt,name=source,enum=metadata.SourceType" json:"source,omitempty"` + ProtectorDescriptor string `protobuf:"bytes,1,opt,name=protector_descriptor,json=protectorDescriptor,proto3" json:"protector_descriptor,omitempty"` + Source SourceType `protobuf:"varint,2,opt,name=source,proto3,enum=metadata.SourceType" json:"source,omitempty"` // These are only used by some of the protector types - Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` - Costs *HashingCosts `protobuf:"bytes,4,opt,name=costs" json:"costs,omitempty"` - Salt []byte `protobuf:"bytes,5,opt,name=salt,proto3" json:"salt,omitempty"` - Uid int64 `protobuf:"varint,6,opt,name=uid" json:"uid,omitempty"` - WrappedKey *WrappedKeyData `protobuf:"bytes,7,opt,name=wrapped_key,json=wrappedKey" json:"wrapped_key,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Costs *HashingCosts `protobuf:"bytes,4,opt,name=costs,proto3" json:"costs,omitempty"` + Salt []byte `protobuf:"bytes,5,opt,name=salt,proto3" json:"salt,omitempty"` + Uid int64 `protobuf:"varint,6,opt,name=uid,proto3" json:"uid,omitempty"` + WrappedKey *WrappedKeyData `protobuf:"bytes,7,opt,name=wrapped_key,json=wrappedKey,proto3" json:"wrapped_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ProtectorData) Reset() { *m = ProtectorData{} } -func (m *ProtectorData) String() string { return proto.CompactTextString(m) } -func (*ProtectorData) ProtoMessage() {} -func (*ProtectorData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *ProtectorData) Reset() { *m = ProtectorData{} } +func (m *ProtectorData) String() string { return proto.CompactTextString(m) } +func (*ProtectorData) ProtoMessage() {} +func (*ProtectorData) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{2} +} +func (m *ProtectorData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProtectorData.Unmarshal(m, b) +} +func (m *ProtectorData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProtectorData.Marshal(b, m, deterministic) +} +func (dst *ProtectorData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtectorData.Merge(dst, src) +} +func (m *ProtectorData) XXX_Size() int { + return xxx_messageInfo_ProtectorData.Size(m) +} +func (m *ProtectorData) XXX_DiscardUnknown() { + xxx_messageInfo_ProtectorData.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtectorData proto.InternalMessageInfo func (m *ProtectorData) GetProtectorDescriptor() string { if m != nil { @@ -232,15 +287,37 @@ func (m *ProtectorData) GetWrappedKey() *WrappedKeyData { // Encryption policy specifics, corresponds to the fscrypt_policy struct type EncryptionOptions struct { - Padding int64 `protobuf:"varint,1,opt,name=padding" json:"padding,omitempty"` - Contents EncryptionOptions_Mode `protobuf:"varint,2,opt,name=contents,enum=metadata.EncryptionOptions_Mode" json:"contents,omitempty"` - Filenames EncryptionOptions_Mode `protobuf:"varint,3,opt,name=filenames,enum=metadata.EncryptionOptions_Mode" json:"filenames,omitempty"` + Padding int64 `protobuf:"varint,1,opt,name=padding,proto3" json:"padding,omitempty"` + Contents EncryptionOptions_Mode `protobuf:"varint,2,opt,name=contents,proto3,enum=metadata.EncryptionOptions_Mode" json:"contents,omitempty"` + Filenames EncryptionOptions_Mode `protobuf:"varint,3,opt,name=filenames,proto3,enum=metadata.EncryptionOptions_Mode" json:"filenames,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *EncryptionOptions) Reset() { *m = EncryptionOptions{} } -func (m *EncryptionOptions) String() string { return proto.CompactTextString(m) } -func (*EncryptionOptions) ProtoMessage() {} -func (*EncryptionOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *EncryptionOptions) Reset() { *m = EncryptionOptions{} } +func (m *EncryptionOptions) String() string { return proto.CompactTextString(m) } +func (*EncryptionOptions) ProtoMessage() {} +func (*EncryptionOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{3} +} +func (m *EncryptionOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EncryptionOptions.Unmarshal(m, b) +} +func (m *EncryptionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EncryptionOptions.Marshal(b, m, deterministic) +} +func (dst *EncryptionOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EncryptionOptions.Merge(dst, src) +} +func (m *EncryptionOptions) XXX_Size() int { + return xxx_messageInfo_EncryptionOptions.Size(m) +} +func (m *EncryptionOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EncryptionOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EncryptionOptions proto.InternalMessageInfo func (m *EncryptionOptions) GetPadding() int64 { if m != nil { @@ -264,14 +341,36 @@ func (m *EncryptionOptions) GetFilenames() EncryptionOptions_Mode { } type WrappedPolicyKey struct { - ProtectorDescriptor string `protobuf:"bytes,1,opt,name=protector_descriptor,json=protectorDescriptor" json:"protector_descriptor,omitempty"` - WrappedKey *WrappedKeyData `protobuf:"bytes,2,opt,name=wrapped_key,json=wrappedKey" json:"wrapped_key,omitempty"` + ProtectorDescriptor string `protobuf:"bytes,1,opt,name=protector_descriptor,json=protectorDescriptor,proto3" json:"protector_descriptor,omitempty"` + WrappedKey *WrappedKeyData `protobuf:"bytes,2,opt,name=wrapped_key,json=wrappedKey,proto3" json:"wrapped_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *WrappedPolicyKey) Reset() { *m = WrappedPolicyKey{} } -func (m *WrappedPolicyKey) String() string { return proto.CompactTextString(m) } -func (*WrappedPolicyKey) ProtoMessage() {} -func (*WrappedPolicyKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (m *WrappedPolicyKey) Reset() { *m = WrappedPolicyKey{} } +func (m *WrappedPolicyKey) String() string { return proto.CompactTextString(m) } +func (*WrappedPolicyKey) ProtoMessage() {} +func (*WrappedPolicyKey) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{4} +} +func (m *WrappedPolicyKey) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_WrappedPolicyKey.Unmarshal(m, b) +} +func (m *WrappedPolicyKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_WrappedPolicyKey.Marshal(b, m, deterministic) +} +func (dst *WrappedPolicyKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_WrappedPolicyKey.Merge(dst, src) +} +func (m *WrappedPolicyKey) XXX_Size() int { + return xxx_messageInfo_WrappedPolicyKey.Size(m) +} +func (m *WrappedPolicyKey) XXX_DiscardUnknown() { + xxx_messageInfo_WrappedPolicyKey.DiscardUnknown(m) +} + +var xxx_messageInfo_WrappedPolicyKey proto.InternalMessageInfo func (m *WrappedPolicyKey) GetProtectorDescriptor() string { if m != nil { @@ -289,15 +388,37 @@ func (m *WrappedPolicyKey) GetWrappedKey() *WrappedKeyData { // The associated data for each policy type PolicyData struct { - KeyDescriptor string `protobuf:"bytes,1,opt,name=key_descriptor,json=keyDescriptor" json:"key_descriptor,omitempty"` - Options *EncryptionOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - WrappedPolicyKeys []*WrappedPolicyKey `protobuf:"bytes,3,rep,name=wrapped_policy_keys,json=wrappedPolicyKeys" json:"wrapped_policy_keys,omitempty"` + KeyDescriptor string `protobuf:"bytes,1,opt,name=key_descriptor,json=keyDescriptor,proto3" json:"key_descriptor,omitempty"` + Options *EncryptionOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + WrappedPolicyKeys []*WrappedPolicyKey `protobuf:"bytes,3,rep,name=wrapped_policy_keys,json=wrappedPolicyKeys,proto3" json:"wrapped_policy_keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PolicyData) Reset() { *m = PolicyData{} } -func (m *PolicyData) String() string { return proto.CompactTextString(m) } -func (*PolicyData) ProtoMessage() {} -func (*PolicyData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *PolicyData) Reset() { *m = PolicyData{} } +func (m *PolicyData) String() string { return proto.CompactTextString(m) } +func (*PolicyData) ProtoMessage() {} +func (*PolicyData) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{5} +} +func (m *PolicyData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PolicyData.Unmarshal(m, b) +} +func (m *PolicyData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PolicyData.Marshal(b, m, deterministic) +} +func (dst *PolicyData) XXX_Merge(src proto.Message) { + xxx_messageInfo_PolicyData.Merge(dst, src) +} +func (m *PolicyData) XXX_Size() int { + return xxx_messageInfo_PolicyData.Size(m) +} +func (m *PolicyData) XXX_DiscardUnknown() { + xxx_messageInfo_PolicyData.DiscardUnknown(m) +} + +var xxx_messageInfo_PolicyData proto.InternalMessageInfo func (m *PolicyData) GetKeyDescriptor() string { if m != nil { @@ -322,16 +443,38 @@ func (m *PolicyData) GetWrappedPolicyKeys() []*WrappedPolicyKey { // Data stored in the config file type Config struct { - Source SourceType `protobuf:"varint,1,opt,name=source,enum=metadata.SourceType" json:"source,omitempty"` - HashCosts *HashingCosts `protobuf:"bytes,2,opt,name=hash_costs,json=hashCosts" json:"hash_costs,omitempty"` - Compatibility string `protobuf:"bytes,3,opt,name=compatibility" json:"compatibility,omitempty"` - Options *EncryptionOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + Source SourceType `protobuf:"varint,1,opt,name=source,proto3,enum=metadata.SourceType" json:"source,omitempty"` + HashCosts *HashingCosts `protobuf:"bytes,2,opt,name=hash_costs,json=hashCosts,proto3" json:"hash_costs,omitempty"` + Compatibility string `protobuf:"bytes,3,opt,name=compatibility,proto3" json:"compatibility,omitempty"` + Options *EncryptionOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Config) Reset() { *m = Config{} } +func (m *Config) String() string { return proto.CompactTextString(m) } +func (*Config) ProtoMessage() {} +func (*Config) Descriptor() ([]byte, []int) { + return fileDescriptor_metadata_e565bd6b3feb0969, []int{6} +} +func (m *Config) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Config.Unmarshal(m, b) +} +func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Config.Marshal(b, m, deterministic) +} +func (dst *Config) XXX_Merge(src proto.Message) { + xxx_messageInfo_Config.Merge(dst, src) +} +func (m *Config) XXX_Size() int { + return xxx_messageInfo_Config.Size(m) +} +func (m *Config) XXX_DiscardUnknown() { + xxx_messageInfo_Config.DiscardUnknown(m) } -func (m *Config) Reset() { *m = Config{} } -func (m *Config) String() string { return proto.CompactTextString(m) } -func (*Config) ProtoMessage() {} -func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +var xxx_messageInfo_Config proto.InternalMessageInfo func (m *Config) GetSource() SourceType { if m != nil { @@ -373,9 +516,9 @@ func init() { proto.RegisterEnum("metadata.EncryptionOptions_Mode", EncryptionOptions_Mode_name, EncryptionOptions_Mode_value) } -func init() { proto.RegisterFile("metadata/metadata.proto", fileDescriptor0) } +func init() { proto.RegisterFile("metadata/metadata.proto", fileDescriptor_metadata_e565bd6b3feb0969) } -var fileDescriptor0 = []byte{ +var fileDescriptor_metadata_e565bd6b3feb0969 = []byte{ // 641 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xdf, 0x6e, 0xd3, 0x30, 0x14, 0xc6, 0x49, 0xd2, 0xb5, 0xeb, 0xe9, 0x1f, 0x32, 0x6f, 0x8c, 0x08, 0x6e, 0xaa, 0x00, 0xd2, -- cgit v1.3 From 36b185e408a56d93678f52a59e1d68ece8bf0508 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Thu, 30 Aug 2018 03:54:08 -0700 Subject: Use proto.Equal instead of reflect.DeepEquals --- actions/policy.go | 4 ++-- filesystem/filesystem_test.go | 8 ++++---- metadata/config_test.go | 5 +++-- metadata/policy_test.go | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) (limited to 'metadata') diff --git a/actions/policy.go b/actions/policy.go index cbdcb3a..39c235d 100644 --- a/actions/policy.go +++ b/actions/policy.go @@ -22,8 +22,8 @@ package actions import ( "fmt" "log" - "reflect" + "github.com/golang/protobuf/proto" "github.com/pkg/errors" "github.com/google/fscrypt/crypto" @@ -153,7 +153,7 @@ func GetPolicyFromPath(ctx *Context, path string) (*Policy, error) { } log.Printf("found data for policy %s on %q", descriptor, ctx.Mount.Path) - if !reflect.DeepEqual(pathData.Options, mountData.Options) { + if !proto.Equal(pathData.Options, mountData.Options) { log.Printf("options from path: %+v", pathData.Options) log.Printf("options from mount: %+v", mountData.Options) return nil, errors.Wrapf(ErrPolicyMetadataMismatch, "policy %s", descriptor) diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index 04d5123..2394f68 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -22,9 +22,9 @@ package filesystem import ( "os" "path/filepath" - "reflect" "testing" + "github.com/golang/protobuf/proto" "github.com/pkg/errors" "github.com/google/fscrypt/crypto" @@ -205,7 +205,7 @@ func TestSetPolicy(t *testing.T) { t.Fatal(err) } - if !reflect.DeepEqual(realPolicy, policy) { + if !proto.Equal(realPolicy, policy) { t.Errorf("policy %+v does not equal expected policy %+v", realPolicy, policy) } @@ -229,7 +229,7 @@ func TestSetProtector(t *testing.T) { t.Fatal(err) } - if !reflect.DeepEqual(realProtector, protector) { + if !proto.Equal(realProtector, protector) { t.Errorf("protector %+v does not equal expected protector %+v", realProtector, protector) } } @@ -289,7 +289,7 @@ func TestLinkedProtector(t *testing.T) { t.Error("mount returned was incorrect") } - if !reflect.DeepEqual(retProtector, protector) { + if !proto.Equal(retProtector, protector) { t.Errorf("protector %+v does not equal expected protector %+v", retProtector, protector) } } diff --git a/metadata/config_test.go b/metadata/config_test.go index 95afa04..d184a87 100644 --- a/metadata/config_test.go +++ b/metadata/config_test.go @@ -21,8 +21,9 @@ package metadata import ( "bytes" - "reflect" "testing" + + "github.com/golang/protobuf/proto" ) var testConfig = &Config{ @@ -72,7 +73,7 @@ func TestRead(t *testing.T) { t.Fatal(err) } t.Logf("decoded config:\n%s", cfg) - if !reflect.DeepEqual(cfg, testConfig) { + if !proto.Equal(cfg, testConfig) { t.Errorf("did not match: %s", testConfig) } } diff --git a/metadata/policy_test.go b/metadata/policy_test.go index 783a784..ad9dd80 100644 --- a/metadata/policy_test.go +++ b/metadata/policy_test.go @@ -23,9 +23,10 @@ import ( "fmt" "os" "path/filepath" - "reflect" "testing" + "github.com/golang/protobuf/proto" + "github.com/google/fscrypt/util" ) @@ -147,7 +148,7 @@ func TestGetPolicyEmptyDirectory(t *testing.T) { t.Fatal(err) } - if !reflect.DeepEqual(actualPolicy, goodPolicy) { + if !proto.Equal(actualPolicy, goodPolicy) { t.Errorf("policy %+v does not equal expected policy %+v", actualPolicy, goodPolicy) } } -- cgit v1.3 From 3c4664d603fb288b70938a00b05437ce8b2d0e64 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Thu, 30 Aug 2018 03:54:52 -0700 Subject: Go 1.11 gofmt updatae --- metadata/policy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'metadata') diff --git a/metadata/policy.go b/metadata/policy.go index ce40f9c..d83aa9d 100644 --- a/metadata/policy.go +++ b/metadata/policy.go @@ -138,7 +138,7 @@ func SetPolicy(path string, data *PolicyData) error { Version: 0, // Version must always be zero Contents_encryption_mode: uint8(data.Options.Contents), Filenames_encryption_mode: uint8(data.Options.Filenames), - Flags: uint8(paddingFlag), + Flags: uint8(paddingFlag), } copy(policy.Master_key_descriptor[:], descriptorBytes) @@ -176,7 +176,7 @@ func CheckSupport(path string) error { Version: math.MaxUint8, Contents_encryption_mode: math.MaxUint8, Filenames_encryption_mode: math.MaxUint8, - Flags: math.MaxUint8, + Flags: math.MaxUint8, } err = policyIoctl(file, unix.FS_IOC_SET_ENCRYPTION_POLICY, &badPolicy) -- cgit v1.3