]> www.infradead.org Git - users/hch/blktests.git/commitdiff
nvme/043: test hash and dh group variations for authenticated connections
authorHannes Reinecke <hare@suse.de>
Thu, 30 Sep 2021 13:52:36 +0000 (15:52 +0200)
committerHannes Reinecke <hare@suse.com>
Wed, 20 Jul 2022 14:47:20 +0000 (16:47 +0200)
Signed-off-by: Hannes Reinecke <hare@suse.de>
tests/nvme/043 [new file with mode: 0755]
tests/nvme/043.out [new file with mode: 0644]

diff --git a/tests/nvme/043 b/tests/nvme/043
new file mode 100755 (executable)
index 0000000..381ae75
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Hannes Reinecke, SUSE Labs
+#
+# Test hash and dh group variations for authenticated connections
+
+. tests/nvme/rc
+
+DESCRIPTION="Test hash and DH group variations for authenticated connections"
+QUICK=1
+
+requires() {
+       _nvme_requires
+       _have_loop
+       _have_kernel_option NVME_AUTH
+       _have_kernel_option NVME_TARGET_AUTH
+       _require_nvme_trtype_is_fabrics
+       _require_nvme_cli_auth
+}
+
+
+test() {
+       local port
+       local subsys_name="blktests-subsystem-1"
+       local hostid
+       local hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       local file_path="${TMPDIR}/img"
+       local hash
+       local dhgroup
+       local hostkey
+       local ctrldev
+
+       echo "Running ${TEST_NAME}"
+
+       hostid="$(uuidgen)"
+       if [ -z "$hostid" ] ; then
+               echo "uuidgen failed"
+               return 1
+       fi
+
+       _setup_nvmet
+
+       truncate -s 512M "${file_path}"
+
+       _create_nvmet_subsystem "${subsys_name}" "${file_path}"
+       port="$(_create_nvmet_port "${nvme_trtype}")"
+       _add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+       _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}"
+
+       for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do
+
+               echo "Testing hash ${hash}"
+
+               _set_nvmet_hash "${hostnqn}" "${hash}"
+
+               _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
+                                    "${def_traddr}" "${def_trsvcid}" \
+                                    "${hostnqn}" "${hostid}" \
+                                    "${hostkey}"
+
+               udevadm settle
+
+               _nvme_disconnect_subsys "${subsys_name}"
+       done
+
+       for dhgroup in "ffdhe2048" "ffdhe3072" "ffdhe4096" "ffdhe6144" "ffdhe8192" ; do
+
+               echo "Testing DH group ${dhgroup}"
+
+               _set_nvmet_dhgroup "${hostnqn}" "${dhgroup}"
+
+               _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
+                                    "${def_traddr}" "${def_trsvcid}" \
+                                    "${hostnqn}" "${hostid}" \
+                                    "${hostkey}"
+
+               udevadm settle
+
+               _nvme_disconnect_subsys "${subsys_name}"
+       done
+
+       _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+       _remove_nvmet_subsystem "${subsys_name}"
+
+       _remove_nvmet_port "${port}"
+
+       _remove_nvmet_host "${hostnqn}"
+
+       rm "${file_path}"
+
+       echo "Test complete"
+}
diff --git a/tests/nvme/043.out b/tests/nvme/043.out
new file mode 100644 (file)
index 0000000..7419f91
--- /dev/null
@@ -0,0 +1,18 @@
+Running nvme/043
+Testing hash hmac(sha256)
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing hash hmac(sha384)
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing hash hmac(sha512)
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing DH group ffdhe2048
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing DH group ffdhe3072
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing DH group ffdhe4096
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing DH group ffdhe6144
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Testing DH group ffdhe8192
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete