aboutsummaryrefslogtreecommitdiff
path: root/metadata
diff options
context:
space:
mode:
authorJoseph Richey <joerichey@google.com>2019-01-17 18:51:05 -0800
committerGitHub <noreply@github.com>2019-01-17 18:51:05 -0800
commit509bb4d450cdd923bf09d05a5622cb6e98646bce (patch)
tree33365ae827f771eea1ccc40896e81c898aa6aa8f /metadata
parentf08b66dce72c566e1818c39af35c36fb36616d13 (diff)
parent5f06ede200fb390aafb7831c8c944ddd677be023 (diff)
Merge pull request #119 from ebiggers/adiantum
Add support for the Adiantum encryption mode
Diffstat (limited to 'metadata')
-rw-r--r--metadata/metadata.pb.go111
-rw-r--r--metadata/metadata.proto1
-rw-r--r--metadata/policy.go21
3 files changed, 77 insertions, 56 deletions
diff --git a/metadata/metadata.pb.go b/metadata/metadata.pb.go
index 94d5662..2b62a91 100644
--- a/metadata/metadata.pb.go
+++ b/metadata/metadata.pb.go
@@ -45,7 +45,7 @@ func (x SourceType) String() string {
return proto.EnumName(SourceType_name, int32(x))
}
func (SourceType) EnumDescriptor() ([]byte, []int) {
- return fileDescriptor_metadata_e565bd6b3feb0969, []int{0}
+ return fileDescriptor_metadata_5e732a616277e389, []int{0}
}
// Type of encryption; should match declarations of unix.FS_ENCRYPTION_MODE
@@ -59,6 +59,7 @@ const (
EncryptionOptions_AES_256_CTS EncryptionOptions_Mode = 4
EncryptionOptions_AES_128_CBC EncryptionOptions_Mode = 5
EncryptionOptions_AES_128_CTS EncryptionOptions_Mode = 6
+ EncryptionOptions_Adiantum EncryptionOptions_Mode = 9
)
var EncryptionOptions_Mode_name = map[int32]string{
@@ -69,6 +70,7 @@ var EncryptionOptions_Mode_name = map[int32]string{
4: "AES_256_CTS",
5: "AES_128_CBC",
6: "AES_128_CTS",
+ 9: "Adiantum",
}
var EncryptionOptions_Mode_value = map[string]int32{
"default": 0,
@@ -78,13 +80,14 @@ var EncryptionOptions_Mode_value = map[string]int32{
"AES_256_CTS": 4,
"AES_128_CBC": 5,
"AES_128_CTS": 6,
+ "Adiantum": 9,
}
func (x EncryptionOptions_Mode) String() string {
return proto.EnumName(EncryptionOptions_Mode_name, int32(x))
}
func (EncryptionOptions_Mode) EnumDescriptor() ([]byte, []int) {
- return fileDescriptor_metadata_e565bd6b3feb0969, []int{3, 0}
+ return fileDescriptor_metadata_5e732a616277e389, []int{3, 0}
}
// Cost parameters to be used in our hashing functions.
@@ -101,7 +104,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{0}
}
func (m *HashingCosts) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_HashingCosts.Unmarshal(m, b)
@@ -156,7 +159,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{1}
}
func (m *WrappedKeyData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WrappedKeyData.Unmarshal(m, b)
@@ -216,7 +219,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{2}
}
func (m *ProtectorData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProtectorData.Unmarshal(m, b)
@@ -299,7 +302,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{3}
}
func (m *EncryptionOptions) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EncryptionOptions.Unmarshal(m, b)
@@ -352,7 +355,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{4}
}
func (m *WrappedPolicyKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WrappedPolicyKey.Unmarshal(m, b)
@@ -400,7 +403,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{5}
}
func (m *PolicyData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PolicyData.Unmarshal(m, b)
@@ -456,7 +459,7 @@ 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}
+ return fileDescriptor_metadata_5e732a616277e389, []int{6}
}
func (m *Config) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Config.Unmarshal(m, b)
@@ -516,49 +519,49 @@ func init() {
proto.RegisterEnum("metadata.EncryptionOptions_Mode", EncryptionOptions_Mode_name, EncryptionOptions_Mode_value)
}
-func init() { proto.RegisterFile("metadata/metadata.proto", fileDescriptor_metadata_e565bd6b3feb0969) }
-
-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,
- 0x84, 0xa6, 0xa1, 0x15, 0x0d, 0x81, 0x84, 0x90, 0xa0, 0x9b, 0x60, 0x4c, 0x13, 0xc3, 0xad, 0x06,
- 0x48, 0x48, 0x95, 0x97, 0x78, 0xab, 0xb5, 0x24, 0xb6, 0x62, 0x57, 0x55, 0xee, 0x78, 0x07, 0xde,
- 0x81, 0x47, 0xe0, 0x21, 0x78, 0x2a, 0x64, 0xa7, 0x49, 0xd3, 0x4d, 0x9a, 0x06, 0x37, 0xd1, 0xf1,
- 0x67, 0xfb, 0x7c, 0xc7, 0x3f, 0xfb, 0x04, 0xee, 0xc7, 0x54, 0x91, 0x90, 0x28, 0xf2, 0xac, 0x08,
- 0x76, 0x44, 0xca, 0x15, 0x47, 0xab, 0xc5, 0xd8, 0xff, 0x0e, 0xed, 0x0f, 0x44, 0x4e, 0x58, 0x72,
- 0x31, 0xe0, 0x52, 0x49, 0x84, 0xa0, 0xa6, 0x58, 0x4c, 0x3d, 0xbb, 0x67, 0x6d, 0x39, 0xd8, 0xc4,
- 0x68, 0x13, 0xea, 0x31, 0x8d, 0x79, 0x9a, 0x79, 0x8e, 0x51, 0xe7, 0x23, 0xd4, 0x83, 0x96, 0x20,
- 0x29, 0x89, 0x22, 0x1a, 0x31, 0x19, 0x7b, 0x35, 0x33, 0x59, 0x95, 0xfc, 0x6f, 0xd0, 0xfd, 0x92,
- 0x12, 0x21, 0x68, 0x78, 0x44, 0xb3, 0x7d, 0xa2, 0x08, 0xea, 0x82,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0x2c, 0xa8, 0x0f, 0x78, 0x72, 0xce, 0x2e, 0x2a, 0x0d, 0x64, 0xdd,
- 0xa2, 0x81, 0xf6, 0x00, 0x26, 0x44, 0x4e, 0xc6, 0x79, 0xc7, 0xd8, 0x37, 0x76, 0x4c, 0x53, 0xaf,
- 0xcc, 0xff, 0x49, 0x8f, 0xa1, 0x13, 0xf0, 0x58, 0x10, 0xc5, 0xce, 0x58, 0xc4, 0x54, 0x36, 0x6f,
- 0xc0, 0x65, 0xb1, 0x0a, 0xa6, 0x76, 0x7b, 0x30, 0x4f, 0x3f, 0x03, 0x2c, 0x2a, 0x5d, 0x7e, 0x89,
- 0x08, 0xba, 0x82, 0xc4, 0x63, 0x41, 0xa4, 0x14, 0x93, 0x94, 0x48, 0xea, 0x5a, 0xe8, 0x1e, 0xac,
- 0x05, 0x53, 0xa9, 0xf8, 0x92, 0x6c, 0xeb, 0x7d, 0x29, 0x99, 0x69, 0xa6, 0xae, 0x73, 0x56, 0x37,
- 0x3f, 0xd9, 0xe7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xc6, 0x2e, 0x75, 0x7f, 0x05, 0x00,
- 0x00,
+func init() { proto.RegisterFile("metadata/metadata.proto", fileDescriptor_metadata_5e732a616277e389) }
+
+var fileDescriptor_metadata_5e732a616277e389 = []byte{
+ // 656 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xef, 0x6a, 0xdb, 0x3c,
+ 0x14, 0xc6, 0x5f, 0xdb, 0x69, 0xd2, 0x9c, 0xfc, 0x79, 0x5d, 0xb5, 0x6f, 0x5f, 0xb3, 0x7d, 0x09,
+ 0xde, 0x06, 0x65, 0x94, 0x8e, 0x66, 0x74, 0x6c, 0x30, 0x06, 0x5d, 0x5a, 0xb6, 0xae, 0x94, 0x75,
+ 0x4a, 0xe8, 0x36, 0x18, 0x04, 0xd5, 0x56, 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0xc1, 0xd4, 0xee, 0x0e, 0xe6, 0xf1, 0x07, 0x80, 0x45, 0xa5, 0xcb, 0xef, 0x12, 0x41,
+ 0x57, 0x90, 0x78, 0x2c, 0x88, 0x94, 0x62, 0x92, 0x12, 0x49, 0x5d, 0x0b, 0xfd, 0x07, 0x6b, 0xc1,
+ 0x54, 0x2a, 0xbe, 0x24, 0xdb, 0x7a, 0x5f, 0x4a, 0x66, 0x9a, 0xa9, 0xeb, 0x9c, 0xd7, 0xcd, 0x3f,
+ 0xf7, 0xe9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4b, 0xbe, 0x84, 0xbc, 0x8e, 0x05, 0x00, 0x00,
}
diff --git a/metadata/metadata.proto b/metadata/metadata.proto
index 5e1b9dd..6fe0ad9 100644
--- a/metadata/metadata.proto
+++ b/metadata/metadata.proto
@@ -72,6 +72,7 @@ message EncryptionOptions {
AES_256_CTS = 4;
AES_128_CBC = 5;
AES_128_CTS = 6;
+ Adiantum = 9;
}
Mode contents = 2;
diff --git a/metadata/policy.go b/metadata/policy.go
index d83aa9d..7926e9e 100644
--- a/metadata/policy.go
+++ b/metadata/policy.go
@@ -109,6 +109,18 @@ func GetPolicy(path string) (*PolicyData, error) {
}, nil
}
+// For improved performance, use the DIRECT_KEY flag when using ciphers that
+// support it, e.g. Adiantum. It is safe because fscrypt won't reuse the key
+// for any other policy. (Multiple directories with same policy are okay.)
+func shouldUseDirectKeyFlag(options *EncryptionOptions) bool {
+ // Contents and filenames encryption modes must be the same
+ if options.Contents != options.Filenames {
+ return false
+ }
+ // Whitelist the modes that take a 24+ byte IV (enough room for the per-file nonce)
+ return options.Contents == EncryptionOptions_Adiantum
+}
+
// SetPolicy sets up the specified directory to be encrypted with the specified
// policy. Returns an error if we cannot set the policy for any reason (not a
// directory, invalid options or KeyDescriptor, etc).
@@ -124,7 +136,7 @@ func SetPolicy(path string, data *PolicyData) error {
}
// This lookup should always succeed (as policy is valid)
- paddingFlag, ok := util.Lookup(data.Options.Padding, paddingArray, flagsArray)
+ flags, ok := util.Lookup(data.Options.Padding, paddingArray, flagsArray)
if !ok {
log.Panicf("padding of %d was not found", data.Options.Padding)
}
@@ -134,11 +146,16 @@ func SetPolicy(path string, data *PolicyData) error {
return errors.New("invalid descriptor: " + data.KeyDescriptor)
}
+ if shouldUseDirectKeyFlag(data.Options) {
+ // TODO: use unix.FS_POLICY_FLAG_DIRECT_KEY here once available
+ flags |= 0x4
+ }
+
policy := unix.FscryptPolicy{
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(flags),
}
copy(policy.Master_key_descriptor[:], descriptorBytes)