From dcf3c671314b36285277073c0a3d3a09bf4d93e6 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 24 Oct 2016 15:15:51 -0400 Subject: Make previous_uuid an input-only argument to hal_rpc_pkey_match(). In retrospect it's obvious that this never needed to be an input/output argument, as its value will always be the same as the last value in the returned array. Doh. So simplify the RPC and call sequence slightly by removing the unnecessary output value. --- libhal.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'libhal.py') diff --git a/libhal.py b/libhal.py index 911ad7c..8334f12 100644 --- a/libhal.py +++ b/libhal.py @@ -571,11 +571,8 @@ class HSM(object): previous_uuid = UUID(int = 0), length = 512, client = 0, session = 0): with self.rpc(RPC_FUNC_PKEY_MATCH, session, type, curve, flags, attributes, length, previous_uuid, client = client) as r: - x = tuple(UUID(bytes = r.unpack_bytes()) - for i in xrange(r.unpack_uint())) - y = UUID(bytes = r.unpack_bytes()) - assert len(x) == 0 or y == x[-1] - return x + return tuple(UUID(bytes = r.unpack_bytes()) + for i in xrange(r.unpack_uint())) def pkey_set_attribute(self, pkey, attr_type, attr_value = None): if attr_value is None and isinstance(attr_type, Attribute): -- cgit v1.2.3