aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/ecryptfs_kernel.h
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-02-12 03:53:45 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:36 -0500
commit17398957aa0a05ef62535060b41d103590dcc533 (patch)
treebfb1d65281863811ad46d54f82e52e8924df3284 /fs/ecryptfs/ecryptfs_kernel.h
parentdddfa461fc8951f9b5f951c13565b6cac678635a (diff)
[PATCH] eCryptfs: xattr flags and mount options
This patch set introduces the ability to store cryptographic metadata into an lower file extended attribute rather than the lower file header region. This patch set implements two new mount options: ecryptfs_xattr_metadata - When set, newly created files will have their cryptographic metadata stored in the extended attribute region of the file rather than the header. When storing the data in the file header, there is a minimum of 8KB reserved for the header information for each file, making each file at least 12KB in size. This can take up a lot of extra disk space if the user creates a lot of small files. By storing the data in the extended attribute, each file will only occupy at least of 4KB of space. As the eCryptfs metadata set becomes larger with new features such as multi-key associations, most popular filesystems will not be able to store all of the information in the xattr region in some cases due to space constraints. However, the majority of users will only ever associate one key per file, so most users will be okay with storing their data in the xattr region. This option should be used with caution. I want to emphasize that the xattr must be maintained under all circumstances, or the file will be rendered permanently unrecoverable. The last thing I want is for a user to forget to set an xattr flag in a backup utility, only to later discover that their backups are worthless. ecryptfs_encrypted_view - When set, this option causes eCryptfs to present applications a view of encrypted files as if the cryptographic metadata were stored in the file header, whether the metadata is actually stored in the header or in the extended attributes. No matter what eCryptfs winds up doing in the lower filesystem, I want to preserve a baseline format compatibility for the encrypted files. As of right now, the metadata may be in the file header or in an xattr. There is no reason why the metadata could not be put in a separate file in future versions. Without the compatibility mode, backup utilities would have to know to back up the metadata file along with the files. The semantics of eCryptfs have always been that the lower files are self-contained units of encrypted data, and the only additional information required to decrypt any given eCryptfs file is the key. That is what has always been emphasized about eCryptfs lower files, and that is what users expect. Providing the encrypted view option will provide a way to userspace applications wherein they can always get to the same old familiar eCryptfs encrypted files, regardless of what eCryptfs winds up doing with the metadata behind the scenes. This patch: Add extended attribute support to version bit vector, flags to indicate when xattr or encrypted view modes are enabled, and support for the new mount options. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index f21385f97da5..7bbd6e6e2743 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -43,13 +43,14 @@
43 * module; userspace tools such as the mount helper read 43 * module; userspace tools such as the mount helper read
44 * ECRYPTFS_VERSIONING_MASK from a sysfs handle in order to determine 44 * ECRYPTFS_VERSIONING_MASK from a sysfs handle in order to determine
45 * how to behave. */ 45 * how to behave. */
46#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001 46#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001
47#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002 47#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002
48#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004 48#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004
49#define ECRYPTFS_VERSIONING_POLICY 0x00000008 49#define ECRYPTFS_VERSIONING_POLICY 0x00000008
50#define ECRYPTFS_VERSIONING_XATTR 0x00000010
50#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \ 51#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
51 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \ 52 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
52 | ECRYPTFS_VERSIONING_PUBKEY) 53 | ECRYPTFS_VERSIONING_PUBKEY)
53 54
54#define ECRYPTFS_MAX_PASSWORD_LENGTH 64 55#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
55#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH 56#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
@@ -227,6 +228,8 @@ struct ecryptfs_crypt_stat {
227#define ECRYPTFS_ENABLE_HMAC 0x00000020 228#define ECRYPTFS_ENABLE_HMAC 0x00000020
228#define ECRYPTFS_ENCRYPT_IV_PAGES 0x00000040 229#define ECRYPTFS_ENCRYPT_IV_PAGES 0x00000040
229#define ECRYPTFS_KEY_VALID 0x00000080 230#define ECRYPTFS_KEY_VALID 0x00000080
231#define ECRYPTFS_METADATA_IN_XATTR 0x00000100
232#define ECRYPTFS_VIEW_AS_ENCRYPTED 0x00000200
230 u32 flags; 233 u32 flags;
231 unsigned int file_version; 234 unsigned int file_version;
232 size_t iv_bytes; 235 size_t iv_bytes;
@@ -273,6 +276,8 @@ struct ecryptfs_dentry_info {
273struct ecryptfs_mount_crypt_stat { 276struct ecryptfs_mount_crypt_stat {
274 /* Pointers to memory we do not own, do not free these */ 277 /* Pointers to memory we do not own, do not free these */
275#define ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED 0x00000001 278#define ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED 0x00000001
279#define ECRYPTFS_XATTR_METADATA_ENABLED 0x00000002
280#define ECRYPTFS_ENCRYPTED_VIEW_ENABLED 0x00000004
276 u32 flags; 281 u32 flags;
277 struct ecryptfs_auth_tok *global_auth_tok; 282 struct ecryptfs_auth_tok *global_auth_tok;
278 struct key *global_auth_tok_key; 283 struct key *global_auth_tok_key;