Skip to content

Commit 3244552

Browse files
shifteekeithbusch
authored andcommitted
nvme-auth: allow mixing of secret and hash lengths
We can now use any of the secret transformation hashes with a secret, regardless of the secret size. e.g. a 32 byte key with the SHA-512(64 byte) hash. The example secret from the spec should now be permitted with any of the following: DHHC-1:00:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: DHHC-1:01:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: DHHC-1:02:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: DHHC-1:03:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: Note: Secrets are still restricted to 32,48 or 64 bits. Co-developed-by: Akash Appaiah <Akash.Appaiah@dell.com> Signed-off-by: Akash Appaiah <Akash.Appaiah@dell.com> Signed-off-by: Mark O'Donovan <shiftee@posteo.net> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent f047dae commit 3244552

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

drivers/nvme/common/auth.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
190190
goto out_free_secret;
191191
}
192192

193-
if (key_hash > 0 &&
194-
(key_len - 4) != nvme_auth_hmac_hash_len(key_hash)) {
195-
pr_err("Mismatched key len %d for %s\n", key_len,
196-
nvme_auth_hmac_name(key_hash));
197-
ret = -EINVAL;
198-
goto out_free_secret;
199-
}
200-
201193
/* The last four bytes is the CRC in little-endian format */
202194
key_len -= 4;
203195
/*

0 commit comments

Comments
 (0)