[Cryptech-Commits] [sw/libhal] 05/05: Adjust "bloat" unit tests for ks9 keystore parameters.

git at cryptech.is git at cryptech.is
Mon May 29 18:53:48 UTC 2017


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

sra at hactrn.net pushed a commit to branch ks9
in repository sw/libhal.

commit ade02ebabf88481bc763ea6a9b2f97e87f0a6210
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon May 29 14:51:14 2017 -0400

    Adjust "bloat" unit tests for ks9 keystore parameters.
---
 unit-tests.py | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/unit-tests.py b/unit-tests.py
index a304205..9ebf91e 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -671,17 +671,36 @@ class TestPKeyAttribute(TestCaseLoggedIn):
                                           for j in xrange(n_attrs)))
                     pinwheel()
 
+    # These sizes work with a 4096-byte keystore block; if you tweak
+    # the undelrying block size, you may need to tweak these tests too.
+
+    def test_attribute_svelt_volatile_many(self):
+        self.load_and_fill(0, n_attrs = 64)
+
     def test_attribute_bloat_volatile_many(self):
-        self.load_and_fill(0, n_attrs = 128) # 192
+        with self.assertRaises(HAL_ERROR_RESULT_TOO_LONG):
+            self.load_and_fill(0, n_attrs = 128)
+
+    def test_attribute_svelt_volatile_big(self):
+        self.load_and_fill(0, n_attrs = 6, n_fill = 256)
 
     def test_attribute_bloat_volatile_big(self):
-        self.load_and_fill(0, n_attrs = 6, n_fill = 512)
+        with self.assertRaises(HAL_ERROR_RESULT_TOO_LONG):
+            self.load_and_fill(0, n_attrs = 6, n_fill = 512)
+
+    def test_attribute_svelt_token_many(self):
+        self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 64)
 
     def test_attribute_bloat_token_many(self):
-        self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 128)
+        with self.assertRaises(HAL_ERROR_RESULT_TOO_LONG):
+            self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 128)
+
+    def test_attribute_svelt_token_big(self):
+        self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 6, n_fill = 256)
 
     def test_attribute_bloat_token_big(self):
-        self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 4, n_fill = 512) # [16, 1024]
+        with self.assertRaises(HAL_ERROR_RESULT_TOO_LONG):
+            self.load_and_fill(HAL_KEY_FLAG_TOKEN, n_attrs = 6, n_fill = 512)
 
 
 @unittest.skipUnless(ecdsa_loaded, "Requires Python ECDSA package")



More information about the Commits mailing list