xref: /freebsd/crypto/openssh/regress/keygen-moduli.sh (revision faf25f48d601ae39f5752602f3020e2e92605625)
1#	$OpenBSD: keygen-moduli.sh,v 1.4 2020/01/02 13:25:38 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="keygen moduli"
5
6dhgex=0
7for kex in `${SSH} -Q kex`; do
8	case $kex in
9		diffie-hellman-group*)	dhgex=1 ;;
10	esac
11done
12
13# Try "start at the beginning and stop after 1", "skip 1 then stop after 1"
14# and "skip 2 and run to the end with checkpointing".  Since our test data
15# file has 3 lines, these should always result in 1 line of output.
16if [ "x$dhgex" = "x1" ]; then
17    for i in "-O lines=1" "-O start-line=1 -O lines=1" "-O start-line=2 -O checkpoint=$OBJ/moduli.ckpt"; do
18	trace "keygen $i"
19	rm -f $OBJ/moduli.out $OBJ/moduli.ckpt
20	${SSHKEYGEN} -M screen -f ${SRC}/moduli.in $i $OBJ/moduli.out 2>/dev/null || \
21	    fail "keygen screen failed $i"
22	lines=`wc -l <$OBJ/moduli.out`
23	test "$lines" -eq "1" || fail "expected 1 line, got $lines"
24    done
25fi
26
27rm -f $OBJ/moduli.out $OBJ/moduli.ckpt
28