Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
keystore.c File Reference
#include <linux/string.h>
#include <linux/syscalls.h>
#include <linux/pagemap.h>
#include <linux/key.h>
#include <linux/random.h>
#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include "ecryptfs_kernel.h"

Go to the source code of this file.

Data Structures

struct  ecryptfs_write_tag_70_packet_silly_stack
 
struct  ecryptfs_parse_tag_70_packet_silly_stack
 

Functions

int ecryptfs_parse_packet_length (unsigned char *data, size_t *size, size_t *length_size)
 
int ecryptfs_write_packet_length (char *dest, size_t size, size_t *packet_size_length)
 
int ecryptfs_write_tag_70_packet (char *dest, size_t *remaining_bytes, size_t *packet_size, struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *filename, size_t filename_size)
 
int ecryptfs_parse_tag_70_packet (char **filename, size_t *filename_size, size_t *packet_size, struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *data, size_t max_packet_size)
 
int ecryptfs_keyring_auth_tok_for_sig (struct key **auth_tok_key, struct ecryptfs_auth_tok **auth_tok, char *sig)
 
int ecryptfs_parse_packet_set (struct ecryptfs_crypt_stat *crypt_stat, unsigned char *src, struct dentry *ecryptfs_dentry)
 
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)
 
int ecryptfs_add_keysig (struct ecryptfs_crypt_stat *crypt_stat, char *sig)
 
int ecryptfs_add_global_auth_tok (struct ecryptfs_mount_crypt_stat *mount_crypt_stat, char *sig, u32 global_auth_tok_flags)
 

Variables

struct kmem_cacheecryptfs_auth_tok_list_item_cache
 
struct kmem_cacheecryptfs_key_record_cache
 
struct kmem_cacheecryptfs_key_sig_cache
 
struct kmem_cacheecryptfs_global_auth_tok_cache
 

Function Documentation

int ecryptfs_add_global_auth_tok ( struct ecryptfs_mount_crypt_stat mount_crypt_stat,
char sig,
u32  global_auth_tok_flags 
)

Definition at line 2507 of file keystore.c.

int ecryptfs_add_keysig ( struct ecryptfs_crypt_stat crypt_stat,
char sig 
)

Definition at line 2486 of file keystore.c.

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 
)

ecryptfs_generate_key_packet_set : Virtual address from which to write the key record set : The cryptographic context from which the authentication tokens will be retrieved : The dentry, used to retrieve the mount crypt stat for the global parameters : The amount written : The maximum amount of data allowed to be written

Generates a key packet set and writes it to the virtual address passed in.

Returns zero on success; non-zero on error.

Definition at line 2392 of file keystore.c.

int ecryptfs_keyring_auth_tok_for_sig ( struct key **  auth_tok_key,
struct ecryptfs_auth_tok **  auth_tok,
char sig 
)

Definition at line 1628 of file keystore.c.

int ecryptfs_parse_packet_length ( unsigned char data,
size_t size,
size_t length_size 
)

ecryptfs_parse_packet_length : Pointer to memory containing length at offset : This function writes the decoded size to this memory address; zero on error : The number of bytes occupied by the encoded length

Returns zero on success; non-zero on error

Definition at line 95 of file keystore.c.

int ecryptfs_parse_packet_set ( struct ecryptfs_crypt_stat crypt_stat,
unsigned char src,
struct dentry ecryptfs_dentry 
)

ecryptfs_parse_packet_set : The cryptographic context : Virtual address of region of memory containing the packets : The eCryptfs dentry associated with the packet set

Get crypt_stat to have the file's session key if the requisite key is available to decrypt the session key.

Returns Zero if a valid authentication token was retrieved and processed; negative value for file not encrypted or for error conditions.

Definition at line 1758 of file keystore.c.

int ecryptfs_parse_tag_70_packet ( char **  filename,
size_t filename_size,
size_t packet_size,
struct ecryptfs_mount_crypt_stat mount_crypt_stat,
char data,
size_t  max_packet_size 
)

parse_tag_70_packet - Parse and process FNEK-encrypted passphrase packet : This function kmalloc's the memory for the filename : This function sets this to the amount of memory kmalloc'd for the filename : This function sets this to the the number of octets in the packet parsed : The mount-wide cryptographic context : The memory location containing the start of the tag 70 packet : The maximum legal size of the packet to be parsed from

Returns zero on success; non-zero otherwise

Definition at line 914 of file keystore.c.

int ecryptfs_write_packet_length ( char dest,
size_t  size,
size_t packet_size_length 
)

ecryptfs_write_packet_length : The byte array target into which to write the length. Must have at least ECRYPTFS_MAX_PKT_LEN_SIZE bytes allocated. : The length to write. : The number of bytes used to encode the packet length is written to this address.

Returns zero on success; non-zero on error.

Definition at line 136 of file keystore.c.

int ecryptfs_write_tag_70_packet ( char dest,
size_t remaining_bytes,
size_t packet_size,
struct ecryptfs_mount_crypt_stat mount_crypt_stat,
char filename,
size_t  filename_size 
)

write_tag_70_packet - Write encrypted filename (EFN) packet against FNEK : NULL-terminated filename string

This is the simplest mechanism for achieving filename encryption in eCryptfs. It encrypts the given filename with the mount-wide filename encryption key (FNEK) and stores it in a packet to , which the callee will encode and write directly into the dentry name.

Definition at line 624 of file keystore.c.

Variable Documentation

struct kmem_cache* ecryptfs_auth_tok_list_item_cache

Definition at line 1223 of file keystore.c.

struct kmem_cache* ecryptfs_global_auth_tok_cache

Definition at line 2504 of file keystore.c.

struct kmem_cache* ecryptfs_key_record_cache

Definition at line 2374 of file keystore.c.

struct kmem_cache* ecryptfs_key_sig_cache

Definition at line 2484 of file keystore.c.