ecryptfs_kernel.h (17398957aa0a05ef62535060b41d103590dcc533) ecryptfs_kernel.h (dd2a3b7ad98f8482cae481cad89dfed5eee48365)
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 * Kernel declarations.
4 *
5 * Copyright (C) 1997-2003 Erez Zadok
6 * Copyright (C) 2001-2003 Stony Brook University
1/**
2 * eCryptfs: Linux filesystem encryption layer
3 * Kernel declarations.
4 *
5 * Copyright (C) 1997-2003 Erez Zadok
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>
9 * Trevor S. Highland <trevor.highland@gmail.com>
10 * Tyler Hicks <tyhicks@ou.edu>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.

--- 29 unchanged lines hidden (view full) ---

45 * how to behave. */
46#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001
47#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002
48#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004
49#define ECRYPTFS_VERSIONING_POLICY 0x00000008
50#define ECRYPTFS_VERSIONING_XATTR 0x00000010
51#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
52 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
8 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com>
9 * Trevor S. Highland <trevor.highland@gmail.com>
10 * Tyler Hicks <tyhicks@ou.edu>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.

--- 29 unchanged lines hidden (view full) ---

45 * how to behave. */
46#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001
47#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002
48#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004
49#define ECRYPTFS_VERSIONING_POLICY 0x00000008
50#define ECRYPTFS_VERSIONING_XATTR 0x00000010
51#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
52 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
53 | ECRYPTFS_VERSIONING_PUBKEY)
54
53 | ECRYPTFS_VERSIONING_PUBKEY \
54 | ECRYPTFS_VERSIONING_XATTR)
55#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
56#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
57#define ECRYPTFS_SALT_SIZE 8
58#define ECRYPTFS_SALT_SIZE_HEX (ECRYPTFS_SALT_SIZE*2)
59/* The original signature size is only for what is stored on disk; all
60 * in-memory representations are expanded hex, so it better adapted to
61 * be passed around or referenced on the command line */
62#define ECRYPTFS_SIG_SIZE 8

--- 15 unchanged lines hidden (view full) ---

78#define ECRYPTFS_NLMSG_RESPONSE 103
79#define ECRYPTFS_MAX_PKI_NAME_BYTES 16
80#define ECRYPTFS_DEFAULT_NUM_USERS 4
81#define ECRYPTFS_MAX_NUM_USERS 32768
82#define ECRYPTFS_TRANSPORT_NETLINK 0
83#define ECRYPTFS_TRANSPORT_CONNECTOR 1
84#define ECRYPTFS_TRANSPORT_RELAYFS 2
85#define ECRYPTFS_DEFAULT_TRANSPORT ECRYPTFS_TRANSPORT_NETLINK
55#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
56#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
57#define ECRYPTFS_SALT_SIZE 8
58#define ECRYPTFS_SALT_SIZE_HEX (ECRYPTFS_SALT_SIZE*2)
59/* The original signature size is only for what is stored on disk; all
60 * in-memory representations are expanded hex, so it better adapted to
61 * be passed around or referenced on the command line */
62#define ECRYPTFS_SIG_SIZE 8

--- 15 unchanged lines hidden (view full) ---

78#define ECRYPTFS_NLMSG_RESPONSE 103
79#define ECRYPTFS_MAX_PKI_NAME_BYTES 16
80#define ECRYPTFS_DEFAULT_NUM_USERS 4
81#define ECRYPTFS_MAX_NUM_USERS 32768
82#define ECRYPTFS_TRANSPORT_NETLINK 0
83#define ECRYPTFS_TRANSPORT_CONNECTOR 1
84#define ECRYPTFS_TRANSPORT_RELAYFS 2
85#define ECRYPTFS_DEFAULT_TRANSPORT ECRYPTFS_TRANSPORT_NETLINK
86#define ECRYPTFS_XATTR_NAME "user.ecryptfs"
86
87#define RFC2440_CIPHER_DES3_EDE 0x02
88#define RFC2440_CIPHER_CAST_5 0x03
89#define RFC2440_CIPHER_BLOWFISH 0x04
90#define RFC2440_CIPHER_AES_128 0x07
91#define RFC2440_CIPHER_AES_192 0x08
92#define RFC2440_CIPHER_AES_256 0x09
93#define RFC2440_CIPHER_TWOFISH 0x0a

--- 228 unchanged lines hidden (view full) ---

