aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/dh.py4
-rw-r--r--tests/hazmat/primitives/test_dh.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/dh.py b/src/cryptography/hazmat/primitives/asymmetric/dh.py
index 92a493a0..4fc99524 100644
--- a/src/cryptography/hazmat/primitives/asymmetric/dh.py
+++ b/src/cryptography/hazmat/primitives/asymmetric/dh.py
@@ -87,8 +87,8 @@ class DHParameterNumbers(object):
if q is not None and not isinstance(q, six.integer_types):
raise TypeError("q must be integer or None")
- if q is None and g not in (2, 5):
- raise ValueError("DH generator must be 2 or 5")
+ if g < 2:
+ raise ValueError("DH generator must be 2 or greater")
self._p = p
self._g = g
diff --git a/tests/hazmat/primitives/test_dh.py b/tests/hazmat/primitives/test_dh.py
index fa658ae5..25be51c9 100644
--- a/tests/hazmat/primitives/test_dh.py
+++ b/tests/hazmat/primitives/test_dh.py
@@ -53,7 +53,7 @@ def test_dh_parameternumbers():
with pytest.raises(ValueError):
dh.DHParameterNumbers(
- 65537, 7
+ 65537, 1
)
params = dh.DHParameterNumbers(