aboutsummaryrefslogtreecommitdiff
path: root/unit-tests.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-11-01 19:47:50 -0400
committerRob Austein <sra@hactrn.net>2016-11-01 19:47:50 -0400
commitd844d764a4f0614bf378331b007467de288f74eb (patch)
tree57b8645d338f1549d2b06c4bc3b22c0a6ef950bc /unit-tests.py
parentd3301ac269431c5aa45061abdb2d4400793b1eee (diff)
Add hal_rpc_pkey_get_key_curve().
Incidental minor refactoring of hal_rpc_server_dispatch().
Diffstat (limited to 'unit-tests.py')
-rw-r--r--unit-tests.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/unit-tests.py b/unit-tests.py
index de203a9..53d4d02 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -536,16 +536,34 @@ class TestPKeyList(TestCaseLoggedIn):
def test_ks_list_token(self):
self.ks_list(HAL_KEY_FLAG_TOKEN)
- def ks_match(self, flags):
- for i in xrange(3):
- self.load_keys(flags)
- for uuid in hsm.pkey_match(flags = flags):
+ def ks_print(self, flags, **kwargs):
+ kwargs.update(flags = flags)
+ for uuid in hsm.pkey_match(**kwargs):
with hsm.pkey_find(uuid, flags) as k:
- print "{0.uuid} {0.key_type} {0.key_flags}".format(k)
+ print "{0.uuid} 0x{0.key_flags:02x} {0.key_curve} {0.key_type}".format(k)
+
+ def ks_match(self, flags):
+ self.load_keys(flags)
+ self.load_keys(flags)
+ print
+ print "All:"
+ self.ks_print(flags = flags)
+ print
+ for keytype in set(HALKeyType.index.itervalues()) - {HAL_KEY_TYPE_NONE}:
+ print "Type:", keytype
+ self.ks_print(flags = flags, type = keytype)
+ print
+ for curve in set(HALCurve.index.itervalues()) - {HAL_CURVE_NONE}:
+ print "Curve:", curve
+ self.ks_print(flags = flags, curve = curve)
+ print
def test_ks_match_token(self):
self.ks_match(HAL_KEY_FLAG_TOKEN)
+ def test_ks_match_volatile(self):
+ self.ks_match(0)
+
class TestPkeyECDSAVerificationNIST(TestCaseLoggedIn):
"""
ECDSA verification tests based on Suite B Implementer's Guide to FIPS 186-3.