dh_speed.sh 949 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. DIR=$(dirname `readlink -f $0`)
  3. # we run an unprinted group, as it seems the first run is inaccurate (cache?)
  4. function modptest {
  5. $DIR/dh_speed "$1" 400 modp768 modp768 modp1024 modp1024s160 modp1536 modp2048 modp2048s224 modp2048s256 | tail -n 7
  6. $DIR/dh_speed "$1" 100 modp1024 modp3072 modp4096 | tail -n 2
  7. $DIR/dh_speed "$1" 5 modp2048 modp6144 modp8192 | tail -n 2
  8. }
  9. echo "testing gmp"
  10. # gmp needs an RNG plugin, pick gcrypt
  11. modptest "gmp gcrypt"
  12. echo "testing curve25519"
  13. # curve25519 needs an RNG plugin, pick gcrypt
  14. $DIR/dh_speed "curve25519 gcrypt" 300 curve25519 curve25519 | tail -n 1
  15. echo "testing gcrypt"
  16. modptest "gcrypt"
  17. echo "testing openssl"
  18. modptest "openssl"
  19. $DIR/dh_speed "openssl" 300 ecp192 ecp192 ecp224 ecp256 ecp384 ecp521 | tail -n 5
  20. echo "testing botan"
  21. modptest "botan"
  22. $DIR/dh_speed "botan" 300 ecp256 ecp256 ecp384 ecp521 | tail -n 3
  23. $DIR/dh_speed "botan" 300 curve25519 curve25519 | tail -n 1