diff --git a/MAINTAINERS b/MAINTAINERS index be197c693..d6b68ba0e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -60,12 +60,6 @@ M: Gordon Chung S: Maintained F: middleware/audit.py -== authutils == - -M: -S: Orphan -F: authutils.py - == cfg == M: Mark McLoughlin diff --git a/openstack/common/authutils.py b/openstack/common/authutils.py deleted file mode 100644 index 73bcd79f4..000000000 --- a/openstack/common/authutils.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Authentication related utilities and helper functions. -""" - - -def auth_str_equal(provided, known): - """Constant-time string comparison. - - :params provided: the first string - :params known: 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. When using the function for this purpose, always - provide the user-provided password as the first argument. The time this - function will take is always a factor of the length of this string. - """ - result = 0 - p_len = len(provided) - k_len = len(known) - for i in range(p_len): - a = ord(provided[i]) if i < p_len else 0 - b = ord(known[i]) if i < k_len else 0 - result |= a ^ b - return (p_len == k_len) & (result == 0) diff --git a/tests/unit/test_authutils.py b/tests/unit/test_authutils.py deleted file mode 100644 index 2a5d7e30d..000000000 --- a/tests/unit/test_authutils.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from openstack.common import authutils -from openstack.common import test - - -class AuthUtilsTest(test.BaseTestCase): - - def test_auth_str_equal(self): - self.assertTrue(authutils.auth_str_equal('abc123', 'abc123')) - self.assertFalse(authutils.auth_str_equal('a', 'aaaaa')) - self.assertFalse(authutils.auth_str_equal('aaaaa', 'a')) - self.assertFalse(authutils.auth_str_equal('ABC123', 'abc123'))