#!/bin/sh
srcdir="@srcdir@"
rsa="${TESTS_ENVIRONMENT} ./test_rsa@exeext@"
engine="${TESTS_ENVIRONMENT} ./test_engine_dso@exeext@"
rand="${TESTS_ENVIRONMENT} ./test_rand@exeext@"
${engine} --test-random > /dev/null || { echo "missing random"; exit 77; }
${rsa} --key=${srcdir}/rsakey.der || \
{ echo "rsa test failed" ; exit 1; }
${rsa} --time-key=${srcdir}/rsakey.der || \
{ echo "rsa test failed" ; exit 1; }
${rsa} --time-key=${srcdir}/rsakey2048.der || \
{ echo "rsa test failed" ; exit 1; }
${rsa} --time-key=generate || \
{ echo "rsa test failed" ; exit 1; }
${engine} --rsa=${srcdir}/rsakey.der || \
{ echo "engine test failed" ; exit 1; }
${rsa} --loops=4 || { echo "rsa test for 4 loops failed" ; exit 1; }
for a in unix fortuna egd w32crypto ;do
${rand} --method=${a} --file=crypto-test 2>error
res=$?
if test "X$res" != X0 ; then
grep "unknown method" error && \
{ echo "random $a is not available" ; continue; }
grep "random not ready yet" error || \
{ echo "random $a ready failing" ; cat error; exit 1; }
echo "random method $a out for lunch"
continue
fi
${rand} --method=${a} --file=crypto-test2 2>error
res=$?
if test "X$res" != X0 ; then
grep "random not ready yet" error || \
{ echo "random $a ready failing" ; cat error; exit 1; }
echo "random metod $a out for dinner"
continue
fi
cmp crypto-test crypto-test2 >/dev/null 2>/dev/null && \
{ echo "rand output same!" ; exit 1; }
done
./example_evp_cipher 1 ${srcdir}/test_crypto.in test-out-1 || \
{ echo "1 failed" ; exit 1; }
for a in 7 15 16 17 31 32 33 ; do
./example_evp_cipher $a ${srcdir}/test_crypto.in test-out-$a
cmp test-out-1 test-out-$a || { echo "cmp $a failed" ; exit 1; }
done
if [ -r /dev/random -o -r /dev/urandom -o -r /dev/srandom -o -r /dev/arandom ] ; then
HOME=
RANDFILE=
unset HOME
unset RANDFILE
${rand} --method=unix --file=unix 2>error
res=$?
if test "X$res" != X0 ; then
grep "unknown method" error && \
{ echo "random unix is not available"; exit 0; }
grep "random not ready yet" error || \
{ echo "random unix ready failing" ; cat error; exit 1; }
echo "random method unix out for lunch"
continue
fi
fi
exit 0