diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b33ac6..c464656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2.1.2] +### Fixed +- Point at infinity handling in C extensions +- DER signature decoding that assumed length was always encoded in one byte + ## [2.1.1] ### Fixed - RFC6979 nonce generation for signatures on pre-hashed messages (issue #46) diff --git a/fastecdsa/encoding/asn1.py b/fastecdsa/encoding/asn1.py index a865f81..2596011 100644 --- a/fastecdsa/encoding/asn1.py +++ b/fastecdsa/encoding/asn1.py @@ -99,8 +99,8 @@ def parse_asn1_length(data: bytes) -> (int, bytes, bytes): data = data[count:] if length > len(data): - raise ASN1EncodingError(f"Parsed length of ASN.1 structure to be {length} bytes but only {len(data)} bytes" - f"remain in the provided data") + raise ASN1EncodingError("Parsed length of ASN.1 structure to be {} bytes but only {} bytes" + "remain in the provided data".format(length, len(data))) return length, data[:length], data[length:] @@ -128,6 +128,6 @@ def parse_asn1_int(data: bytes) -> (int, bytes, bytes): # integer length should match length indicated if length != len(data): - raise ASN1EncodingError(f"Expected ASN.1 INTEGER to be {length} bytes, got {len(data)} bytes") + raise ASN1EncodingError("Expected ASN.1 INTEGER to be {} bytes, got {} bytes".format(length, len(data))) return length, data, remaining diff --git a/fastecdsa/encoding/der.py b/fastecdsa/encoding/der.py index ac0ba3d..7dd545a 100644 --- a/fastecdsa/encoding/der.py +++ b/fastecdsa/encoding/der.py @@ -60,7 +60,8 @@ def _validate_int_bytes(data: bytes): # sequence should be entirety remaining data if leftover: - raise InvalidDerSignature(f"Expected a sequence of {seqlen} bytes, got {len(sequence + leftover)}") + raise InvalidDerSignature("Expected a sequence of {} bytes, got {}".format( + seqlen, len(sequence + leftover))) try: rlen, r, sdata = parse_asn1_int(sequence) diff --git a/fastecdsa/tests/test_whycheproof_vectors.py b/fastecdsa/tests/test_whycheproof_vectors.py index 1effe10..a44e298 100644 --- a/fastecdsa/tests/test_whycheproof_vectors.py +++ b/fastecdsa/tests/test_whycheproof_vectors.py @@ -23,7 +23,7 @@ def _get_tests(url): test_json = loads(test_raw) return test_json["testGroups"] except (JSONDecodeError, URLError) as error: - SkipTest(f"Skipping tests, could not download / parse data from {url}\nError: {error}") + SkipTest("Skipping tests, could not download / parse data from {}\nError: {}".format(url, error)) def _test_runner(self, tests, curve, hashfunc): for test_group in tests: diff --git a/setup.py b/setup.py index 35a7eb3..d8a86a6 100644 --- a/setup.py +++ b/setup.py @@ -57,5 +57,5 @@ def run(self): name='fastecdsa', packages=find_packages(), url='https://github.com/AntonKueltz/fastecdsa', - version='2.1.1', + version='2.1.2', )