| 1 |
/* |
| 2 |
* metadata.proto - File which contains all of the metadata structures which we |
| 3 |
* write to metadata files. Must be compiled with protoc to use the library. |
| 4 |
* Compilation can be invoked with go generate. |
| 5 |
* |
| 6 |
* Copyright 2017 Google Inc. |
| 7 |
* Author: Joe Richey ([email protected]) |
| 8 |
* |
| 9 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 10 |
* use this file except in compliance with the License. You may obtain a copy of |
| 11 |
* the License at |
| 12 |
* |
| 13 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 14 |
* |
| 15 |
* Unless required by applicable law or agreed to in writing, software |
| 16 |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 17 |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 18 |
* License for the specific language governing permissions and limitations under |
| 19 |
* the License. |
| 20 |
*/ |
| 21 |
|
| 22 |
// If the *.proto file is modified, be sure to run "make gen" (at the project |
| 23 |
// root) to recreate the *.pb.go file. |
| 24 |
syntax = "proto3"; |
| 25 |
package metadata; |
| 26 |
|
| 27 |
option go_package = "github.com/google/fscrypt/metadata"; |
| 28 |
|
| 29 |
// Cost parameters to be used in our hashing functions. |
| 30 |
message HashingCosts { |
| 31 |
int64 time = 2; |
| 32 |
int64 memory = 3; |
| 33 |
int64 parallelism = 4; |
| 34 |
// If true, parallelism should no longer be truncated to 8 bits. |
| 35 |
bool truncation_fixed = 5; |
| 36 |
} |
| 37 |
|
| 38 |
// This structure is used for our authenticated wrapping/unwrapping of keys. |
| 39 |
message WrappedKeyData { |
| 40 |
bytes IV = 1; |
| 41 |
bytes encrypted_key = 2; |
| 42 |
bytes hmac = 3; |
| 43 |
} |
| 44 |
|
| 45 |
// Specifies the method in which an outside secret is obtained for a Protector |
| 46 |
enum SourceType { |
| 47 |
default = 0; |
| 48 |
pam_passphrase = 1; |
| 49 |
custom_passphrase = 2; |
| 50 |
raw_key = 3; |
| 51 |
} |
| 52 |
|
| 53 |
// The associated data for each protector |
| 54 |
message ProtectorData { |
| 55 |
string protector_descriptor = 1; |
| 56 |
SourceType source = 2; |
| 57 |
|
| 58 |
// These are only used by some of the protector types |
| 59 |
string name = 3; |
| 60 |
HashingCosts costs = 4; |
| 61 |
bytes salt = 5; |
| 62 |
int64 uid = 6; |
| 63 |
|
| 64 |
WrappedKeyData wrapped_key = 7; |
| 65 |
} |
| 66 |
|
| 67 |
// Encryption policy specifics, corresponds to the fscrypt_policy struct |
| 68 |
message EncryptionOptions { |
| 69 |
int64 padding = 1; |
| 70 |
|
| 71 |
// Type of encryption; should match declarations of unix.FSCRYPT_MODE |
| 72 |
enum Mode { |
| 73 |
default = 0; |
| 74 |
AES_256_XTS = 1; |
| 75 |
AES_256_GCM = 2; |
| 76 |
AES_256_CBC = 3; |
| 77 |
AES_256_CTS = 4; |
| 78 |
AES_128_CBC = 5; |
| 79 |
AES_128_CTS = 6; |
| 80 |
Adiantum = 9; |
| 81 |
AES_256_HCTR2 = 10; |
| 82 |
} |
| 83 |
|
| 84 |
Mode contents = 2; |
| 85 |
Mode filenames = 3; |
| 86 |
|
| 87 |
int64 policy_version = 4; |
| 88 |
} |
| 89 |
|
| 90 |
message WrappedPolicyKey { |
| 91 |
string protector_descriptor = 1; |
| 92 |
WrappedKeyData wrapped_key = 2; |
| 93 |
} |
| 94 |
|
| 95 |
// The associated data for each policy |
| 96 |
message PolicyData { |
| 97 |
string key_descriptor = 1; |
| 98 |
EncryptionOptions options = 2; |
| 99 |
repeated WrappedPolicyKey wrapped_policy_keys = 3; |
| 100 |
} |
| 101 |
|
| 102 |
// Data stored in the config file |
| 103 |
message Config { |
| 104 |
SourceType source = 1; |
| 105 |
HashingCosts hash_costs = 2; |
| 106 |
EncryptionOptions options = 4; |
| 107 |
bool use_fs_keyring_for_v1_policies = 5; |
| 108 |
bool allow_cross_user_metadata = 6; |
| 109 |
|
| 110 |
// reserve the removed field 'string compatibility = 3;' |
| 111 |
reserved 3; |
| 112 |
reserved "compatibility"; |
| 113 |
} |