322 unsigned int index;
323 unsigned int counter;
324 struct ecryptfs_message *msg;
325 struct task_struct *task;
326 struct list_head node;
327 struct mutex mux;
328};
329
87
88#define RFC2440_CIPHER_DES3_EDE 0x02
89#define RFC2440_CIPHER_CAST_5 0x03
90#define RFC2440_CIPHER_BLOWFISH 0x04
91#define RFC2440_CIPHER_AES_128 0x07
92#define RFC2440_CIPHER_AES_192 0x08
93#define RFC2440_CIPHER_AES_256 0x09
94#define RFC2440_CIPHER_TWOFISH 0x0a

--- 228 unchanged lines hidden (view full) ---

323 unsigned int index;
324 unsigned int counter;
325 struct ecryptfs_message *msg;
326 struct task_struct *task;
327 struct list_head node;
328 struct mutex mux;
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;
343
344struct ecryptfs_daemon_id {
345 pid_t pid;
346 uid_t uid;
347 struct hlist_node id_chain;
348};
349

--- 124 unchanged lines hidden (view full) ---

474extern struct kmem_cache *ecryptfs_auth_tok_list_item_cache;
475extern struct kmem_cache *ecryptfs_file_info_cache;
476extern struct kmem_cache *ecryptfs_dentry_info_cache;
477extern struct kmem_cache *ecryptfs_inode_info_cache;
478extern struct kmem_cache *ecryptfs_sb_info_cache;
479extern struct kmem_cache *ecryptfs_header_cache_0;
480extern struct kmem_cache *ecryptfs_header_cache_1;
481extern struct kmem_cache *ecryptfs_header_cache_2;
331extern unsigned int ecryptfs_transport;
332
333struct ecryptfs_daemon_id {
334 pid_t pid;
335 uid_t uid;
336 struct hlist_node id_chain;
337};
338

--- 124 unchanged lines hidden (view full) ---

463extern struct kmem_cache *ecryptfs_auth_tok_list_item_cache;
464extern struct kmem_cache *ecryptfs_file_info_cache;
465extern struct kmem_cache *ecryptfs_dentry_info_cache;
466extern struct kmem_cache *ecryptfs_inode_info_cache;
467extern struct kmem_cache *ecryptfs_sb_info_cache;
468extern struct kmem_cache *ecryptfs_header_cache_0;
469extern struct kmem_cache *ecryptfs_header_cache_1;
470extern struct kmem_cache *ecryptfs_header_cache_2;
471extern struct kmem_cache *ecryptfs_xattr_cache;
482extern struct kmem_cache *ecryptfs_lower_page_cache;
483
484int ecryptfs_interpose(struct dentry *hidden_dentry,
485 struct dentry *this_dentry, struct super_block *sb,
486 int flag);
487int ecryptfs_fill_zeros(struct file *file, loff_t new_length);
488int ecryptfs_decode_filename(struct ecryptfs_crypt_stat *crypt_stat,
489 const char *name, int length,

--- 10 unchanged lines hidden (view full) ---

500void ecryptfs_init_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat);
501void ecryptfs_destruct_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat);
502void ecryptfs_destruct_mount_crypt_stat(
503 struct ecryptfs_mount_crypt_stat *mount_crypt_stat);
504int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat);
505int ecryptfs_crypto_api_algify_cipher_name(char **algified_name,
506 char *cipher_name,
507 char *chaining_modifier);
472extern struct kmem_cache *ecryptfs_lower_page_cache;
473
474int ecryptfs_interpose(struct dentry *hidden_dentry,
475 struct dentry *this_dentry, struct super_block *sb,
476 int flag);
477int ecryptfs_fill_zeros(struct file *file, loff_t new_length);
478int ecryptfs_decode_filename(struct ecryptfs_crypt_stat *crypt_stat,
479 const char *name, int length,

--- 10 unchanged lines hidden (view full) ---

490void ecryptfs_init_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat);
491void ecryptfs_destruct_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat);
492void ecryptfs_destruct_mount_crypt_stat(
493 struct ecryptfs_mount_crypt_stat *mount_crypt_stat);
494int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat);
495int ecryptfs_crypto_api_algify_cipher_name(char **algified_name,
496 char *cipher_name,
497 char *chaining_modifier);
508int ecryptfs_write_inode_size_to_header(struct file *lower_file,
509 struct inode *lower_inode,
510 struct inode *inode);
498#define ECRYPTFS_LOWER_I_MUTEX_NOT_HELD 0
499#define ECRYPTFS_LOWER_I_MUTEX_HELD 1
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,
512 struct file *lower_file,
513 unsigned long lower_page_index, int byte_offset,
514 int region_bytes);
515int
516ecryptfs_commit_lower_page(struct page *lower_page, struct inode *lower_inode,
517 struct file *lower_file, int byte_offset,
518 int region_size);

