summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-08-30 16:45:58 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-08-30 16:45:58 +0000
commit74790fb0200423aad511378558285a8cf3d6845f (patch)
treef47f7ab7515f5dde2d66034173265e7f8678d365
parentea957b6a97b257f42aa8f086b9127a30199c8f14 (diff)
verify that the number of rounds does not decrease
-rw-r--r--regress/sbin/bioctl/Makefile18
1 files changed, 14 insertions, 4 deletions
diff --git a/regress/sbin/bioctl/Makefile b/regress/sbin/bioctl/Makefile
index 4109e1396f9..6bb57229799 100644
--- a/regress/sbin/bioctl/Makefile
+++ b/regress/sbin/bioctl/Makefile
@@ -1,13 +1,15 @@
-# $OpenBSD: Makefile,v 1.6 2023/08/21 18:56:06 kn Exp $
+# $OpenBSD: Makefile,v 1.7 2023/08/30 16:45:57 kn Exp $
BIOCTL ?= /sbin/bioctl
CHUNKFILE = disk.img
CHUNKDEVFILE = chunk.txt
VOLDEVFILE = vol.txt
+ROUNDSFILE = rounds.txt
OLDPW = oldsecret
NEWPW = securenew
+NROUNDS ?= 17
REGRESS_SETUP_ONCE = create-chunk
@@ -19,7 +21,8 @@ create-chunk:
SUCCESS_TESTS = scripted-create-volume \
scripted-recreate-volume \
- scripted-change-passphrase
+ scripted-change-passphrase \
+ verify-increased-rounds
REGRESS_TARGETS = ${SUCCESS_TESTS}
REGRESS_ROOT_TARGETS = ${SUCCESS_TESTS}
@@ -30,12 +33,19 @@ scripted-create-volume:
scripted-recreate-volume: detach-volume
printf '%s\n' '${OLDPW}' | \
- ${SUDO} ${BIOCTL} -s -Cforce -r17 -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \
+ ${SUDO} ${BIOCTL} -s -Cforce -r${NROUNDS} -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \
grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE}
scripted-change-passphrase:
printf '%s\n%s\n' '${OLDPW}' '${NEWPW}' | \
- ${SUDO} ${BIOCTL} -s -P -- "$$(<${VOLDEVFILE})"
+ ${SUDO} ${BIOCTL} -s -P -v -- "$$(<${VOLDEVFILE})" | \
+ tee -- ${ROUNDSFILE}
+
+verify-increased-rounds:
+ awk -safe -vOLD=${NROUNDS} -- '\
+ NR == 1 { old = $$7 }; \
+ NR == 2 { new = $$7 }; \
+ END { exit !(OLD == old && old <= new) }' ${ROUNDSFILE}
FAILURE_TESTS = reuse-active-chunk \