Skip to content

Commit 488f668

Browse files
Satya Tangiralaaxboe
authored andcommitted
block: blk-crypto-fallback for Inline Encryption
Blk-crypto delegates crypto operations to inline encryption hardware when available. The separately configurable blk-crypto-fallback contains a software fallback to the kernel crypto API - when enabled, blk-crypto will use this fallback for en/decryption when inline encryption hardware is not available. This lets upper layers not have to worry about whether or not the underlying device has support for inline encryption before deciding to specify an encryption context for a bio. It also allows for testing without actual inline encryption hardware - in particular, it makes it possible to test the inline encryption code in ext4 and f2fs simply by running xfstests with the inlinecrypt mount option, which in turn allows for things like the regular upstream regression testing of ext4 to cover the inline encryption code paths. For more details, refer to Documentation/block/inline-encryption.rst. Signed-off-by: Satya Tangirala <satyat@google.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d145dc2 commit 488f668

6 files changed

Lines changed: 752 additions & 21 deletions

File tree

block/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ config BLK_INLINE_ENCRYPTION
193193
block layer handle encryption, so users can take
194194
advantage of inline encryption hardware if present.
195195

196+
config BLK_INLINE_ENCRYPTION_FALLBACK
197+
bool "Enable crypto API fallback for blk-crypto"
198+
depends on BLK_INLINE_ENCRYPTION
199+
select CRYPTO
200+
select CRYPTO_SKCIPHER
201+
help
202+
Enabling this lets the block layer handle inline encryption
203+
by falling back to the kernel crypto API when inline
204+
encryption hardware is not present.
205+
196206
menu "Partition Types"
197207

198208
source "block/partitions/Kconfig"

block/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o
3737
obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o
3838
obj-$(CONFIG_BLK_PM) += blk-pm.o
3939
obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += keyslot-manager.o blk-crypto.o
40+
obj-$(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) += blk-crypto-fallback.o

0 commit comments

Comments
 (0)