[PATCH 04/17] nvme: add nvme_auth_generate_psk()
Hannes Reinecke
hare at suse.de
Sun Apr 7 22:20:18 PDT 2024
On 4/7/24 22:59, Sagi Grimberg wrote:
>
>
> On 18/03/2024 17:03, Hannes Reinecke wrote:
>> From: Hannes Reinecke <hare at suse.de>
>>
>> Add a function to generate a NVMe PSK from the shared credentials
>> negotiated by DH-HMAC-CHAP.
>>
>> Signed-off-by: Hannes Reinecke <hare at suse.de>
>> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
>> ---
>> drivers/nvme/common/auth.c | 76 ++++++++++++++++++++++++++++++++++++++
>> include/linux/nvme-auth.h | 2 +
>> 2 files changed, 78 insertions(+)
>>
>> diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
>> index a3455f1d67fa..7a4b6589351d 100644
>> --- a/drivers/nvme/common/auth.c
>> +++ b/drivers/nvme/common/auth.c
>> @@ -11,6 +11,7 @@
>> #include <asm/unaligned.h>
>> #include <crypto/hash.h>
>> #include <crypto/dh.h>
>> +#include <crypto/hkdf.h>
>> #include <linux/nvme.h>
>> #include <linux/nvme-auth.h>
>> @@ -471,5 +472,80 @@ int nvme_auth_generate_key(u8 *secret, struct
>> nvme_dhchap_key **ret_key)
>> }
>> EXPORT_SYMBOL_GPL(nvme_auth_generate_key);
>> +u8 *nvme_auth_generate_psk(u8 hmac_id, u8 *skey, size_t skey_len,
>> + u8 *c1, u8 *c2, size_t hash_len, size_t *ret_len)
>
> It seems it would be simpler to have this psk and psk_len as out params and
> return a normal status instead?
>
Tried to shorten the number of arguments; it's long enough already.
But sure, can do.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare at suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
More information about the Linux-nvme
mailing list