Skip to content

Commit

Permalink
ensure consistent coverage for sigdecode_der
Browse files Browse the repository at this point in the history
make sure we hit the currently defined two checks in the
sigdecode_der() function
  • Loading branch information
tomato42 committed Oct 28, 2019
1 parent ece65de commit e440d99
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ecdsa/test_malformed_sigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import sys
from six import binary_type
import hypothesis.strategies as st
from hypothesis import note, assume, given, settings
from hypothesis import note, assume, given, settings, example

from .keys import SigningKey
from .keys import BadSignatureError
Expand Down Expand Up @@ -259,6 +259,15 @@ def test_random_der_as_signature(params, der):

@settings(**params)
@given(st.sampled_from(keys_and_sigs), st.binary(max_size=1024**2))
@example(
keys_and_sigs[0],
encode_sequence(encode_integer(0), encode_integer(0)))
@example(
keys_and_sigs[0],
encode_sequence(encode_integer(1), encode_integer(1)) + b'\x00')
@example(
keys_and_sigs[0],
encode_sequence(*[encode_integer(1)] * 3))
def test_random_bytes_as_signature(params, der):
"""Check if random bytes are rejected as signature"""
name, verifying_key, _ = params
Expand Down

0 comments on commit e440d99

Please sign in to comment.