We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8541ed6 commit a2cfcbfCopy full SHA for a2cfcbf
crypto/tests/test_chacha20.py
@@ -40,3 +40,13 @@ def test_invalid_nonce_size():
40
assert "Nonce must be exactly 12 bytes" in str(e)
41
else:
42
assert False, "ValueError was not raised for long nonce"
43
+
44
+def test_invalid_counter_values():
45
+ """Test invalid counter values for ChaCha20."""
46
+ for invalid_counter in [-1, -100, -999999]:
47
+ try:
48
+ ChaCha20(VALID_KEY, VALID_NONCE, counter=invalid_counter)
49
+ except ValueError as e:
50
+ assert "Counter must be a non-negative integer" in str(e)
51
+ else:
52
+ assert False, f"ValueError not raised for counter={invalid_counter}"
0 commit comments