summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-07 08:22:07 +0000
committerGerrit Code Review <review@openstack.org>2013-02-07 08:22:07 +0000
commit05a71d9c3e68927ecedbb171fcb3217a0a6c0528 (patch)
tree8109e96f47315f8d012800f8f38ae318e13242dc
parent24018cabb462f8aeec921d77427e9d65b7068793 (diff)
parent08a5066d5d8781d2cc6bd3b2fb2c27e4e16e8adb (diff)
Merge "Remove strcmp_const_time."
-rw-r--r--nova/tests/test_utils.py5
-rw-r--r--nova/utils.py20
2 files changed, 0 insertions, 25 deletions
diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py
index 138d049aa..aaa826a70 100644
--- a/nova/tests/test_utils.py
+++ b/nova/tests/test_utils.py
@@ -437,11 +437,6 @@ class GenericUtilsTestCase(test.TestCase):
self.assertRaises(exception.FileNotFound,
utils.read_file_as_root, 'bad')
- def test_strcmp_const_time(self):
- self.assertTrue(utils.strcmp_const_time('abc123', 'abc123'))
- self.assertFalse(utils.strcmp_const_time('a', 'aaaaa'))
- self.assertFalse(utils.strcmp_const_time('ABC123', 'abc123'))
-
def test_temporary_chown(self):
def fake_execute(*args, **kwargs):
if args[0] == 'chown':
diff --git a/nova/utils.py b/nova/utils.py
index 3e194fc57..545cb5dae 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -1175,26 +1175,6 @@ def tempdir(**kwargs):
LOG.error(_('Could not remove tmpdir: %s'), str(e))
-def strcmp_const_time(s1, s2):
- """Constant-time string comparison.
-
- :params s1: the first string
- :params s2: the second string
-
- :return: True if the strings are equal.
-
- This function takes two strings and compares them. It is intended to be
- used when doing a comparison for authentication purposes to help guard
- against timing attacks.
- """
- if len(s1) != len(s2):
- return False
- result = 0
- for (a, b) in zip(s1, s2):
- result |= ord(a) ^ ord(b)
- return result == 0
-
-
def walk_class_hierarchy(clazz, encountered=None):
"""Walk class hierarchy, yielding most derived classes first."""
if not encountered: