Allow setting the destination port in "dowkd host"
[dowkd.git] / gen / gen-openssl.sh
blob8a5daca769aa0514dd41f01c7fd1152f16150c87
1 #!/bin/bash
3 set -e
5 if ! test -e "$HOME" ; then
6 echo "home directory $HOME does not exist"
7 exit 2
8 fi
10 type=$1
11 case "$type" in
12 rsa[0-9]*)
13 bits=$(echo "$type" | cut --bytes 4-)
14 type=rsa
16 dsa)
17 bits=
19 ?*)
20 echo "key type argument invalid"
21 exit 1
24 echo "key type argument missing"
25 exit 1
27 esac
29 arch=$(dpkg-architecture -qDEB_HOST_ARCH)
30 dso=./setpid-$arch.so
32 prefix=keys/openssl/$arch/$type$bits
33 rm -rf $prefix
34 mkdir -p $prefix/rnd
36 for x in {1..32767} ; do
37 echo "*** PID $x"
38 rm -f $HOME/.rnd
39 LD_PRELOAD=$dso SETPID=$x openssl gen$type -out $prefix/$x.key $bits
40 test -e $HOME/.rnd
41 LD_PRELOAD=$dso SETPID=$x openssl gen$type -out $prefix/$x-rnd.key $bits
42 done