Linux Kernel
3.7.1
|
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/random.h>
#include <linux/compiler.h>
#include <linux/key.h>
#include <linux/namei.h>
#include <linux/crypto.h>
#include <linux/file.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
#include "ecryptfs_kernel.h"
Go to the source code of this file.
Data Structures | |
struct | ecryptfs_flag_map_elem |
struct | ecryptfs_cipher_code_str_map_elem |
Macros | |
#define | ECRYPTFS_MAX_SCATTERLIST_LEN 4 |
#define | ECRYPTFS_DONT_VALIDATE_HEADER_SIZE 0 |
#define | ECRYPTFS_VALIDATE_HEADER_SIZE 1 |
Variables | |
struct kmem_cache * | ecryptfs_header_cache |
struct kmem_cache * | ecryptfs_key_tfm_cache |
struct mutex | key_tfm_list_mutex |
: The filename in cipher text | |
ecryptfs_decode_and_decrypt_filename - converts the encoded cipher text name to decoded plaintext : The plaintext name : The plaintext name size : eCryptfs directory dentry : The cipher text name size Decrypts and decodes the filename. Returns zero on error; non-zero otherwise | |
#define | ENC_NAME_MAX_BLOCKLEN_8_OR_16 143 |
int | ecryptfs_decode_and_decrypt_filename (char **plaintext_name, size_t *plaintext_name_size, struct dentry *ecryptfs_dir_dentry, const char *name, size_t name_size) |
int | ecryptfs_set_f_namelen (long *namelen, long lower_namelen, struct ecryptfs_mount_crypt_stat *mount_crypt_stat) |
int ecryptfs_add_new_key_tfm | ( | struct ecryptfs_key_tfm ** | key_tfm, |
char * | cipher_name, | ||
size_t | key_size | ||
) |
int ecryptfs_compute_root_iv | ( | struct ecryptfs_crypt_stat * | crypt_stat | ) |
int ecryptfs_derive_iv | ( | char * | iv, |
struct ecryptfs_crypt_stat * | crypt_stat, | ||
loff_t | offset | ||
) |
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_encrypt_and_encode_filename | ( | char ** | encoded_name, |
size_t * | encoded_name_size, | ||
struct ecryptfs_crypt_stat * | crypt_stat, | ||
struct ecryptfs_mount_crypt_stat * | mount_crypt_stat, | ||
const char * | name, | ||
size_t | name_size | ||
) |
int ecryptfs_get_tfm_and_mutex_for_cipher_name | ( | struct crypto_blkcipher ** | tfm, |
struct mutex ** | tfm_mutex, | ||
char * | cipher_name | ||
) |
ecryptfs_get_tfm_and_mutex_for_cipher_name
: set to cached tfm found, or new tfm created : set to mutex for cached tfm found, or new tfm created : the name of the cipher to search for and/or add
Sets pointers to & matching . Searches for cached item first, and creates new if not found. Returns 0 on success, non-zero if adding new cipher failed
int ecryptfs_init_crypt_ctx | ( | struct ecryptfs_crypt_stat * | crypt_stat | ) |
void ecryptfs_init_crypt_stat | ( | struct ecryptfs_crypt_stat * | crypt_stat | ) |
ecryptfs_new_file_context : The eCryptfs inode
If the crypto context for the file has not yet been established, this is where we do that. Establishing a new crypto context involves the following decisions:
Returns zero on success; non-zero otherwise
ecryptfs_read_metadata
Common entry point for reading file metadata. From here, we could retrieve the header information from the header region of the file, the xattr region of the file, or some other repostory that is stored separately from the file itself. The current implementation supports retrieving the metadata information from the file contents and from the xattr region.
Returns zero if valid headers found and parsed; non-zero otherwise
void ecryptfs_set_default_sizes | ( | struct ecryptfs_crypt_stat * | crypt_stat | ) |
int ecryptfs_set_f_namelen | ( | long * | namelen, |
long | lower_namelen, | ||
struct ecryptfs_mount_crypt_stat * | mount_crypt_stat | ||
) |
int ecryptfs_tfm_exists | ( | char * | cipher_name, |
struct ecryptfs_key_tfm ** | key_tfm | ||
) |
void ecryptfs_write_crypt_stat_flags | ( | char * | page_virt, |
struct ecryptfs_crypt_stat * | crypt_stat, | ||
size_t * | written | ||
) |
void ecryptfs_write_header_metadata | ( | char * | virt, |
struct ecryptfs_crypt_stat * | crypt_stat, | ||
size_t * | written | ||
) |
ecryptfs_write_metadata : The eCryptfs dentry, which should be negative : The newly created eCryptfs inode
Write the file headers out. This will likely involve a userspace callout, in which the session key is encrypted with one or more public keys and/or the passphrase necessary to do the encryption is retrieved via a prompt. Exactly what happens at this point should be policy-dependent.
Returns zero on success; non-zero on error
virt_to_scatterlist : Virtual address : Size of data; should be an even multiple of the block size : Pointer to scatterlist array; set to NULL to obtain only the number of scatterlist structs required in array : Max array size
Fills in a scatterlist array with page references for a passed virtual address.
Returns the number of scatterlist structs in array used
struct kmem_cache* ecryptfs_header_cache |
struct kmem_cache* ecryptfs_key_tfm_cache |