--- 5 unchanged lines hidden (view full) ---

524 char **lower_virt,
525 struct inode *lower_inode,
526 unsigned long lower_page_index);
527int ecryptfs_writepage_and_release_lower_page(struct page *lower_page,
528 struct inode *lower_inode,
529 struct writeback_control *wbc);
530int ecryptfs_encrypt_page(struct ecryptfs_page_crypt_context *ctx);
531int ecryptfs_decrypt_page(struct file *file, struct page *page);
505int ecryptfs_get_lower_page(struct page **lower_page, struct inode *lower_inode,
506 struct file *lower_file,
507 unsigned long lower_page_index, int byte_offset,
508 int region_bytes);
509int
510ecryptfs_commit_lower_page(struct page *lower_page, struct inode *lower_inode,
511 struct file *lower_file, int byte_offset,
512 int region_size);

--- 5 unchanged lines hidden (view full) ---

518 char **lower_virt,
519 struct inode *lower_inode,
520 unsigned long lower_page_index);
521int ecryptfs_writepage_and_release_lower_page(struct page *lower_page,
522 struct inode *lower_inode,
523 struct writeback_control *wbc);
524int ecryptfs_encrypt_page(struct ecryptfs_page_crypt_context *ctx);
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);
541int ecryptfs_read_header_region(char *data, struct dentry *dentry,
542 struct vfsmount *mnt);
531int ecryptfs_read_and_validate_header_region(char *data, struct dentry *dentry,
532 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);
544int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code);
545void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat);
546int ecryptfs_generate_key_packet_set(char *dest_base,
547 struct ecryptfs_crypt_stat *crypt_stat,
548 struct dentry *ecryptfs_dentry,
549 size_t *len, size_t max);
550int process_request_key_err(long err_code);

--- 6 unchanged lines hidden (view full) ---

557 size_t *key_size);
558int ecryptfs_inode_test(struct inode *inode, void *candidate_lower_inode);
559int ecryptfs_inode_set(struct inode *inode, void *lower_inode);
560void ecryptfs_init_inode(struct inode *inode, struct inode *lower_inode);
561int ecryptfs_open_lower_file(struct file **lower_file,
562 struct dentry *lower_dentry,
563 struct vfsmount *lower_mnt, int flags);
564int ecryptfs_close_lower_file(struct file *lower_file);
535u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat);
536int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code);
537void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat);
538int ecryptfs_generate_key_packet_set(char *dest_base,
539 struct ecryptfs_crypt_stat *crypt_stat,
540 struct dentry *ecryptfs_dentry,
541 size_t *len, size_t max);
542int process_request_key_err(long err_code);

--- 6 unchanged lines hidden (view full) ---

549 size_t *key_size);
550int ecryptfs_inode_test(struct inode *inode, void *candidate_lower_inode);
551int ecryptfs_inode_set(struct inode *inode, void *lower_inode);
552void ecryptfs_init_inode(struct inode *inode, struct inode *lower_inode);
553int ecryptfs_open_lower_file(struct file **lower_file,
554 struct dentry *lower_dentry,
555 struct vfsmount *lower_mnt, int flags);
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
566int ecryptfs_process_helo(unsigned int transport, uid_t uid, pid_t pid);
567int ecryptfs_process_quit(uid_t uid, pid_t pid);
568int ecryptfs_process_response(struct ecryptfs_message *msg, uid_t uid,
569 pid_t pid, u32 seq);
570int ecryptfs_send_message(unsigned int transport, char *data, int data_len,
571 struct ecryptfs_msg_ctx **msg_ctx);
572int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx,

--- 18 unchanged lines hidden ---
562
563int ecryptfs_process_helo(unsigned int transport, uid_t uid, pid_t pid);
564int ecryptfs_process_quit(uid_t uid, pid_t pid);
565int ecryptfs_process_response(struct ecryptfs_message *msg, uid_t uid,
566 pid_t pid, u32 seq);
567int ecryptfs_send_message(unsigned int transport, char *data, int data_len,
568 struct ecryptfs_msg_ctx **msg_ctx);
569int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx,

--- 18 unchanged lines hidden ---