Skip to content

Commit

Permalink
Remove DH generator size constraint (#3364)
Browse files Browse the repository at this point in the history
* Remove DH generator size constraint

* Check that g > 1
  • Loading branch information
mtury authored and reaperhulk committed Jul 17, 2017
1 parent a217358 commit cc12bea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cryptography/hazmat/primitives/asymmetric/dh.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def __init__(self, p, g, q=None):
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
Expand Down
2 changes: 1 addition & 1 deletion tests/hazmat/primitives/test_dh.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_dh_parameternumbers():

with pytest.raises(ValueError):
dh.DHParameterNumbers(
65537, 7
65537, 1
)

params = dh.DHParameterNumbers(
Expand Down

0 comments on commit cc12bea

Please sign in to comment.