Skip to content

ECC signing + verification sometimes fails #85

@mjdemilliano

Description

@mjdemilliano

ECC signing + verification using sign_raw and verify_raw is flaky, it sometimes fails for no reason.

Steps to reproduce:

def test_ecc_sign_verify_raw_many():
    for i in range(10000):
        private_key = EccPrivate.make_key(48)
        public_key = EccPublic()
        qx, qy, _ = private_key.encode_key_raw()
        public_key.decode_key_raw(qx, qy, curve_id=ECC_SECP384R1)

        plaintext = "Everyone gets Friday off."
        r, s = private_key.sign_raw(plaintext)

        assert public_key.verify_raw(r, s, plaintext), f"signature should be valid (iteration {i})"

Add this to test_ciphers.py. Observe that this test always fails, but the iteration number at which it fails varies, mostly within 150 attempts.

Expected behavior: sign + verify of the same data with the same key and signature is always successful.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions