Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 029b7ad

Browse files
authored
Remove unused compare_digest function. (#10706)
1 parent e62cdbe commit 029b7ad

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

changelog.d/10706.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove unused `compare_digest` function.

synapse/rest/client/register.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
import hmac
1615
import logging
1716
import random
1817
from typing import List, Union
@@ -60,18 +59,6 @@
6059

6160
from ._base import client_patterns, interactive_auth_handler
6261

63-
# We ought to be using hmac.compare_digest() but on older pythons it doesn't
64-
# exist. It's a _really minor_ security flaw to use plain string comparison
65-
# because the timing attack is so obscured by all the other code here it's
66-
# unlikely to make much difference
67-
if hasattr(hmac, "compare_digest"):
68-
compare_digest = hmac.compare_digest
69-
else:
70-
71-
def compare_digest(a, b):
72-
return a == b
73-
74-
7562
logger = logging.getLogger(__name__)
7663

7764

0 commit comments

Comments
 (0)