From d015707e0e26bafbfad72511c0a47cbb66c90971 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 10 Jun 2020 15:38:05 -0400 Subject: Fix remaining Python 3 unit test string encoding bug Really just one bug, but confusingly masked by an interaction between generators and our XDR context manager, so don't use the context manager in the one generator method in the cryptech.libhal API. Also run reindent.py on a few old test modules. --- cryptech/libhal.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cryptech') diff --git a/cryptech/libhal.py b/cryptech/libhal.py index 1e2dbc6..102e663 100644 --- a/cryptech/libhal.py +++ b/cryptech/libhal.py @@ -698,13 +698,14 @@ class HSM(object): n = length s = 0 while n == length: - with self.rpc(RPC_FUNC_PKEY_MATCH, session, type, curve, mask, flags, - attributes, s, length, u, client = client) as r: - s = r.unpack_uint() - n = r.unpack_uint() - for i in range(n): - u = UUID(bytes = r.unpack_bytes()) - yield u + r = self.rpc(RPC_FUNC_PKEY_MATCH, session, type, curve, mask, flags, + attributes, s, length, u, client = client) + s = r.unpack_uint() + n = r.unpack_uint() + for i in range(n): + u = UUID(bytes = r.unpack_bytes()) + yield u + r.done() def pkey_set_attributes(self, pkey, attributes): with self.rpc(RPC_FUNC_PKEY_SET_ATTRIBUTES, pkey, attributes): -- cgit v1.2.3