aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-05-01 11:33:22 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-05-01 11:55:13 -0500
commit21babbb5001cd98ed9dfbc458cbf376223ab6588 (patch)
tree56dfa3d415641b08b6ecb6c08bb7eba6add37138 /cryptography
parent7c5f131417049120c968fc047ef63cb25d245d2d (diff)
downloadcryptography-21babbb5001cd98ed9dfbc458cbf376223ab6588.tar.gz
cryptography-21babbb5001cd98ed9dfbc458cbf376223ab6588.tar.bz2
cryptography-21babbb5001cd98ed9dfbc458cbf376223ab6588.zip
updates for review feedback
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/backends/interfaces.py2
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py21
2 files changed, 9 insertions, 14 deletions
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py
index 66ee1e44..e63b079b 100644
--- a/cryptography/hazmat/backends/interfaces.py
+++ b/cryptography/hazmat/backends/interfaces.py
@@ -159,7 +159,7 @@ class DSABackend(object):
"""
@abc.abstractmethod
- def dsa_parameters_supported(self, p, q):
+ def dsa_parameters_supported(self, p, q, g):
"""
Return True if the parameters are supported by the backend for DSA.
"""
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index ea58d753..37d1c35e 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -492,20 +492,14 @@ class Backend(object):
return ctx
def dsa_hash_supported(self, algorithm):
- if (
- self._lib.OPENSSL_VERSION_NUMBER < 0x1000000f and
- not isinstance(algorithm, hashes.SHA1)
- ):
- return False
+ if self._lib.OPENSSL_VERSION_NUMBER < 0x1000000f:
+ return isinstance(algorithm, hashes.SHA1)
else:
return self.hash_supported(algorithm)
- def dsa_parameters_supported(self, p, q):
- if (
- self._lib.OPENSSL_VERSION_NUMBER < 0x1000000f and
- not (utils.bit_length(p) <= 1024 and utils.bit_length(q) <= 160)
- ):
- return False
+ def dsa_parameters_supported(self, p, q, g):
+ if self._lib.OPENSSL_VERSION_NUMBER < 0x1000000f:
+ return (utils.bit_length(p) <= 1024 and utils.bit_length(q) <= 160)
else:
return True
@@ -1334,8 +1328,7 @@ class _RSAVerificationContext(object):
@utils.register_interface(interfaces.AsymmetricVerificationContext)
class _DSAVerificationContext(object):
- def __init__(
- self, backend, public_key, signature, algorithm):
+ def __init__(self, backend, public_key, signature, algorithm):
self._backend = backend
self._public_key = public_key
self._signature = signature
@@ -1361,6 +1354,8 @@ class _DSAVerificationContext(object):
data_to_verify = self._hash_ctx.finalize()
self._hash_ctx = None
+ # The first parameter passed to DSA_verify is unused by OpenSSL but
+ # must be an integer.
res = self._backend._lib.DSA_verify(
0, data_to_verify, len(data_to_verify), self._signature,
len(self._signature), self._dsa_cdata)