aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/keystore.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/ecryptfs/keystore.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'fs/ecryptfs/keystore.c')
-rw-r--r--fs/ecryptfs/keystore.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 2333203a120..ac1ad48c237 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -109,7 +109,7 @@ int ecryptfs_parse_packet_length(unsigned char *data, size_t *size,
109 (*size) += ((unsigned char)(data[1]) + 192); 109 (*size) += ((unsigned char)(data[1]) + 192);
110 (*length_size) = 2; 110 (*length_size) = 2;
111 } else if (data[0] == 255) { 111 } else if (data[0] == 255) {
112 /* If support is added, adjust ECRYPTFS_MAX_PKT_LEN_SIZE */ 112 /* Five-byte length; we're not supposed to see this */
113 ecryptfs_printk(KERN_ERR, "Five-byte packet length not " 113 ecryptfs_printk(KERN_ERR, "Five-byte packet length not "
114 "supported\n"); 114 "supported\n");
115 rc = -EINVAL; 115 rc = -EINVAL;
@@ -126,7 +126,7 @@ out:
126/** 126/**
127 * ecryptfs_write_packet_length 127 * ecryptfs_write_packet_length
128 * @dest: The byte array target into which to write the length. Must 128 * @dest: The byte array target into which to write the length. Must
129 * have at least ECRYPTFS_MAX_PKT_LEN_SIZE bytes allocated. 129 * have at least 5 bytes allocated.
130 * @size: The length to write. 130 * @size: The length to write.
131 * @packet_size_length: The number of bytes used to encode the packet 131 * @packet_size_length: The number of bytes used to encode the packet
132 * length is written to this address. 132 * length is written to this address.
@@ -146,7 +146,6 @@ int ecryptfs_write_packet_length(char *dest, size_t size,
146 dest[1] = ((size - 192) % 256); 146 dest[1] = ((size - 192) % 256);
147 (*packet_size_length) = 2; 147 (*packet_size_length) = 2;
148 } else { 148 } else {
149 /* If support is added, adjust ECRYPTFS_MAX_PKT_LEN_SIZE */
150 rc = -EINVAL; 149 rc = -EINVAL;
151 ecryptfs_printk(KERN_WARNING, 150 ecryptfs_printk(KERN_WARNING,
152 "Unsupported packet size: [%zd]\n", size); 151 "Unsupported packet size: [%zd]\n", size);
@@ -679,7 +678,10 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes,
679 * Octets N3-N4: Block-aligned encrypted filename 678 * Octets N3-N4: Block-aligned encrypted filename
680 * - Consists of a minimum number of random characters, a \0 679 * - Consists of a minimum number of random characters, a \0
681 * separator, and then the filename */ 680 * separator, and then the filename */
682 s->max_packet_size = (ECRYPTFS_TAG_70_MAX_METADATA_SIZE 681 s->max_packet_size = (1 /* Tag 70 identifier */
682 + 3 /* Max Tag 70 packet size */
683 + ECRYPTFS_SIG_SIZE /* FNEK sig */
684 + 1 /* Cipher identifier */
683 + s->block_aligned_filename_size); 685 + s->block_aligned_filename_size);
684 if (dest == NULL) { 686 if (dest == NULL) {
685 (*packet_size) = s->max_packet_size; 687 (*packet_size) = s->max_packet_size;
@@ -931,10 +933,10 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size,
931 goto out; 933 goto out;
932 } 934 }
933 s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; 935 s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
934 if (max_packet_size < ECRYPTFS_TAG_70_MIN_METADATA_SIZE) { 936 if (max_packet_size < (1 + 1 + ECRYPTFS_SIG_SIZE + 1 + 1)) {
935 printk(KERN_WARNING "%s: max_packet_size is [%zd]; it must be " 937 printk(KERN_WARNING "%s: max_packet_size is [%zd]; it must be "
936 "at least [%d]\n", __func__, max_packet_size, 938 "at least [%d]\n", __func__, max_packet_size,
937 ECRYPTFS_TAG_70_MIN_METADATA_SIZE); 939 (1 + 1 + ECRYPTFS_SIG_SIZE + 1 + 1));
938 rc = -EINVAL; 940 rc = -EINVAL;
939 goto out; 941 goto out;
940 } 942 }