]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
blk-crypto: add a bio_crypt_ctx() helper
authorChristoph Hellwig <hch@lst.de>
Fri, 9 Jan 2026 06:07:43 +0000 (07:07 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 11 Jan 2026 19:55:41 +0000 (12:55 -0700)
commita3cc978e61f5c909ca94a38d2daeeddc051a18e0
treebe24e0434dab96b39df23660b39a1286e9580216
parentbc26e2efa2c5bb9289fa894834446840dea0bc31
blk-crypto: add a bio_crypt_ctx() helper

This returns the bio_crypt_ctx if CONFIG_BLK_INLINE_ENCRYPTION is enabled
and a crypto context is attached to the bio, else NULL.

The use case is to allow safely dereferencing the context in common code
without needed #ifdef CONFIG_BLK_INLINE_ENCRYPTION.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/blk-crypto.h