[Cryptech-Commits] [sw/pkcs11] branch master updated: Tweak unit tests to be a bit less annoying on Alpha.

git at cryptech.is git at cryptech.is
Thu Jun 16 04:58:41 UTC 2016


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

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

The following commit(s) were added to refs/heads/master by this push:
       new  91c8944   Tweak unit tests to be a bit less annoying on Alpha.
91c8944 is described below

commit 91c894464c857338b47076b7d644c6e10583cea9
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Thu Jun 16 00:35:53 2016 -0400

    Tweak unit tests to be a bit less annoying on Alpha.
    
    * Don't modify the wheel PIN unless specifically requested
    
    * Don't try to run the Novena RPC test server (or any server) by default.
    
    Still need to rewrite some of the RSA key tests, particularly the
    external key load test, to conform to known implementation constraint
    that key length must be a multiple of 32 bits; deferred until we
    switch back to hardware modexp, as this won't matter until then.
---
 unit_tests.py | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/unit_tests.py b/unit_tests.py
index beb819b..a3ad19b 100644
--- a/unit_tests.py
+++ b/unit_tests.py
@@ -23,13 +23,13 @@ def parse_arguments(argv = ()):
     parser.add_argument("--quiet",      action = "store_true",                          help = "suppress chatter")
     parser.add_argument("--so-pin",     default = "fnord",                              help = "security officer PIN")
     parser.add_argument("--user-pin",   default = "fnord",                              help = "user PIN")
-    parser.add_argument("--wheel-pin",  default = "fnord",                              help = "wheel PIN")
+    parser.add_argument("--wheel-pin",                                                  help = "wheel PIN")
     parser.add_argument("--initial-pin",                                                help = "initial PIN",
                         default = "YouReallyNeedToChangeThisPINRightNowWeAreNotKidding")
     parser.add_argument("--slot",       default = 0, type = int,                        help = "slot number")
     parser.add_argument("--libpkcs11",  default = "./libpkcs11.so",                     help = "PKCS #11 library")
     parser.add_argument("--p11util",    default = "./p11util",                          help = "p11util binary")
-    parser.add_argument("--server",     default = "../libhal/tests/test-rpc_server",    help = "RPC server binary")
+    parser.add_argument("--server",                                                     help = "RPC server binary")
     parser.add_argument("--all-tests",  action = "store_true",                          help = "enable tests usually skipped")
     parser.add_argument("--sql-file",   default = "unit_tests.db",                      help = "SQLite3 database")
     parser.add_argument("--ks-client",  default = "unit_tests.ks-client",               help = "client keystore (ks_mmap only)")
@@ -59,20 +59,27 @@ def setUpModule():
     environ["CRYPTECH_KEYSTORE"] = new_file(args.ks_client)
     server_keystore              = new_file(args.ks_server)
 
-    if isfile(args.server):
+    # The sudo and environment variable here are for the Novena, They
+    # don't make much sense for the Alpha.  May want to factor them
+    # out and make them the caller's problem at some point.
+    if args.server and isfile(args.server):
         cmd = [args.server]
         if geteuid() != 0:
             cmd.insert(0, "sudo")
         if not args.quiet:
             print "Starting RPC server:", " ".join(cmd)
-        rpc = Popen(cmd,
-                    env = dict(environ,
-                               CRYPTECH_KEYSTORE = server_keystore))
+        rpc = Popen(cmd, env = dict(environ, CRYPTECH_KEYSTORE = server_keystore))
 
+    # Order of PINs here is significant, see p11util for details.
     if not args.quiet:
         print "Setting PINs"
-    Popen((args.p11util, "-wsup"), stdin = PIPE).communicate("".join(pin + "\n" for pin in (
-        args.initial_pin, args.wheel_pin, args.so_pin, args.user_pin)))
+    if args.wheel_pin is None:
+        flags = "-sup"
+        pins  = (args.initial_pin, args.so_pin, args.user_pin)
+    else:
+        flags = "-wsup"
+        pins  = (args.initial_pin, args.wheel_pin, args.so_pin, args.user_pin)
+    Popen((args.p11util, flags), stdin = PIPE).communicate("".join(pin + "\n" for pin in pins))
 
     if not args.quiet:
         print "Loading PKCS #11 library", args.libpkcs11

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


More information about the Commits mailing list