Skip to content
Permalink
Browse files
nvmet: Implement basic In-Band Authentication
Implement NVMe-oF In-Band authentication according to NVMe TPAR 8006.
This patch adds three additional configfs entries 'dhchap_key',
'dhchap_ctrl_key', and 'dhchap_hash' to the 'host' configfs directory.
The 'dhchap_key' and 'dhchap_ctrl_key' entries need to be in the ASCII
format as specified in NVMe Base Specification v2.0 section 8.13.5.8
'Secret representation'.
'dhchap_hash' defaults to 'hmac(sha256)', and can be written to to
switch to a different HMAC algorithm.

Signed-off-by: Hannes Reinecke <hare@suse.de>
  • Loading branch information
hreinecke authored and intel-lab-lkp committed Nov 12, 2021
1 parent c6e4a6c commit e5bfdfa04f93ef1857a48ce68e035aab7fe8b066
Show file tree
Hide file tree
Showing 10 changed files with 1,110 additions and 3 deletions.
@@ -16,6 +16,7 @@ int nvme_auth_dhgroup_id(const char *dhgroup_name);

const char *nvme_auth_hmac_name(int hmac_id);
const char *nvme_auth_digest_name(int hmac_id);
int nvme_auth_hmac_hash_len(int hmac_id);
int nvme_auth_hmac_id(const char *hmac_name);

unsigned char *nvme_auth_extract_secret(unsigned char *secret,
@@ -83,3 +83,14 @@ config NVME_TARGET_TCP
devices over TCP.

If unsure, say N.

config NVME_TARGET_AUTH
bool "NVMe over Fabrics In-band Authentication support"
depends on NVME_TARGET
select CRYPTO_HMAC
select CRYPTO_SHA256
select CRYPTO_SHA512
help
This enables support for NVMe over Fabrics In-band Authentication

If unsure, say N.
@@ -13,6 +13,7 @@ nvmet-y += core.o configfs.o admin-cmd.o fabrics-cmd.o \
discovery.o io-cmd-file.o io-cmd-bdev.o
nvmet-$(CONFIG_NVME_TARGET_PASSTHRU) += passthru.o
nvmet-$(CONFIG_BLK_DEV_ZONED) += zns.o
nvmet-$(CONFIG_NVME_TARGET_AUTH) += fabrics-cmd-auth.o auth.o
nvme-loop-y += loop.o
nvmet-rdma-y += rdma.o
nvmet-fc-y += fc.o
@@ -1014,6 +1014,10 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)

if (nvme_is_fabrics(cmd))
return nvmet_parse_fabrics_cmd(req);

if (unlikely(!nvmet_check_auth_status(req)))
return NVME_SC_AUTH_REQUIRED | NVME_SC_DNR;

if (nvmet_is_disc_subsys(nvmet_req_subsys(req)))
return nvmet_parse_discovery_cmd(req);

0 comments on commit e5bfdfa

Please sign in to comment.