mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 12:31:52 -04:00
nvme-auth: add NVME_AUTH_MAX_DIGEST_SIZE constant
Define a NVME_AUTH_MAX_DIGEST_SIZE constant and use it in the appropriate places. Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
67807fbaf1
commit
9100a28c8b
@@ -15,8 +15,6 @@
|
||||
#include <linux/nvme.h>
|
||||
#include <linux/nvme-auth.h>
|
||||
|
||||
#define HKDF_MAX_HASHLEN 64
|
||||
|
||||
static u32 nvme_dhchap_seqnum;
|
||||
static DEFINE_MUTEX(nvme_dhchap_mutex);
|
||||
|
||||
@@ -769,7 +767,7 @@ int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
|
||||
struct crypto_shash *hmac_tfm;
|
||||
const char *hmac_name;
|
||||
const char *label = "nvme-tls-psk";
|
||||
static const char default_salt[HKDF_MAX_HASHLEN];
|
||||
static const char default_salt[NVME_AUTH_MAX_DIGEST_SIZE];
|
||||
size_t prk_len;
|
||||
const char *ctx;
|
||||
unsigned char *prk, *tls_key;
|
||||
@@ -798,7 +796,7 @@ int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
|
||||
goto out_free_shash;
|
||||
}
|
||||
|
||||
if (WARN_ON(prk_len > HKDF_MAX_HASHLEN)) {
|
||||
if (WARN_ON(prk_len > NVME_AUTH_MAX_DIGEST_SIZE)) {
|
||||
ret = -EINVAL;
|
||||
goto out_free_prk;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ struct nvme_dhchap_queue_context {
|
||||
u8 hash_id;
|
||||
u8 sc_c;
|
||||
size_t hash_len;
|
||||
u8 c1[64];
|
||||
u8 c2[64];
|
||||
u8 response[64];
|
||||
u8 c1[NVME_AUTH_MAX_DIGEST_SIZE];
|
||||
u8 c2[NVME_AUTH_MAX_DIGEST_SIZE];
|
||||
u8 response[NVME_AUTH_MAX_DIGEST_SIZE];
|
||||
u8 *ctrl_key;
|
||||
u8 *host_key;
|
||||
u8 *sess_key;
|
||||
|
||||
@@ -1837,6 +1837,11 @@ enum {
|
||||
NVME_AUTH_HASH_INVALID = 0xff,
|
||||
};
|
||||
|
||||
/* Maximum digest size for any NVME_AUTH_HASH_* value */
|
||||
enum {
|
||||
NVME_AUTH_MAX_DIGEST_SIZE = 64,
|
||||
};
|
||||
|
||||
/* Defined Diffie-Hellman group identifiers for DH-HMAC-CHAP authentication */
|
||||
enum {
|
||||
NVME_AUTH_DHGROUP_NULL = 0x00,
|
||||
|
||||
Reference in New Issue
Block a user