diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-01-12 05:32:03 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-01-12 05:32:03 -0500 |
| commit | e3ee1e123183ca9847e74b7b8e2694c9e3b817a6 (patch) | |
| tree | 652a84674ed05eaa46a813de2223af0bd0168a5a /fs/ecryptfs/ecryptfs_kernel.h | |
| parent | 5762ba1873b0bb9faa631aaa02f533c2b9837f82 (diff) | |
| parent | c59765042f53a79a7a65585042ff463b69cb248c (diff) | |
Merge commit 'v2.6.29-rc1' into timers/hrtimers
Conflicts:
kernel/time/tick-common.c
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
| -rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 105 |
1 files changed, 86 insertions, 19 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index a75026d35d16..c11fc95714ab 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
| @@ -51,12 +51,16 @@ | |||
| 51 | #define ECRYPTFS_VERSIONING_XATTR 0x00000010 | 51 | #define ECRYPTFS_VERSIONING_XATTR 0x00000010 |
| 52 | #define ECRYPTFS_VERSIONING_MULTKEY 0x00000020 | 52 | #define ECRYPTFS_VERSIONING_MULTKEY 0x00000020 |
| 53 | #define ECRYPTFS_VERSIONING_DEVMISC 0x00000040 | 53 | #define ECRYPTFS_VERSIONING_DEVMISC 0x00000040 |
| 54 | #define ECRYPTFS_VERSIONING_HMAC 0x00000080 | ||
| 55 | #define ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION 0x00000100 | ||
| 56 | #define ECRYPTFS_VERSIONING_GCM 0x00000200 | ||
| 54 | #define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \ | 57 | #define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \ |
| 55 | | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \ | 58 | | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \ |
| 56 | | ECRYPTFS_VERSIONING_PUBKEY \ | 59 | | ECRYPTFS_VERSIONING_PUBKEY \ |
| 57 | | ECRYPTFS_VERSIONING_XATTR \ | 60 | | ECRYPTFS_VERSIONING_XATTR \ |
| 58 | | ECRYPTFS_VERSIONING_MULTKEY \ | 61 | | ECRYPTFS_VERSIONING_MULTKEY \ |
| 59 | | ECRYPTFS_VERSIONING_DEVMISC) | 62 | | ECRYPTFS_VERSIONING_DEVMISC \ |
| 63 | | ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION) | ||
| 60 | #define ECRYPTFS_MAX_PASSWORD_LENGTH 64 | 64 | #define ECRYPTFS_MAX_PASSWORD_LENGTH 64 |
| 61 | #define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH | 65 | #define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH |
| 62 | #define ECRYPTFS_SALT_SIZE 8 | 66 | #define ECRYPTFS_SALT_SIZE 8 |
| @@ -199,6 +203,7 @@ ecryptfs_get_key_payload_data(struct key *key) | |||
| 199 | #define ECRYPTFS_DEFAULT_CIPHER "aes" | 203 | #define ECRYPTFS_DEFAULT_CIPHER "aes" |
| 200 | #define ECRYPTFS_DEFAULT_KEY_BYTES 16 | 204 | #define ECRYPTFS_DEFAULT_KEY_BYTES 16 |
| 201 | #define ECRYPTFS_DEFAULT_HASH "md5" | 205 | #define ECRYPTFS_DEFAULT_HASH "md5" |
| 206 | #define ECRYPTFS_TAG_70_DIGEST ECRYPTFS_DEFAULT_HASH | ||
| 202 | #define ECRYPTFS_TAG_1_PACKET_TYPE 0x01 | 207 | #define ECRYPTFS_TAG_1_PACKET_TYPE 0x01 |
| 203 | #define ECRYPTFS_TAG_3_PACKET_TYPE 0x8C | 208 | #define ECRYPTFS_TAG_3_PACKET_TYPE 0x8C |
| 204 | #define ECRYPTFS_TAG_11_PACKET_TYPE 0xED | 209 | #define ECRYPTFS_TAG_11_PACKET_TYPE 0xED |
| @@ -206,30 +211,64 @@ ecryptfs_get_key_payload_data(struct key *key) | |||
| 206 | #define ECRYPTFS_TAG_65_PACKET_TYPE 0x41 | 211 | #define ECRYPTFS_TAG_65_PACKET_TYPE 0x41 |
| 207 | #define ECRYPTFS_TAG_66_PACKET_TYPE 0x42 | 212 | #define ECRYPTFS_TAG_66_PACKET_TYPE 0x42 |
| 208 | #define ECRYPTFS_TAG_67_PACKET_TYPE 0x43 | 213 | #define ECRYPTFS_TAG_67_PACKET_TYPE 0x43 |
| 214 | #define ECRYPTFS_TAG_70_PACKET_TYPE 0x46 /* FNEK-encrypted filename | ||
| 215 | * as dentry name */ | ||
| 216 | #define ECRYPTFS_TAG_71_PACKET_TYPE 0x47 /* FNEK-encrypted filename in | ||
| 217 | * metadata */ | ||
| 218 | #define ECRYPTFS_TAG_72_PACKET_TYPE 0x48 /* FEK-encrypted filename as | ||
| 219 | * dentry name */ | ||
| 220 | #define ECRYPTFS_TAG_73_PACKET_TYPE 0x49 /* FEK-encrypted filename as | ||
| 221 | * metadata */ | ||
| 222 | /* Constraint: ECRYPTFS_FILENAME_MIN_RANDOM_PREPEND_BYTES >= | ||
| 223 | * ECRYPTFS_MAX_IV_BYTES */ | ||
| 224 | #define ECRYPTFS_FILENAME_MIN_RANDOM_PREPEND_BYTES 16 | ||
| 225 | #define ECRYPTFS_NON_NULL 0x42 /* A reasonable substitute for NULL */ | ||
| 209 | #define MD5_DIGEST_SIZE 16 | 226 | #define MD5_DIGEST_SIZE 16 |
| 227 | #define ECRYPTFS_TAG_70_DIGEST_SIZE MD5_DIGEST_SIZE | ||
| 228 | #define ECRYPTFS_FEK_ENCRYPTED_FILENAME_PREFIX "ECRYPTFS_FEK_ENCRYPTED." | ||
| 229 | #define ECRYPTFS_FEK_ENCRYPTED_FILENAME_PREFIX_SIZE 23 | ||
| 230 | #define ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX "ECRYPTFS_FNEK_ENCRYPTED." | ||
| 231 | #define ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE 24 | ||
| 232 | #define ECRYPTFS_ENCRYPTED_DENTRY_NAME_LEN (18 + 1 + 4 + 1 + 32) | ||
| 210 | 233 | ||
| 211 | struct ecryptfs_key_sig { | 234 | struct ecryptfs_key_sig { |
| 212 | struct list_head crypt_stat_list; | 235 | struct list_head crypt_stat_list; |
| 213 | char keysig[ECRYPTFS_SIG_SIZE_HEX]; | 236 | char keysig[ECRYPTFS_SIG_SIZE_HEX]; |
| 214 | }; | 237 | }; |
| 215 | 238 | ||
| 239 | struct ecryptfs_filename { | ||
| 240 | struct list_head crypt_stat_list; | ||
| 241 | #define ECRYPTFS_FILENAME_CONTAINS_DECRYPTED 0x00000001 | ||
| 242 | u32 flags; | ||
| 243 | u32 seq_no; | ||
| 244 | char *filename; | ||
| 245 | char *encrypted_filename; | ||
| 246 | size_t filename_size; | ||
| 247 | size_t encrypted_filename_size; | ||
| 248 | char fnek_sig[ECRYPTFS_SIG_SIZE_HEX]; | ||
| 249 | char dentry_name[ECRYPTFS_ENCRYPTED_DENTRY_NAME_LEN + 1]; | ||
| 250 | }; | ||
| 251 | |||
| 216 | /** | 252 | /** |
| 217 | * This is the primary struct associated with each encrypted file. | 253 | * This is the primary struct associated with each encrypted file. |
| 218 | * | 254 | * |
| 219 | * TODO: cache align/pack? | 255 | * TODO: cache align/pack? |
| 220 | */ | 256 | */ |
| 221 | struct ecryptfs_crypt_stat { | 257 | struct ecryptfs_crypt_stat { |
| 222 | #define ECRYPTFS_STRUCT_INITIALIZED 0x00000001 | 258 | #define ECRYPTFS_STRUCT_INITIALIZED 0x00000001 |
| 223 | #define ECRYPTFS_POLICY_APPLIED 0x00000002 | 259 | #define ECRYPTFS_POLICY_APPLIED 0x00000002 |
| 224 | #define ECRYPTFS_NEW_FILE 0x00000004 | 260 | #define ECRYPTFS_NEW_FILE 0x00000004 |
| 225 | #define ECRYPTFS_ENCRYPTED 0x00000008 | 261 | #define ECRYPTFS_ENCRYPTED 0x00000008 |
| 226 | #define ECRYPTFS_SECURITY_WARNING 0x00000010 | 262 | #define ECRYPTFS_SECURITY_WARNING 0x00000010 |
| 227 | #define ECRYPTFS_ENABLE_HMAC 0x00000020 | 263 | #define ECRYPTFS_ENABLE_HMAC 0x00000020 |
| 228 | #define ECRYPTFS_ENCRYPT_IV_PAGES 0x00000040 | 264 | #define ECRYPTFS_ENCRYPT_IV_PAGES 0x00000040 |
| 229 | #define ECRYPTFS_KEY_VALID 0x00000080 | 265 | #define ECRYPTFS_KEY_VALID 0x00000080 |
| 230 | #define ECRYPTFS_METADATA_IN_XATTR 0x00000100 | 266 | #define ECRYPTFS_METADATA_IN_XATTR 0x00000100 |
| 231 | #define ECRYPTFS_VIEW_AS_ENCRYPTED 0x00000200 | 267 | #define ECRYPTFS_VIEW_AS_ENCRYPTED 0x00000200 |
| 232 | #define ECRYPTFS_KEY_SET 0x00000400 | 268 | #define ECRYPTFS_KEY_SET 0x00000400 |
| 269 | #define ECRYPTFS_ENCRYPT_FILENAMES 0x00000800 | ||
| 270 | #define ECRYPTFS_ENCFN_USE_MOUNT_FNEK 0x00001000 | ||
| 271 | #define ECRYPTFS_ENCFN_USE_FEK 0x00002000 | ||
| 233 | u32 flags; | 272 | u32 flags; |
| 234 | unsigned int file_version; | 273 | unsigned int file_version; |
| 235 | size_t iv_bytes; | 274 | size_t iv_bytes; |
| @@ -332,13 +371,20 @@ struct ecryptfs_mount_crypt_stat { | |||
| 332 | #define ECRYPTFS_XATTR_METADATA_ENABLED 0x00000002 | 371 | #define ECRYPTFS_XATTR_METADATA_ENABLED 0x00000002 |
| 333 | #define ECRYPTFS_ENCRYPTED_VIEW_ENABLED 0x00000004 | 372 | #define ECRYPTFS_ENCRYPTED_VIEW_ENABLED 0x00000004 |
| 334 | #define ECRYPTFS_MOUNT_CRYPT_STAT_INITIALIZED 0x00000008 | 373 | #define ECRYPTFS_MOUNT_CRYPT_STAT_INITIALIZED 0x00000008 |
| 374 | #define ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES 0x00000010 | ||
| 375 | #define ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK 0x00000020 | ||
| 376 | #define ECRYPTFS_GLOBAL_ENCFN_USE_FEK 0x00000040 | ||
| 335 | u32 flags; | 377 | u32 flags; |
| 336 | struct list_head global_auth_tok_list; | 378 | struct list_head global_auth_tok_list; |
| 337 | struct mutex global_auth_tok_list_mutex; | 379 | struct mutex global_auth_tok_list_mutex; |
| 338 | size_t num_global_auth_toks; | 380 | size_t num_global_auth_toks; |
| 339 | size_t global_default_cipher_key_size; | 381 | size_t global_default_cipher_key_size; |
| 382 | size_t global_default_fn_cipher_key_bytes; | ||
| 340 | unsigned char global_default_cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE | 383 | unsigned char global_default_cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE |
| 341 | + 1]; | 384 | + 1]; |
| 385 | unsigned char global_default_fn_cipher_name[ | ||
| 386 | ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1]; | ||
| 387 | char global_default_fnek_sig[ECRYPTFS_SIG_SIZE_HEX + 1]; | ||
| 342 | }; | 388 | }; |
| 343 | 389 | ||
| 344 | /* superblock private data. */ | 390 | /* superblock private data. */ |
| @@ -571,13 +617,22 @@ struct ecryptfs_open_req { | |||
| 571 | int ecryptfs_interpose(struct dentry *hidden_dentry, | 617 | int ecryptfs_interpose(struct dentry *hidden_dentry, |
| 572 | struct dentry *this_dentry, struct super_block *sb, | 618 | struct dentry *this_dentry, struct super_block *sb, |
| 573 | u32 flags); | 619 | u32 flags); |
| 620 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | ||
| 621 | struct dentry *lower_dentry, | ||
| 622 | struct ecryptfs_crypt_stat *crypt_stat, | ||
| 623 | struct inode *ecryptfs_dir_inode, | ||
| 624 | struct nameidata *ecryptfs_nd); | ||
| 625 | int ecryptfs_decode_and_decrypt_filename(char **decrypted_name, | ||
| 626 | size_t *decrypted_name_size, | ||
| 627 | struct dentry *ecryptfs_dentry, | ||
| 628 | const char *name, size_t name_size); | ||
| 574 | int ecryptfs_fill_zeros(struct file *file, loff_t new_length); | 629 | int ecryptfs_fill_zeros(struct file *file, loff_t new_length); |
| 575 | int ecryptfs_decode_filename(struct ecryptfs_crypt_stat *crypt_stat, | 630 | int ecryptfs_encrypt_and_encode_filename( |
| 576 | const char *name, int length, | 631 | char **encoded_name, |
| 577 | char **decrypted_name); | 632 | size_t *encoded_name_size, |
| 578 | int ecryptfs_encode_filename(struct ecryptfs_crypt_stat *crypt_stat, | 633 | struct ecryptfs_crypt_stat *crypt_stat, |
| 579 | const char *name, int length, | 634 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat, |
| 580 | char **encoded_name); | 635 | const char *name, size_t name_size); |
| 581 | struct dentry *ecryptfs_lower_dentry(struct dentry *this_dentry); | 636 | struct dentry *ecryptfs_lower_dentry(struct dentry *this_dentry); |
| 582 | void ecryptfs_dump_hex(char *data, int bytes); | 637 | void ecryptfs_dump_hex(char *data, int bytes); |
| 583 | int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, | 638 | int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, |
| @@ -599,7 +654,7 @@ int ecryptfs_read_and_validate_header_region(char *data, | |||
| 599 | struct inode *ecryptfs_inode); | 654 | struct inode *ecryptfs_inode); |
| 600 | int ecryptfs_read_and_validate_xattr_region(char *page_virt, | 655 | int ecryptfs_read_and_validate_xattr_region(char *page_virt, |
| 601 | struct dentry *ecryptfs_dentry); | 656 | struct dentry *ecryptfs_dentry); |
| 602 | u8 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat); | 657 | u8 ecryptfs_code_for_cipher_string(char *cipher_name, size_t key_bytes); |
| 603 | int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code); | 658 | int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code); |
| 604 | void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat); | 659 | void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat); |
| 605 | int ecryptfs_generate_key_packet_set(char *dest_base, | 660 | int ecryptfs_generate_key_packet_set(char *dest_base, |
| @@ -694,5 +749,17 @@ int ecryptfs_privileged_open(struct file **lower_file, | |||
| 694 | struct vfsmount *lower_mnt, | 749 | struct vfsmount *lower_mnt, |
| 695 | const struct cred *cred); | 750 | const struct cred *cred); |
| 696 | int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry); | 751 | int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry); |
| 752 | int | ||
| 753 | ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, | ||
| 754 | size_t *packet_size, | ||
| 755 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat, | ||
| 756 | char *filename, size_t filename_size); | ||
| 757 | int | ||
| 758 | ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size, | ||
| 759 | size_t *packet_size, | ||
| 760 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat, | ||
| 761 | char *data, size_t max_packet_size); | ||
| 762 | int ecryptfs_derive_iv(char *iv, struct ecryptfs_crypt_stat *crypt_stat, | ||
| 763 | loff_t offset); | ||
| 697 | 764 | ||
| 698 | #endif /* #ifndef ECRYPTFS_KERNEL_H */ | 765 | #endif /* #ifndef ECRYPTFS_KERNEL_H */ |
