[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250501212320.8281-2-ebiggers@kernel.org>
Date: Thu, 1 May 2025 14:23:19 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: dm-devel@...ts.linux.dev,
Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...nel.org>,
Mikulas Patocka <mpatocka@...hat.com>
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-fscrypt@...r.kernel.org,
Bartosz Golaszewski <brgl@...ev.pl>,
Gaurav Kashyap <quic_gaurkash@...cinc.com>
Subject: [PATCH v2 1/2] blk-crypto: export wrapped key functions
From: Eric Biggers <ebiggers@...gle.com>
Export blk_crypto_derive_sw_secret(), blk_crypto_import_key(),
blk_crypto_generate_key(), and blk_crypto_prepare_key() so that they can
be used by device-mapper when passing through wrapped key support.
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
block/blk-crypto-profile.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/blk-crypto-profile.c b/block/blk-crypto-profile.c
index 94a155912bf1c..81918f6e0caea 100644
--- a/block/blk-crypto-profile.c
+++ b/block/blk-crypto-profile.c
@@ -499,10 +499,11 @@ int blk_crypto_derive_sw_secret(struct block_device *bdev,
err = profile->ll_ops.derive_sw_secret(profile, eph_key, eph_key_size,
sw_secret);
blk_crypto_hw_exit(profile);
return err;
}
+EXPORT_SYMBOL_GPL(blk_crypto_derive_sw_secret);
int blk_crypto_import_key(struct blk_crypto_profile *profile,
const u8 *raw_key, size_t raw_key_size,
u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE])
{
@@ -518,10 +519,11 @@ int blk_crypto_import_key(struct blk_crypto_profile *profile,
ret = profile->ll_ops.import_key(profile, raw_key, raw_key_size,
lt_key);
blk_crypto_hw_exit(profile);
return ret;
}
+EXPORT_SYMBOL_GPL(blk_crypto_import_key);
int blk_crypto_generate_key(struct blk_crypto_profile *profile,
u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE])
{
int ret;
@@ -535,10 +537,11 @@ int blk_crypto_generate_key(struct blk_crypto_profile *profile,
blk_crypto_hw_enter(profile);
ret = profile->ll_ops.generate_key(profile, lt_key);
blk_crypto_hw_exit(profile);
return ret;
}
+EXPORT_SYMBOL_GPL(blk_crypto_generate_key);
int blk_crypto_prepare_key(struct blk_crypto_profile *profile,
const u8 *lt_key, size_t lt_key_size,
u8 eph_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE])
{
@@ -554,10 +557,11 @@ int blk_crypto_prepare_key(struct blk_crypto_profile *profile,
ret = profile->ll_ops.prepare_key(profile, lt_key, lt_key_size,
eph_key);
blk_crypto_hw_exit(profile);
return ret;
}
+EXPORT_SYMBOL_GPL(blk_crypto_prepare_key);
/**
* blk_crypto_intersect_capabilities() - restrict supported crypto capabilities
* by child device
* @parent: the crypto profile for the parent device
--
2.49.0
Powered by blists - more mailing lists