Skip to content

Commit

Permalink
fs crypto: move per-file encryption from f2fs tree to fs/crypto
Browse files Browse the repository at this point in the history
This patch adds the renamed functions moved from the f2fs crypto files.

1. definitions for per-file encryption used by ext4 and f2fs.

2. crypto.c for encrypt/decrypt functions
 a. IO preparation:
  - fscrypt_get_ctx / fscrypt_release_ctx
 b. before IOs:
  - fscrypt_encrypt_page
  - fscrypt_decrypt_page
  - fscrypt_zeroout_range
 c. after IOs:
  - fscrypt_decrypt_bio_pages
  - fscrypt_pullback_bio_page
  - fscrypt_restore_control_page

3. policy.c supporting context management.
 a. For ioctls:
  - fscrypt_process_policy
  - fscrypt_get_policy
 b. For context permission
  - fscrypt_has_permitted_context
  - fscrypt_inherit_context

4. keyinfo.c to handle permissions
  - fscrypt_get_encryption_info
  - fscrypt_free_encryption_info

5. fname.c to support filename encryption
 a. general wrapper functions
  - fscrypt_fname_disk_to_usr
  - fscrypt_fname_usr_to_disk
  - fscrypt_setup_filename
  - fscrypt_free_filename

 b. specific filename handling functions
  - fscrypt_fname_alloc_buffer
  - fscrypt_fname_free_buffer

6. Makefile and Kconfig

Cc: Al Viro <[email protected]>
Signed-off-by: Michael Halcrow <[email protected]>
Signed-off-by: Ildar Muslukhov <[email protected]>
Signed-off-by: Uday Savagaonkar <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Jaegeuk Kim committed Mar 18, 2016
1 parent 59692b7 commit 0b81d07
Show file tree
Hide file tree
Showing 25 changed files with 1,633 additions and 1,322 deletions.
2 changes: 2 additions & 0 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ config MANDATORY_FILE_LOCKING

To the best of my knowledge this is dead code that no one cares about.

source "fs/crypto/Kconfig"

source "fs/notify/Kconfig"

source "fs/quota/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ obj-$(CONFIG_EVENTFD) += eventfd.o
obj-$(CONFIG_USERFAULTFD) += userfaultfd.o
obj-$(CONFIG_AIO) += aio.o
obj-$(CONFIG_FS_DAX) += dax.o
obj-$(CONFIG_FS_ENCRYPTION) += crypto/
obj-$(CONFIG_FILE_LOCKING) += locks.o
obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o
Expand Down
18 changes: 18 additions & 0 deletions fs/crypto/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
config FS_ENCRYPTION
tristate "FS Encryption (Per-file encryption)"
depends on BLOCK
select CRYPTO
select CRYPTO_AES
select CRYPTO_CBC
select CRYPTO_ECB
select CRYPTO_XTS
select CRYPTO_CTS
select CRYPTO_CTR
select CRYPTO_SHA256
select KEYS
select ENCRYPTED_KEYS
help
Enable encryption of files and directories. This
feature is similar to ecryptfs, but it is more memory
efficient since it avoids caching the encrypted and
decrypted pages in the page cache.
3 changes: 3 additions & 0 deletions fs/crypto/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
obj-$(CONFIG_FS_ENCRYPTION) += fscrypto.o

fscrypto-y := crypto.o fname.o policy.o keyinfo.o
Loading

0 comments on commit 0b81d07

Please sign in to comment.