diff options
Diffstat (limited to 'src/test/ntor_ref.py')
-rwxr-xr-x[-rw-r--r--] | src/test/ntor_ref.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/test/ntor_ref.py b/src/test/ntor_ref.py index ade468da7..2a5f98460 100644..100755 --- a/src/test/ntor_ref.py +++ b/src/test/ntor_ref.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # Copyright 2012-2013, The Tor Project, Inc # See LICENSE for licensing information @@ -27,7 +28,13 @@ commands: """ import binascii -import curve25519 +try: + import curve25519 +except ImportError: + curve25519 = None + print "SKIPPING: No Python curve25519 module installed" + import sys + sys.exit(0) import hashlib import hmac import subprocess @@ -286,6 +293,7 @@ def demo(node_id="iToldYouAboutStairs.", server_key=PrivateKey()): assert len(skeys) == 72 assert len(ckeys) == 72 assert skeys == ckeys + print "OK" # ====================================================================== def timing(): @@ -368,13 +376,15 @@ def test_tor(): assert c_keys == s_keys assert len(c_keys) == 90 - print "We just interoperated." + print "OK" # ====================================================================== if __name__ == '__main__': import sys - if sys.argv[1] == 'gen_kdf_vectors': + if len(sys.argv) < 2: + print __doc__ + elif sys.argv[1] == 'gen_kdf_vectors': kdf_vectors() elif sys.argv[1] == 'timing': timing() |