Remove the Per File Key logic based inline crypto support
for file encryption framework.
Change-Id: I90071562ba5c41b9db470363edac35c9fe5e4efa
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Set the number of available ICE slots to 30, as the
first two are occupied by FDE.
Change-Id: I24b0e6efa5195697d120430f709c9465e8514f19
Signed-off-by: Shay <shayn@codeaurora.org>
Added pfk_ice_virt.c which sends hab requests to BE in host,
instead of sending scm calls directly to TZ.
Also, removed the hardcoded size of key cache table,
and made it configurable.
Change-Id: I942c3886c2fb93846bcdf15b19eabb3bc83e05ba
Signed-off-by: Shay <shayn@codeaurora.org>
The page->mapping will be set to NULL when it is truncated.
The same metadata page if it is currently under processing by
ext4/jbd2, then it is possible for pfk_bio_get_inode() to see
inconsistent page->mapping, for the requests submitted by jbd2
on this page. To avoid this inconsistency, use cached mapping at
all places in pfk_bio_get_inode(). It doesn't matter whether the
pfk driver sees the mapping or sees null mapping for metadata
requests because, pfk_allow_merge_bio() will always return true
for 2 journal metadata requests and for one journal and one
non-journal request, it always returns false (independent of
the metadata page mapping state).
Change-Id: Ia452f972346e1ba3b25560ffa140d023dbb3409d
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Use non-retrying version of scm calls to
configure ICE keys. This ensures that control is
returned to upper layer as quickly as possible.
Change-Id: Idbecd9301d2f361c17a720c4ac0dcdc393985676
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Remove code related to keymaster calls for setting
ICE as we now wrap/unwrap FBE keys in trustzone
kernel rather than keymaster.
Change-Id: Ib1812de84e6d1a380f87f93fd0f414b4ea24e03a
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
Add support for clearing FBE key and all it's
corresponding data from kernel, trustzone and ICE
when a user is locked or deleted.
Change-Id: I0c1afc1a7fcf2e76cd8e268fea31e68d2efe0130
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
EXT4 FS and F2FS has different way of setting Data Unit Number (DUN)
size value for UFS and eMMC storage devices. EXT4 FS uses sector number
while F2FS uses inode|pgidx. Check Storage and file system type
before setting the DUN value in Inline Crypto Engine (ICE).
Change-Id: I2de18ddd8908ce63b6d54b34b21d750d79f49cc2
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
Check the keymaster version to decide where the wrapped
keys are unwrapped.
Change-Id: Id91bfd33d9719d99de5e5cf39938bc148de7da5c
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
This patch fixes assigning bi_crypt_key for moving data which was previously
encrypted by f2fs.
Note that, dm-default-key should not assign bi_crypt_key, if bi_crypt_skip is
set.
The bug sceanrios is:
1. write data with user key by f2fs
- ENC(KU, IVU, DATA)
2. log out user key
3. read data #1 w/o user key from LBA #a
4. dm-default-key assigns default key
- DEC(KD, LBA#a, ENC(KU, IVU, DATA))
5. write data #1 w/o user key into LBA #b
6. dm-default-key assigns default key
- ENC(KD, LBA#b, DEC(KD, LBA#a, ENC(KU, IVU, DATA)))
7. Read DATA out with valid logged-in user key
- DEC(KU, IVU, ENC(KD, LBA#b, DEC(KD, LBA#a, ENC(KU, IVU, DATA))))
So, this patch introduces bi_crypt_skip to avoid 4. ~ 6 with right flow:
1. write data with user key by f2fs
- ENC(KU, IVU, DATA)
2. log out user key
3. read data #1 w/o user key from LBA #a
4. dm-default-key skip to assign default key
- ENC(KU, IVU, DATA)
5. write data #1 w/o user key into LBA #b
6. dm-default-key skips to assign default key
- ENC(KU, IVU, DATA)
7. Try to read DATA with valid logged-in user key
- DEC(KU, IVU, ENC(KU, IVU, DATA))
Bug: 68721442
Change-Id: Icefe85f608b7c3c84beb2bfa4267efd0f3787453
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
Hardware File Based Encryption (FBE) uses inline crypto
engine to encrypt the user data.
1. security/pfk: changes to support per file
encryption for f2fs using hardware crypto engine.
2. fs/ext4: adapted crypto APIs for generic crypto layer.
3. fs/f2fs: support hardware crypto engine based per file
encryption.
4. fs/crypto: export APIs to support hardware crypto
engine based per file encryption.
5. security/pfe: added wrapped key support based on
upstream changes.
Other changes made to provide support framework for per
file encryption.
Reverting commit e02a4e21f640 ("ext4: Add HW File Based
Encryption on ext4 file system") and adding changes to
have FBE in sync with upstream implementation of FBE.
Change-Id: I17f9909c43ba744eb874f6d237745fbf88a2b848
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
This reverts commit cd1be5fac519d6089289e513deb3b50ae3df9637.
Reverting to have FBE in sync with upstream implementation.
Change-Id: I21d84211c0469d1a4b3d8685033a64cc04854109
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
With new FBE key management changes, the keys are not
available in the clear, but wrapped with an ephemeral key
from keymaster. We cannot use a direct call to the qsee
kernel to set/clear keys as they need to be unwrapped by
keymaster first, which would then call in to the qsee kernel
to set/clear the keys.
Change-Id: Ie3fba8c0613d246efb5577ef6a0254171f082bfe
Signed-off-by: Shivaprasad Hongal <shongal@codeaurora.org>
HW File Based Encryption (FBE) uses Crypto Engine to
encrypt the user data with unique key for each file.
File name and data both are encrypted with this feature.
1. security/pfk: New module to support per file
encryption using CE.
2. fs/ext4: changes made to support using crypto engine
to encyrpt the data.
Other changes made to provide support framework for per
file encryption.
Change-Id: Idea3f6f8bf954c60c3c6caa3d9b048d87fcacbe4
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>