test_t4 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. PROG=$1
  3. if [ -x $PROG ]; then
  4. if expr "x`$PROG version`" : "xOpenSSL" > /dev/null; then
  5. :
  6. else
  7. echo "$PROG is not OpenSSL executable"
  8. exit 1
  9. fi
  10. else
  11. echo "$PROG is not executable"
  12. exit 1;
  13. fi
  14. if [ 1 ]; then
  15. HASH=`cat $PROG | $PROG dgst -hex`
  16. AES_ALGS=" des-cbc des-ede-cbc des-ede3-cbc \
  17. camellia-128-cbc camellia-128-cfb \
  18. camellia-192-cbc camellia-192-cfb \
  19. camellia-256-cbc camellia-256-cfb \
  20. aes-128-ctr aes-128-cbc aes-128-cfb aes-128-ofb \
  21. aes-192-ctr aes-192-cbc aes-192-cfb aes-192-ofb \
  22. aes-256-ctr aes-256-cbc aes-256-cfb aes-256-ofb"
  23. BUFSIZE="16 32 48 999"
  24. nerr=0
  25. for alg in $AES_ALGS; do
  26. echo $alg
  27. for bufsize in $BUFSIZE; do
  28. TEST=`( cat $PROG | \
  29. $PROG enc -e -k "$HASH" -$alg -bufsize $bufsize | \
  30. env OPENSSL_sparcv9cap=0 $PROG enc -d -k "$HASH" -$alg | \
  31. $PROG dgst -hex ) 2>/dev/null`
  32. if [ "$TEST" != "$HASH" ]; then
  33. echo "-$alg/$bufsize encrypt test failed"
  34. nerr=`expr $nerr + 1`
  35. fi
  36. done
  37. for bufsize in $BUFSIZE; do
  38. TEST=`( cat $PROG | \
  39. env OPENSSL_sparcv9cap=0 $PROG enc -e -k "$HASH" -$alg | \
  40. $PROG enc -d -k "$HASH" -$alg -bufsize $bufsize | \
  41. $PROG dgst -hex ) 2>/dev/null`
  42. if [ "$TEST" != "$HASH" ]; then
  43. echo "-$alg/$bufsize decrypt test failed"
  44. nerr=`expr $nerr + 1`
  45. fi
  46. done
  47. TEST=`( cat $PROG | \
  48. $PROG enc -e -k "$HASH" -$alg | \
  49. $PROG enc -d -k "$HASH" -$alg | \
  50. $PROG dgst -hex ) 2>/dev/null`
  51. if [ "$TEST" != "$HASH" ]; then
  52. echo "-$alg en/decrypt test failed"
  53. nerr=`expr $nerr + 1`
  54. fi
  55. done
  56. if [ $nerr -gt 0 ]; then
  57. echo "SPARC T4 test failed."
  58. exit 1
  59. fi
  60. fi
  61. exit 0