The patch titled ecryptfs: Support for larger maximum key size has been removed from the -mm tree. Its filename is ecryptfs-support-for-larger-maximum-key-size.patch This patch was dropped because it was folded into ecryptfs-fs-makefile-and-fs-kconfig.patch ------------------------------------------------------ Subject: ecryptfs: Support for larger maximum key size From: Mike Halcrow <mhalcrow@xxxxxxxxxx> Support for larger maximum key size. Necessary for future patches that will enable cipher selection and keysize specification. Increments the version number because ECRYPTFS_MAX_KEY_BYTES changes, which changes a struct that is accessed in both userspace and kernel space. Note that with this patch, users must upgrade their userspace utility package to one prefixed ``ecryptfs-util-git-2.6.17-rc6-mm2++'' or higher (see the eCryptfs SourceForge page for userspace utilities). Signed-off-by: Michael Halcrow <mhalcrow@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/ecryptfs/ecryptfs_kernel.h | 4 +-- fs/ecryptfs/keystore.c | 34 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff -puN fs/ecryptfs/ecryptfs_kernel.h~ecryptfs-support-for-larger-maximum-key-size fs/ecryptfs/ecryptfs_kernel.h --- 25/fs/ecryptfs/ecryptfs_kernel.h~ecryptfs-support-for-larger-maximum-key-size Tue Jun 20 17:37:24 2006 +++ 25-akpm/fs/ecryptfs/ecryptfs_kernel.h Tue Jun 20 17:37:24 2006 @@ -32,7 +32,7 @@ /* Version verification for shared data structures w/ userspace */ #define ECRYPTFS_VERSION_MAJOR 0x00 -#define ECRYPTFS_VERSION_MINOR 0x01 +#define ECRYPTFS_VERSION_MINOR 0x02 #define ECRYPTFS_SUPPORTED_FILE_VERSION 0x01 #define ECRYPTFS_MAX_PASSWORD_LENGTH 64 @@ -45,7 +45,7 @@ #define ECRYPTFS_SIG_SIZE 8 #define ECRYPTFS_SIG_SIZE_HEX (ECRYPTFS_SIG_SIZE*2) #define ECRYPTFS_PASSWORD_SIG_SIZE ECRYPTFS_SIG_SIZE_HEX -#define ECRYPTFS_MAX_KEY_BYTES 16 +#define ECRYPTFS_MAX_KEY_BYTES 64 #define ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES 512 #define ECRYPTFS_DEFAULT_IV_BYTES 16 #define ECRYPTFS_FILE_VERSION 0x01 diff -puN fs/ecryptfs/keystore.c~ecryptfs-support-for-larger-maximum-key-size fs/ecryptfs/keystore.c --- 25/fs/ecryptfs/keystore.c~ecryptfs-support-for-larger-maximum-key-size Tue Jun 20 17:37:24 2006 +++ 25-akpm/fs/ecryptfs/keystore.c Tue Jun 20 17:37:24 2006 @@ -486,8 +486,17 @@ static int decrypt_session_key(struct ec rc = -ENOMEM; goto out; } + if (password_s_ptr->session_key_encryption_key_bytes + < crypto_tfm_alg_min_keysize(tfm)) { + printk(KERN_WARNING "Session key encryption key is [%d] bytes; " + "minimum keysize for selected cipher is [%d] bytes.\n", + password_s_ptr->session_key_encryption_key_bytes, + crypto_tfm_alg_min_keysize(tfm)); + rc = -EINVAL; + goto out; + } crypto_cipher_setkey(tfm, password_s_ptr->session_key_encryption_key, - password_s_ptr->session_key_encryption_key_bytes); + (crypt_stat->key_size_bits / 8)); /* TODO: virt_to_scatterlist */ encrypted_session_key = (char *)__get_free_page(GFP_KERNEL); if (!encrypted_session_key) { @@ -806,24 +815,18 @@ write_tag_3_packet(char *dest, int max, ECRYPTFS_SIG_SIZE); (*key_rec).enc_key_size_bits = crypt_stat->key_size_bits; encrypted_session_key_valid = 0; - if (auth_tok->session_key.encrypted_key_size == 0) - auth_tok->session_key.encrypted_key_size = - ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES; - for (i = 0; i < auth_tok->session_key.encrypted_key_size; i++) + for (i = 0; i < (crypt_stat->key_size_bits / 8); i++) encrypted_session_key_valid |= auth_tok->session_key.encrypted_key[i]; - if (auth_tok->session_key.encrypted_key_size == 0) { - ecryptfs_printk(KERN_WARNING, "auth_tok->session_key." - "encrypted_key_size == 0"); - auth_tok->session_key.encrypted_key_size = - ECRYPTFS_DEFAULT_KEY_BYTES; - } if (encrypted_session_key_valid) { memcpy((*key_rec).enc_key, auth_tok->session_key.encrypted_key, auth_tok->session_key.encrypted_key_size); goto encrypted_session_key_set; } + if (auth_tok->session_key.encrypted_key_size == 0) + auth_tok->session_key.encrypted_key_size = + (crypt_stat->key_size_bits / 8); if (ECRYPTFS_CHECK_FLAG(auth_tok->token.password.flags, ECRYPTFS_SESSION_KEY_ENCRYPTION_KEY_SET)) { ecryptfs_printk(KERN_DEBUG, "Using previously generated " @@ -832,8 +835,7 @@ write_tag_3_packet(char *dest, int max, session_key_encryption_key_bytes); memcpy(session_key_encryption_key, auth_tok->token.password.session_key_encryption_key, - auth_tok->token.password. - session_key_encryption_key_bytes); + (crypt_stat->key_size_bits / 8)); ecryptfs_printk(KERN_DEBUG, "Cached session key " "encryption key: \n"); if (ecryptfs_verbosity > 0) @@ -870,7 +872,7 @@ write_tag_3_packet(char *dest, int max, goto out; } rc = crypto_cipher_setkey(tfm, session_key_encryption_key, - ECRYPTFS_DEFAULT_KEY_BYTES); + (crypt_stat->key_size_bits / 8)); if (rc < 0) { ecryptfs_printk(KERN_ERR, "Error setting key for crypto " "context\n"); @@ -880,7 +882,7 @@ write_tag_3_packet(char *dest, int max, ecryptfs_printk(KERN_DEBUG, "Encrypting [%d] bytes of the key\n", crypt_stat->key_size_bits / 8); crypto_cipher_encrypt(tfm, dest_sg, src_sg, - crypt_stat->key_size_bits / 8); + (crypt_stat->key_size_bits / 8)); ecryptfs_printk(KERN_DEBUG, "This should be the encrypted key:\n"); if (ecryptfs_verbosity > 0) ecryptfs_dump_hex((*key_rec).enc_key, @@ -889,7 +891,7 @@ encrypted_session_key_set: /* Now we have a valid key_rec. Append it to the * key_rec set. */ key_rec_size = (sizeof(struct ecryptfs_key_record) - - ECRYPTFS_MAX_KEY_BYTES + - ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES + ((*key_rec).enc_key_size_bits / 8) ); /* TODO: Include a packet size limit as a parameter to this * function once we have multi-packet headers (for versions _ Patches currently in -mm which might be from mhalcrow@xxxxxxxxxx are origin.patch ecryptfs-fs-makefile-and-fs-kconfig.patch ecryptfs-support-for-larger-maximum-key-size.patch ecryptfs-add-codes-for-additional-ciphers.patch ecryptfs-unencrypted-key-size-based-on-encrypted-key-size.patch ecryptfs-packet-and-key-management-update-for-variable-key-size.patch ecryptfs-add-ecryptfs_-prefix-to-mount-options-key-size-parameter.patch ecryptfs-set-the-key-size-from-the-default-for-the-mount.patch ecryptfs-check-for-weak-keys.patch ecryptfs-add-define-values-for-cipher-codes-from-rfc2440-openpgp.patch ecryptfs-convert-bits-to-bytes.patch ecryptfs-more-elegant-aes-key-size-manipulation.patch ecryptfs-more-intelligent-use-of-tfm-objects.patch ecryptfs-remove-debugging-cruft.patch ecryptfs-get_sb_dev-fix.patch ecryptfs-validate-minimum-header-extent-size.patch ecryptfs-validate-body-size.patch ecryptfs-validate-packet-length-prior-to-parsing-add-comments.patch ecryptfs-use-the-passed-in-max-value-as-the-upper-bound.patch ecryptfs-change-the-maximum-size-check-when-writing-header.patch ecryptfs-print-the-actual-option-that-is-problematic.patch ecryptfs-add-a-maintainers-entry.patch ecryptfs-partial-signed-integer-to-size_t-conversion-updated-ii.patch ecryptfs-graceful-handling-of-mount-error.patch ecryptfs-fix-printk-format-warnings.patch ecryptfs-associate-vfsmount-with-dentry-rather-than-superblock.patch ecryptfs-mntput-lower-mount-on-umount_begin.patch vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers-ecryptfs.patch make-kmem_cache_destroy-return-void-ecryptfs.patch ecryptfs-inode-numbering-fixes.patch ecryptfs-versioning-fixes.patch ecryptfs-versioning-fixes-tidy.patch ecryptfs-grab-lock-on-lower_page-in-ecryptfs_sync_page.patch ecryptfs-enable-plaintext-passthrough.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html