This does not change current behaviour as the driver currently
verifies that the secret size is the same size as the length of
the transformation hash.
Co-developed-by: Akash Appaiah <Akash.Appaiah@xxxxxxxx>
Signed-off-by: Akash Appaiah <Akash.Appaiah@xxxxxxxx>
Signed-off-by: Mark O'Donovan <shiftee@xxxxxxxxxx>
---
V1 -> V2: support target implementation and controller secrets also
drivers/nvme/common/auth.c | 6 +++++-
drivers/nvme/host/auth.c | 4 ++--
drivers/nvme/target/auth.c | 4 ++--
include/linux/nvme-auth.h | 3 ++-
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index d90e4f0c08b7..26a7fbdf4d55 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -243,6 +243,8 @@ u8 *nvme_auth_transform_key(struct nvme_dhchap_key *key, char *nqn)
}
if (key->hash == 0) {
transformed_key = kmemdup(key->key, key->len, GFP_KERNEL);
+ if (transformed_key)
+ key->transformed_len = key->len;
return transformed_key ? transformed_key : ERR_PTR(-ENOMEM);