mirror of
https://github.com/openssl/openssl.git
synced 2024-12-21 06:09:35 +08:00
71 lines
1.6 KiB
Bash
Executable File
71 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
PROG=$1
|
|
|
|
if [ -x $PROG ]; then
|
|
if expr "x`$PROG version`" : "xOpenSSL" > /dev/null; then
|
|
:
|
|
else
|
|
echo "$PROG is not OpenSSL executable"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "$PROG is not executable"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ 1 ]; then
|
|
|
|
HASH=`cat $PROG | $PROG dgst -hex`
|
|
|
|
AES_ALGS=" des-cbc des-ede-cbc des-ede3-cbc \
|
|
camellia-128-cbc camellia-128-cfb \
|
|
camellia-192-cbc camellia-192-cfb \
|
|
camellia-256-cbc camellia-256-cfb \
|
|
aes-128-ctr aes-128-cbc aes-128-cfb aes-128-ofb \
|
|
aes-192-ctr aes-192-cbc aes-192-cfb aes-192-ofb \
|
|
aes-256-ctr aes-256-cbc aes-256-cfb aes-256-ofb"
|
|
BUFSIZE="16 32 48 999"
|
|
|
|
nerr=0
|
|
|
|
for alg in $AES_ALGS; do
|
|
echo $alg
|
|
for bufsize in $BUFSIZE; do
|
|
TEST=`( cat $PROG | \
|
|
$PROG enc -e -k "$HASH" -$alg -bufsize $bufsize | \
|
|
env OPENSSL_sparcv9cap=0 $PROG enc -d -k "$HASH" -$alg | \
|
|
$PROG dgst -hex ) 2>/dev/null`
|
|
if [ "$TEST" != "$HASH" ]; then
|
|
echo "-$alg/$bufsize encrypt test failed"
|
|
nerr=`expr $nerr + 1`
|
|
fi
|
|
done
|
|
for bufsize in $BUFSIZE; do
|
|
TEST=`( cat $PROG | \
|
|
env OPENSSL_sparcv9cap=0 $PROG enc -e -k "$HASH" -$alg | \
|
|
$PROG enc -d -k "$HASH" -$alg -bufsize $bufsize | \
|
|
$PROG dgst -hex ) 2>/dev/null`
|
|
if [ "$TEST" != "$HASH" ]; then
|
|
echo "-$alg/$bufsize decrypt test failed"
|
|
nerr=`expr $nerr + 1`
|
|
fi
|
|
done
|
|
TEST=`( cat $PROG | \
|
|
$PROG enc -e -k "$HASH" -$alg | \
|
|
$PROG enc -d -k "$HASH" -$alg | \
|
|
$PROG dgst -hex ) 2>/dev/null`
|
|
if [ "$TEST" != "$HASH" ]; then
|
|
echo "-$alg en/decrypt test failed"
|
|
nerr=`expr $nerr + 1`
|
|
fi
|
|
done
|
|
|
|
if [ $nerr -gt 0 ]; then
|
|
echo "SPARC T4 test failed."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
exit 0
|