aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/ecryptfs_kernel.h
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-02-12 03:53:46 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:36 -0500
commitdd2a3b7ad98f8482cae481cad89dfed5eee48365 (patch)
tree986c09754176ea4c6e8308c6e2cdbf3fc0658a0b /fs/ecryptfs/ecryptfs_kernel.h
parent17398957aa0a05ef62535060b41d103590dcc533 (diff)
[PATCH] eCryptfs: Generalize metadata read/write
Generalize the metadata reading and writing mechanisms, with two targets for now: metadata in file header and metadata in the user.ecryptfs xattr of the lower file. [akpm@osdl.org: printk warning fix] [bunk@stusta.de: make some needlessly global code static] 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.h51
1 files changed, 24 insertions, 27 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 7bbd6e6e2743..020abcd16f0e 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1997-2003 Erez Zadok 5 * Copyright (C) 1997-2003 Erez Zadok
6 * Copyright (C) 2001-2003 Stony Brook University 6 * Copyright (C) 2001-2003 Stony Brook University
7 * Copyright (C) 2004-2006 International Business Machines Corp. 7 * Copyright (C) 2004-2007 International Business Machines Corp.
8 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com> 8 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com>
9 * Trevor S. Highland <trevor.highland@gmail.com> 9 * Trevor S. Highland <trevor.highland@gmail.com>
10 * Tyler Hicks <tyhicks@ou.edu> 10 * Tyler Hicks <tyhicks@ou.edu>
@@ -50,8 +50,8 @@
50#define ECRYPTFS_VERSIONING_XATTR 0x00000010 50#define ECRYPTFS_VERSIONING_XATTR 0x00000010
51#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \ 51#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
52 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \ 52 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
53 | ECRYPTFS_VERSIONING_PUBKEY) 53 | ECRYPTFS_VERSIONING_PUBKEY \
54 54 | ECRYPTFS_VERSIONING_XATTR)
55#define ECRYPTFS_MAX_PASSWORD_LENGTH 64 55#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
56#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH 56#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
57#define ECRYPTFS_SALT_SIZE 8 57#define ECRYPTFS_SALT_SIZE 8
@@ -83,6 +83,7 @@
83#define ECRYPTFS_TRANSPORT_CONNECTOR 1 83#define ECRYPTFS_TRANSPORT_CONNECTOR 1
84#define ECRYPTFS_TRANSPORT_RELAYFS 2 84#define ECRYPTFS_TRANSPORT_RELAYFS 2
85#define ECRYPTFS_DEFAULT_TRANSPORT ECRYPTFS_TRANSPORT_NETLINK 85#define ECRYPTFS_DEFAULT_TRANSPORT ECRYPTFS_TRANSPORT_NETLINK
86#define ECRYPTFS_XATTR_NAME "user.ecryptfs"
86 87
87#define RFC2440_CIPHER_DES3_EDE 0x02 88#define RFC2440_CIPHER_DES3_EDE 0x02
88#define RFC2440_CIPHER_CAST_5 0x03 89#define RFC2440_CIPHER_CAST_5 0x03
@@ -327,18 +328,6 @@ struct ecryptfs_msg_ctx {
327 struct mutex mux; 328 struct mutex mux;
328}; 329};
329 330
330extern struct list_head ecryptfs_msg_ctx_free_list;
331extern struct list_head ecryptfs_msg_ctx_alloc_list;
332extern struct mutex ecryptfs_msg_ctx_lists_mux;
333
334#define ecryptfs_uid_hash(uid) \
335 hash_long((unsigned long)uid, ecryptfs_hash_buckets)
336extern struct hlist_head *ecryptfs_daemon_id_hash;
337extern struct mutex ecryptfs_daemon_id_hash_mux;
338extern int ecryptfs_hash_buckets;
339
340extern unsigned int ecryptfs_msg_counter;
341extern struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
342extern unsigned int ecryptfs_transport; 331extern unsigned int ecryptfs_transport;
343 332
344struct ecryptfs_daemon_id { 333struct ecryptfs_daemon_id {
@@ -479,6 +468,7 @@ extern struct kmem_cache *ecryptfs_sb_info_cache;
479extern struct kmem_cache *ecryptfs_header_cache_0; 468extern struct kmem_cache *ecryptfs_header_cache_0;
480extern struct kmem_cache *ecryptfs_header_cache_1; 469extern struct kmem_cache *ecryptfs_header_cache_1;
481extern struct kmem_cache *ecryptfs_header_cache_2; 470extern struct kmem_cache *ecryptfs_header_cache_2;
471extern struct kmem_cache *ecryptfs_xattr_cache;
482extern struct kmem_cache *ecryptfs_lower_page_cache; 472extern struct kmem_cache *ecryptfs_lower_page_cache;
483 473
484int ecryptfs_interpose(struct dentry *hidden_dentry, 474int ecryptfs_interpose(struct dentry *hidden_dentry,
@@ -505,9 +495,13 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat);
505int ecryptfs_crypto_api_algify_cipher_name(char **algified_name, 495int ecryptfs_crypto_api_algify_cipher_name(char **algified_name,
506 char *cipher_name, 496 char *cipher_name,
507 char *chaining_modifier); 497 char *chaining_modifier);
508int ecryptfs_write_inode_size_to_header(struct file *lower_file, 498#define ECRYPTFS_LOWER_I_MUTEX_NOT_HELD 0
509 struct inode *lower_inode, 499#define ECRYPTFS_LOWER_I_MUTEX_HELD 1
510 struct inode *inode); 500int ecryptfs_write_inode_size_to_metadata(struct file *lower_file,
501 struct inode *lower_inode,
502 struct inode *inode,
503 struct dentry *ecryptfs_dentry,
504 int lower_i_mutex_held);
511int ecryptfs_get_lower_page(struct page **lower_page, struct inode *lower_inode, 505int ecryptfs_get_lower_page(struct page **lower_page, struct inode *lower_inode,
512 struct file *lower_file, 506 struct file *lower_file,
513 unsigned long lower_page_index, int byte_offset, 507 unsigned long lower_page_index, int byte_offset,
@@ -529,17 +523,15 @@ int ecryptfs_writepage_and_release_lower_page(struct page *lower_page,
529 struct writeback_control *wbc); 523 struct writeback_control *wbc);
530int ecryptfs_encrypt_page(struct ecryptfs_page_crypt_context *ctx); 524int ecryptfs_encrypt_page(struct ecryptfs_page_crypt_context *ctx);
531int ecryptfs_decrypt_page(struct file *file, struct page *page); 525int ecryptfs_decrypt_page(struct file *file, struct page *page);
532int ecryptfs_write_headers(struct dentry *ecryptfs_dentry, 526int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry,
527 struct file *lower_file);
528int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry,
533 struct file *lower_file); 529 struct file *lower_file);
534int ecryptfs_write_headers_virt(char *page_virt,
535 struct ecryptfs_crypt_stat *crypt_stat,
536 struct dentry *ecryptfs_dentry);
537int ecryptfs_read_headers(struct dentry *ecryptfs_dentry,
538 struct file *lower_file);
539int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry); 530int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry);
540int contains_ecryptfs_marker(char *data); 531int ecryptfs_read_and_validate_header_region(char *data, struct dentry *dentry,
541int ecryptfs_read_header_region(char *data, struct dentry *dentry, 532 struct vfsmount *mnt);
542 struct vfsmount *mnt); 533int ecryptfs_read_and_validate_xattr_region(char *page_virt,
534 struct dentry *ecryptfs_dentry);
543u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat); 535u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat);
544int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code); 536int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code);
545void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat); 537void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat);
@@ -562,6 +554,11 @@ int ecryptfs_open_lower_file(struct file **lower_file,
562 struct dentry *lower_dentry, 554 struct dentry *lower_dentry,
563 struct vfsmount *lower_mnt, int flags); 555 struct vfsmount *lower_mnt, int flags);
564int ecryptfs_close_lower_file(struct file *lower_file); 556int ecryptfs_close_lower_file(struct file *lower_file);
557ssize_t ecryptfs_getxattr(struct dentry *dentry, const char *name, void *value,
558 size_t size);
559int
560ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
561 size_t size, int flags);
565 562
566int ecryptfs_process_helo(unsigned int transport, uid_t uid, pid_t pid); 563int ecryptfs_process_helo(unsigned int transport, uid_t uid, pid_t pid);
567int ecryptfs_process_quit(uid_t uid, pid_t pid); 564int ecryptfs_process_quit(uid_t uid, pid_t pid);