📄 ecryptfs_kernel.h
字号:
/** * This struct is to enable a mount-wide passphrase/salt combo. This * is more or less a stopgap to provide similar functionality to other * crypto filesystems like EncFS or CFS until full policy support is * implemented in eCryptfs. */struct ecryptfs_mount_crypt_stat { /* Pointers to memory we do not own, do not free these */#define ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED 0x00000001#define ECRYPTFS_XATTR_METADATA_ENABLED 0x00000002#define ECRYPTFS_ENCRYPTED_VIEW_ENABLED 0x00000004#define ECRYPTFS_MOUNT_CRYPT_STAT_INITIALIZED 0x00000008 u32 flags; struct list_head global_auth_tok_list; struct mutex global_auth_tok_list_mutex; size_t num_global_auth_toks; size_t global_default_cipher_key_size; unsigned char global_default_cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1];};/* superblock private data. */struct ecryptfs_sb_info { struct super_block *wsi_sb; struct ecryptfs_mount_crypt_stat mount_crypt_stat;};/* file private data. */struct ecryptfs_file_info { struct file *wfi_file; struct ecryptfs_crypt_stat *crypt_stat;};/* auth_tok <=> encrypted_session_key mappings */struct ecryptfs_auth_tok_list_item { unsigned char encrypted_session_key[ECRYPTFS_MAX_KEY_BYTES]; struct list_head list; struct ecryptfs_auth_tok auth_tok;};struct ecryptfs_message { u32 index; u32 data_len; u8 data[];};struct ecryptfs_msg_ctx {#define ECRYPTFS_MSG_CTX_STATE_FREE 0x0001#define ECRYPTFS_MSG_CTX_STATE_PENDING 0x0002#define ECRYPTFS_MSG_CTX_STATE_DONE 0x0003 u32 state; unsigned int index; unsigned int counter; struct ecryptfs_message *msg; struct task_struct *task; struct list_head node; struct mutex mux;};extern unsigned int ecryptfs_transport;struct ecryptfs_daemon_id { pid_t pid; uid_t uid; struct hlist_node id_chain;};static inline struct ecryptfs_file_info *ecryptfs_file_to_private(struct file *file){ return (struct ecryptfs_file_info *)file->private_data;}static inline voidecryptfs_set_file_private(struct file *file, struct ecryptfs_file_info *file_info){ file->private_data = file_info;}static inline struct file *ecryptfs_file_to_lower(struct file *file){ return ((struct ecryptfs_file_info *)file->private_data)->wfi_file;}static inline voidecryptfs_set_file_lower(struct file *file, struct file *lower_file){ ((struct ecryptfs_file_info *)file->private_data)->wfi_file = lower_file;}static inline struct ecryptfs_inode_info *ecryptfs_inode_to_private(struct inode *inode){ return container_of(inode, struct ecryptfs_inode_info, vfs_inode);}static inline struct inode *ecryptfs_inode_to_lower(struct inode *inode){ return ecryptfs_inode_to_private(inode)->wii_inode;}static inline voidecryptfs_set_inode_lower(struct inode *inode, struct inode *lower_inode){ ecryptfs_inode_to_private(inode)->wii_inode = lower_inode;}static inline struct ecryptfs_sb_info *ecryptfs_superblock_to_private(struct super_block *sb){ return (struct ecryptfs_sb_info *)sb->s_fs_info;}static inline voidecryptfs_set_superblock_private(struct super_block *sb, struct ecryptfs_sb_info *sb_info){ sb->s_fs_info = sb_info;}static inline struct super_block *ecryptfs_superblock_to_lower(struct super_block *sb){ return ((struct ecryptfs_sb_info *)sb->s_fs_info)->wsi_sb;}static inline voidecryptfs_set_superblock_lower(struct super_block *sb, struct super_block *lower_sb){ ((struct ecryptfs_sb_info *)sb->s_fs_info)->wsi_sb = lower_sb;}static inline struct ecryptfs_dentry_info *ecryptfs_dentry_to_private(struct dentry *dentry){ return (struct ecryptfs_dentry_info *)dentry->d_fsdata;}static inline voidecryptfs_set_dentry_private(struct dentry *dentry, struct ecryptfs_dentry_info *dentry_info){ dentry->d_fsdata = dentry_info;}static inline struct dentry *ecryptfs_dentry_to_lower(struct dentry *dentry){ return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.dentry;}static inline voidecryptfs_set_dentry_lower(struct dentry *dentry, struct dentry *lower_dentry){ ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.dentry = lower_dentry;}static inline struct vfsmount *ecryptfs_dentry_to_lower_mnt(struct dentry *dentry){ return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt;}static inline voidecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt){ ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt = lower_mnt;}#define ecryptfs_printk(type, fmt, arg...) \ __ecryptfs_printk(type "%s: " fmt, __FUNCTION__, ## arg);void __ecryptfs_printk(const char *fmt, ...);extern const struct file_operations ecryptfs_main_fops;extern const struct file_operations ecryptfs_dir_fops;extern const struct inode_operations ecryptfs_main_iops;extern const struct inode_operations ecryptfs_dir_iops;extern const struct inode_operations ecryptfs_symlink_iops;extern const struct super_operations ecryptfs_sops;extern struct dentry_operations ecryptfs_dops;extern struct address_space_operations ecryptfs_aops;extern int ecryptfs_verbosity;extern unsigned int ecryptfs_message_buf_len;extern signed long ecryptfs_message_wait_timeout;extern unsigned int ecryptfs_number_of_users;extern struct kmem_cache *ecryptfs_auth_tok_list_item_cache;extern struct kmem_cache *ecryptfs_file_info_cache;extern struct kmem_cache *ecryptfs_dentry_info_cache;extern struct kmem_cache *ecryptfs_inode_info_cache;extern struct kmem_cache *ecryptfs_sb_info_cache;extern struct kmem_cache *ecryptfs_header_cache_0;extern struct kmem_cache *ecryptfs_header_cache_1;extern struct kmem_cache *ecryptfs_header_cache_2;extern struct kmem_cache *ecryptfs_xattr_cache;extern struct kmem_cache *ecryptfs_lower_page_cache;extern struct kmem_cache *ecryptfs_key_record_cache;extern struct kmem_cache *ecryptfs_key_sig_cache;extern struct kmem_cache *ecryptfs_global_auth_tok_cache;extern struct kmem_cache *ecryptfs_key_tfm_cache;int ecryptfs_interpose(struct dentry *hidden_dentry, struct dentry *this_dentry, struct super_block *sb, int flag);int ecryptfs_fill_zeros(struct file *file, loff_t new_length);int ecryptfs_decode_filename(struct ecryptfs_crypt_stat *crypt_stat, const char *name, int length, char **decrypted_name);int ecryptfs_encode_filename(struct ecryptfs_crypt_stat *crypt_stat, const char *name, int length, char **encoded_name);struct dentry *ecryptfs_lower_dentry(struct dentry *this_dentry);void ecryptfs_dump_hex(char *data, int bytes);int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, int sg_size);int ecryptfs_compute_root_iv(struct ecryptfs_crypt_stat *crypt_stat);void ecryptfs_rotate_iv(unsigned char *iv);void ecryptfs_init_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat);void ecryptfs_destroy_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat);void ecryptfs_destroy_mount_crypt_stat( struct ecryptfs_mount_crypt_stat *mount_crypt_stat);int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat);int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode);int ecryptfs_encrypt_page(struct page *page);int ecryptfs_decrypt_page(struct page *page);int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry);int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry);int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry);int ecryptfs_read_and_validate_header_region(char *data, struct inode *ecryptfs_inode);int ecryptfs_read_and_validate_xattr_region(char *page_virt, struct dentry *ecryptfs_dentry);u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat);int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code);void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat);int ecryptfs_generate_key_packet_set(char *dest_base, struct ecryptfs_crypt_stat *crypt_stat, struct dentry *ecryptfs_dentry, size_t *len, size_t max);intecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat, unsigned char *src, struct dentry *ecryptfs_dentry);int ecryptfs_truncate(struct dentry *dentry, loff_t new_length);int ecryptfs_inode_test(struct inode *inode, void *candidate_lower_inode);int ecryptfs_inode_set(struct inode *inode, void *lower_inode);void ecryptfs_init_inode(struct inode *inode, struct inode *lower_inode);ssize_t ecryptfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size);ssize_tecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, void *value, size_t size);intecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode);int ecryptfs_process_helo(unsigned int transport, uid_t uid, pid_t pid);int ecryptfs_process_quit(uid_t uid, pid_t pid);int ecryptfs_process_response(struct ecryptfs_message *msg, uid_t uid, pid_t pid, u32 seq);int ecryptfs_send_message(unsigned int transport, char *data, int data_len, struct ecryptfs_msg_ctx **msg_ctx);int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx, struct ecryptfs_message **emsg);int ecryptfs_init_messaging(unsigned int transport);void ecryptfs_release_messaging(unsigned int transport);int ecryptfs_send_netlink(char *data, int data_len, struct ecryptfs_msg_ctx *msg_ctx, u16 msg_type, u16 msg_flags, pid_t daemon_pid);int ecryptfs_init_netlink(void);void ecryptfs_release_netlink(void);int ecryptfs_send_connector(char *data, int data_len, struct ecryptfs_msg_ctx *msg_ctx, u16 msg_type, u16 msg_flags, pid_t daemon_pid);int ecryptfs_init_connector(void);void ecryptfs_release_connector(void);voidecryptfs_write_header_metadata(char *virt, struct ecryptfs_crypt_stat *crypt_stat, size_t *written);int ecryptfs_add_keysig(struct ecryptfs_crypt_stat *crypt_stat, char *sig);intecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig);int ecryptfs_get_global_auth_tok_for_sig( struct ecryptfs_global_auth_tok **global_auth_tok, struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig);intecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name, size_t key_size);int ecryptfs_init_crypto(void);int ecryptfs_destroy_crypto(void);int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, struct mutex **tfm_mutex, char *cipher_name);int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key, struct ecryptfs_auth_tok **auth_tok, char *sig);int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, int num_zeros);void ecryptfs_lower_offset_for_extent(loff_t *offset, loff_t extent_num, struct ecryptfs_crypt_stat *crypt_stat);int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, loff_t offset, size_t size);int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, struct page *page_for_lower, size_t offset_in_page, size_t size);int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset, size_t size);int ecryptfs_read_lower(char *data, loff_t offset, size_t size, struct inode *ecryptfs_inode);int ecryptfs_read_lower_page_segment(struct page *page_for_ecryptfs, pgoff_t page_index, size_t offset_in_page, size_t size, struct inode *ecryptfs_inode);int ecryptfs_read(char *data, loff_t offset, size_t size, struct file *ecryptfs_file);struct page *ecryptfs_get_locked_page(struct file *file, loff_t index);#endif /* #ifndef ECRYPTFS_KERNEL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -