aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/crypto.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-10-16 04:28:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:11 -0400
commit22e78fafbdf84883f70eb4944cf658fc23c4a1f4 (patch)
tree1b922f289e05f01d5c8d02427617cdb9bd66707c /fs/ecryptfs/crypto.c
parent6c6f57f3bee1e3c3d31b08a0161c435bfaeb77eb (diff)
eCryptfs: kerneldoc fixes for crypto.c and keystore.c
Andrew Morton wrote: From: mhalcrow@us.ibm.com <mhalcrow@halcrow.austin.ibm.com> > > +/** > > + * decrypt_passphrase_encrypted_session_key - Decrypt the session key > > + * with the given auth_tok. > > * > > * Returns Zero on success; non-zero error otherwise. > > */ > > That comment purports to be a kerneldoc-style comment. But > > - kerneldoc doesn't support multiple lines on the introductory line > which identifies the name of the function (alas). So you'll need to > overflow 80 cols here. > > - the function args weren't documented > > But the return value is! People regularly forget to do that. And > they frequently forget to document the locking prerequisites and the > permissible calling contexts (process/might_sleep/hardirq, etc) > > (please check all ecryptfs kerneldoc for this stuff sometime) This patch cleans up some of the existing comments and makes a couple of line break tweaks. There is more work to do to bring eCryptfs into full kerneldoc-compliance. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r--fs/ecryptfs/crypto.c69
1 files changed, 52 insertions, 17 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 6051dbfad0d3..7aa2f48978de 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -722,6 +722,11 @@ out:
722 722
723/** 723/**
724 * decrypt_scatterlist 724 * decrypt_scatterlist
725 * @crypt_stat: Cryptographic context
726 * @dest_sg: The destination scatterlist to decrypt into
727 * @src_sg: The source scatterlist to decrypt from
728 * @size: The number of bytes to decrypt
729 * @iv: The initialization vector to use for the decryption
725 * 730 *
726 * Returns the number of bytes decrypted; negative value on error 731 * Returns the number of bytes decrypted; negative value on error
727 */ 732 */
@@ -763,6 +768,13 @@ out:
763 768
764/** 769/**
765 * ecryptfs_encrypt_page_offset 770 * ecryptfs_encrypt_page_offset
771 * @crypt_stat: The cryptographic context
772 * @dst_page: The page to encrypt into
773 * @dst_offset: The offset in the page to encrypt into
774 * @src_page: The page to encrypt from
775 * @src_offset: The offset in the page to encrypt from
776 * @size: The number of bytes to encrypt
777 * @iv: The initialization vector to use for the encryption
766 * 778 *
767 * Returns the number of bytes encrypted 779 * Returns the number of bytes encrypted
768 */ 780 */
@@ -785,6 +797,13 @@ ecryptfs_encrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,
785 797
786/** 798/**
787 * ecryptfs_decrypt_page_offset 799 * ecryptfs_decrypt_page_offset
800 * @crypt_stat: The cryptographic context
801 * @dst_page: The page to decrypt into
802 * @dst_offset: The offset in the page to decrypt into
803 * @src_page: The page to decrypt from
804 * @src_offset: The offset in the page to decrypt from
805 * @size: The number of bytes to decrypt
806 * @iv: The initialization vector to use for the decryption
788 * 807 *
789 * Returns the number of bytes decrypted 808 * Returns the number of bytes decrypted
790 */ 809 */
@@ -940,6 +959,8 @@ static void ecryptfs_generate_new_key(struct ecryptfs_crypt_stat *crypt_stat)
940 959
941/** 960/**
942 * ecryptfs_copy_mount_wide_flags_to_inode_flags 961 * ecryptfs_copy_mount_wide_flags_to_inode_flags
962 * @crypt_stat: The inode's cryptographic context
963 * @mount_crypt_stat: The mount point's cryptographic context
943 * 964 *
944 * This function propagates the mount-wide flags to individual inode 965 * This function propagates the mount-wide flags to individual inode
945 * flags. 966 * flags.
@@ -980,7 +1001,8 @@ out:
980 1001
981/** 1002/**
982 * ecryptfs_set_default_crypt_stat_vals 1003 * ecryptfs_set_default_crypt_stat_vals
983 * @crypt_stat 1004 * @crypt_stat: The inode's cryptographic context
1005 * @mount_crypt_stat: The mount point's cryptographic context
984 * 1006 *
985 * Default values in the event that policy does not override them. 1007 * Default values in the event that policy does not override them.
986 */ 1008 */
@@ -1000,7 +1022,7 @@ static void ecryptfs_set_default_crypt_stat_vals(
1000 1022
1001/** 1023/**
1002 * ecryptfs_new_file_context 1024 * ecryptfs_new_file_context
1003 * @ecryptfs_dentry 1025 * @ecryptfs_dentry: The eCryptfs dentry
1004 * 1026 *
1005 * If the crypto context for the file has not yet been established, 1027 * If the crypto context for the file has not yet been established,
1006 * this is where we do that. Establishing a new crypto context 1028 * this is where we do that. Establishing a new crypto context
@@ -1017,7 +1039,6 @@ static void ecryptfs_set_default_crypt_stat_vals(
1017 * 1039 *
1018 * Returns zero on success; non-zero otherwise 1040 * Returns zero on success; non-zero otherwise
1019 */ 1041 */
1020/* Associate an authentication token(s) with the file */
1021int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry) 1042int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry)
1022{ 1043{
1023 struct ecryptfs_crypt_stat *crypt_stat = 1044 struct ecryptfs_crypt_stat *crypt_stat =
@@ -1095,7 +1116,7 @@ static struct ecryptfs_flag_map_elem ecryptfs_flag_map[] = {
1095 1116
1096/** 1117/**
1097 * ecryptfs_process_flags 1118 * ecryptfs_process_flags
1098 * @crypt_stat 1119 * @crypt_stat: The cryptographic context
1099 * @page_virt: Source data to be parsed 1120 * @page_virt: Source data to be parsed
1100 * @bytes_read: Updated with the number of bytes read 1121 * @bytes_read: Updated with the number of bytes read
1101 * 1122 *
@@ -1183,7 +1204,7 @@ ecryptfs_cipher_code_str_map[] = {
1183 1204
1184/** 1205/**
1185 * ecryptfs_code_for_cipher_string 1206 * ecryptfs_code_for_cipher_string
1186 * @str: The string representing the cipher name 1207 * @crypt_stat: The cryptographic context
1187 * 1208 *
1188 * Returns zero on no match, or the cipher code on match 1209 * Returns zero on no match, or the cipher code on match
1189 */ 1210 */
@@ -1241,9 +1262,9 @@ int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code)
1241 1262
1242/** 1263/**
1243 * ecryptfs_read_header_region 1264 * ecryptfs_read_header_region
1244 * @data 1265 * @data: The virtual address to write header region data into
1245 * @dentry 1266 * @dentry: The lower dentry
1246 * @nd 1267 * @mnt: The lower VFS mount
1247 * 1268 *
1248 * Returns zero on success; non-zero otherwise 1269 * Returns zero on success; non-zero otherwise
1249 */ 1270 */
@@ -1315,9 +1336,10 @@ struct kmem_cache *ecryptfs_header_cache_2;
1315 1336
1316/** 1337/**
1317 * ecryptfs_write_headers_virt 1338 * ecryptfs_write_headers_virt
1318 * @page_virt 1339 * @page_virt: The virtual address to write the headers to
1319 * @crypt_stat 1340 * @size: Set to the number of bytes written by this function
1320 * @ecryptfs_dentry 1341 * @crypt_stat: The cryptographic context
1342 * @ecryptfs_dentry: The eCryptfs dentry
1321 * 1343 *
1322 * Format version: 1 1344 * Format version: 1
1323 * 1345 *
@@ -1371,9 +1393,9 @@ static int ecryptfs_write_headers_virt(char *page_virt, size_t *size,
1371 return rc; 1393 return rc;
1372} 1394}
1373 1395
1374static int ecryptfs_write_metadata_to_contents(struct ecryptfs_crypt_stat *crypt_stat, 1396static int
1375 struct file *lower_file, 1397ecryptfs_write_metadata_to_contents(struct ecryptfs_crypt_stat *crypt_stat,
1376 char *page_virt) 1398 struct file *lower_file, char *page_virt)
1377{ 1399{
1378 mm_segment_t oldfs; 1400 mm_segment_t oldfs;
1379 int current_header_page; 1401 int current_header_page;
@@ -1415,9 +1437,10 @@ out:
1415 return rc; 1437 return rc;
1416} 1438}
1417 1439
1418static int ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry, 1440static int
1419 struct ecryptfs_crypt_stat *crypt_stat, 1441ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry,
1420 char *page_virt, size_t size) 1442 struct ecryptfs_crypt_stat *crypt_stat,
1443 char *page_virt, size_t size)
1421{ 1444{
1422 int rc; 1445 int rc;
1423 1446
@@ -1428,6 +1451,7 @@ static int ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry,
1428 1451
1429/** 1452/**
1430 * ecryptfs_write_metadata 1453 * ecryptfs_write_metadata
1454 * @ecryptfs_dentry: The eCryptfs dentry
1431 * @lower_file: The lower file struct, which was returned from dentry_open 1455 * @lower_file: The lower file struct, which was returned from dentry_open
1432 * 1456 *
1433 * Write the file headers out. This will likely involve a userspace 1457 * Write the file headers out. This will likely involve a userspace
@@ -1525,6 +1549,7 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat,
1525 1549
1526/** 1550/**
1527 * set_default_header_data 1551 * set_default_header_data
1552 * @crypt_stat: The cryptographic context
1528 * 1553 *
1529 * For version 0 file format; this function is only for backwards 1554 * For version 0 file format; this function is only for backwards
1530 * compatibility for files created with the prior versions of 1555 * compatibility for files created with the prior versions of
@@ -1538,6 +1563,10 @@ static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat)
1538 1563
1539/** 1564/**
1540 * ecryptfs_read_headers_virt 1565 * ecryptfs_read_headers_virt
1566 * @page_virt: The virtual address into which to read the headers
1567 * @crypt_stat: The cryptographic context
1568 * @ecryptfs_dentry: The eCryptfs dentry
1569 * @validate_header_size: Whether to validate the header size while reading
1541 * 1570 *
1542 * Read/parse the header data. The header format is detailed in the 1571 * Read/parse the header data. The header format is detailed in the
1543 * comment block for the ecryptfs_write_headers_virt() function. 1572 * comment block for the ecryptfs_write_headers_virt() function.
@@ -1597,9 +1626,13 @@ out:
1597 1626
1598/** 1627/**
1599 * ecryptfs_read_xattr_region 1628 * ecryptfs_read_xattr_region
1629 * @page_virt: The vitual address into which to read the xattr data
1630 * @ecryptfs_dentry: The eCryptfs dentry
1600 * 1631 *
1601 * Attempts to read the crypto metadata from the extended attribute 1632 * Attempts to read the crypto metadata from the extended attribute
1602 * region of the lower file. 1633 * region of the lower file.
1634 *
1635 * Returns zero on success; non-zero on error
1603 */ 1636 */
1604int ecryptfs_read_xattr_region(char *page_virt, struct dentry *ecryptfs_dentry) 1637int ecryptfs_read_xattr_region(char *page_virt, struct dentry *ecryptfs_dentry)
1605{ 1638{
@@ -1638,6 +1671,8 @@ out:
1638 1671
1639/** 1672/**
1640 * ecryptfs_read_metadata 1673 * ecryptfs_read_metadata
1674 * @ecryptfs_dentry: The eCryptfs dentry
1675 * @lower_file: The lower file from which to read the metadata
1641 * 1676 *
1642 * Common entry point for reading file metadata. From here, we could 1677 * Common entry point for reading file metadata. From here, we could
1643 * retrieve the header information from the header region of the file, 1678 * retrieve the header information from the header region of the file,