diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2020-04-04 17:08:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-04 16:08:08 -0500 |
commit | aece5b3d47282beed31f7119e273b65816a0cf93 (patch) | |
tree | d72e5ebfee8297197f1321b6d066d8d2061244f2 /src/cryptography/hazmat/primitives/constant_time.py | |
parent | e687b8f7f40e30ef88e9de889c55cd7fdec99762 (diff) | |
download | cryptography-aece5b3d47282beed31f7119e273b65816a0cf93.tar.gz cryptography-aece5b3d47282beed31f7119e273b65816a0cf93.tar.bz2 cryptography-aece5b3d47282beed31f7119e273b65816a0cf93.zip |
Drop support for OpenSSL 1.0.1 (#5178)
Diffstat (limited to 'src/cryptography/hazmat/primitives/constant_time.py')
-rw-r--r-- | src/cryptography/hazmat/primitives/constant_time.py | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/cryptography/hazmat/primitives/constant_time.py b/src/cryptography/hazmat/primitives/constant_time.py index 35ceafe0..7f41b9ef 100644 --- a/src/cryptography/hazmat/primitives/constant_time.py +++ b/src/cryptography/hazmat/primitives/constant_time.py @@ -5,31 +5,10 @@ from __future__ import absolute_import, division, print_function import hmac -import warnings -from cryptography import utils -from cryptography.hazmat.bindings._constant_time import lib +def bytes_eq(a, b): + if not isinstance(a, bytes) or not isinstance(b, bytes): + raise TypeError("a and b must be bytes.") -if hasattr(hmac, "compare_digest"): - def bytes_eq(a, b): - if not isinstance(a, bytes) or not isinstance(b, bytes): - raise TypeError("a and b must be bytes.") - - return hmac.compare_digest(a, b) - -else: - warnings.warn( - "Support for your Python version is deprecated. The next version of " - "cryptography will remove support. Please upgrade to a release " - "(2.7.7+) that supports hmac.compare_digest as soon as possible.", - utils.PersistentlyDeprecated2018, - ) - - def bytes_eq(a, b): - if not isinstance(a, bytes) or not isinstance(b, bytes): - raise TypeError("a and b must be bytes.") - - return lib.Cryptography_constant_time_bytes_eq( - a, len(a), b, len(b) - ) == 1 + return hmac.compare_digest(a, b) |