keygen-moduli.sh 900 B

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