[Cryptech-Commits] [sw/pkcs11] branch ksng updated: Clean up time-signature script.

git at cryptech.is git at cryptech.is
Fri Mar 3 21:21:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch ksng
in repository sw/pkcs11.

The following commit(s) were added to refs/heads/ksng by this push:
     new 0decf6b  Clean up time-signature script.
0decf6b is described below

commit 0decf6ba0bcaf7bd4a9dd93c8b71832ea249cf37
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Fri Mar 3 16:21:34 2017 -0500

    Clean up time-signature script.
---
 scripts/time-signature.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/time-signature.py b/scripts/time-signature.py
index 8b4cc5f..eef646d 100755
--- a/scripts/time-signature.py
+++ b/scripts/time-signature.py
@@ -14,7 +14,13 @@ from Crypto.Hash.SHA256 import SHA256Hash as SHA256
 from Crypto.Hash.SHA384 import SHA384Hash as SHA384
 from Crypto.Hash.SHA512 import SHA512Hash as SHA512
 
-from py11 import *
+try:
+    from py11 import *
+except ImportError:
+    # Kludge to let us run script from repo without installing py11
+    from os.path import dirname, abspath
+    sys.path.append(dirname(dirname(abspath(sys.argv[0]))))
+    from py11 import *
 
 
 if platform.system() == "Darwin":
@@ -90,7 +96,8 @@ def main():
     parser.add_argument("-s", "--slot",       default = 0, type = int,                  help = "slot number")
     parser.add_argument("-t", "--token",      action = "store_true",                    help = "store key on token")
     parser.add_argument("-l", "--libpkcs11",  default = libpkcs11_default,              help = "PKCS #11 library")
-    parser.add_argument("-k", "--key",        choices = tuple(key_table), nargs = 1,    help = "test just one key")
+    parser.add_argument("-k", "--keys",       choices = tuple(key_table), nargs = "+",
+                                              default = list(key_table),                help = "keys to test")
     parser.add_argument("-q", "--quiet",      action = "store_true",                    help = "be less chatty")
     args = parser.parse_args()
 
@@ -103,7 +110,7 @@ def main():
     session = p11.C_OpenSession(args.slot)
     p11.C_Login(session, CKU_USER, args.pin)
 
-    for name in args.key or key_table:
+    for name in args.keys:
 
         print "Starting test with key {}, {} iterations".format(name, args.iterations)
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list