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

Commit

Permalink
Remove unused compare_digest function. (#10706)
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Aug 27, 2021
1 parent e62cdbe commit 029b7ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 1 addition & 0 deletions changelog.d/10706.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unused `compare_digest` function.
13 changes: 0 additions & 13 deletions synapse/rest/client/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# 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.
import hmac
import logging
import random
from typing import List, Union
Expand Down Expand Up @@ -60,18 +59,6 @@

from ._base import client_patterns, interactive_auth_handler

# We ought to be using hmac.compare_digest() but on older pythons it doesn't
# exist. It's a _really minor_ security flaw to use plain string comparison
# because the timing attack is so obscured by all the other code here it's
# unlikely to make much difference
if hasattr(hmac, "compare_digest"):
compare_digest = hmac.compare_digest
else:

def compare_digest(a, b):
return a == b


logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 029b7ad

Please sign in to comment.