diff --git a/crypto/tests/test_wycheproof.py b/crypto/tests/test_wycheproof.py index 2f6c72c6e..e6bede748 100755 --- a/crypto/tests/test_wycheproof.py +++ b/crypto/tests/test_wycheproof.py @@ -387,22 +387,24 @@ def generate_curve25519_dh(filename): if not keys_in_dict(data, {"algorithm", "testGroups"}): raise DataError() - if data["algorithm"] != "X25519": + if data["algorithm"] != "XDH": raise DataError() for test_group in data["testGroups"]: - if not keys_in_dict(test_group, {"tests"}): + if not keys_in_dict(test_group, {"tests", "curve"}): + raise DataError() + + try: + curve_name = parse_curve_name(test_group["curve"]) + except Exception: raise DataError() for test in test_group["tests"]: - if not keys_in_dict( - test, {"public", "private", "shared", "result", "curve"} - ): + if not keys_in_dict(test, {"public", "private", "shared", "result"}): raise DataError() try: public_key = unhexlify(test["public"]) - curve_name = parse_curve_name(test["curve"]) private_key = unhexlify(test["private"]) shared = unhexlify(test["shared"]) result = parse_result(test["result"]) @@ -433,18 +435,20 @@ def generate_ecdh(filename): raise DataError() for test_group in data["testGroups"]: - if not keys_in_dict(test_group, {"tests"}): + if not keys_in_dict(test_group, {"tests", "curve"}): + raise DataError() + + try: + curve_name = parse_curve_name(test_group["curve"]) + except Exception: raise DataError() for test in test_group["tests"]: - if not keys_in_dict( - test, {"public", "private", "shared", "result", "curve"} - ): + if not keys_in_dict(test, {"public", "private", "shared", "result"}): raise DataError() try: public_key = unhexlify(test["public"]) - curve_name = parse_curve_name(test["curve"]) private_key = parse_signed_hex(test["private"]) shared = unhexlify(test["shared"]) result = parse_result(test["result"]) @@ -604,7 +608,6 @@ if not lib.zkp_context_is_initialized(): testvectors_directory = os.path.join(dir, "wycheproof/testvectors") context_structure_length = 1024 -ecdh_vectors = generate_ecdh("ecdh_test.json") curve25519_dh_vectors = generate_curve25519_dh("x25519_test.json") eddsa_vectors = generate_eddsa("eddsa_test.json") ecdsa_vectors = ( diff --git a/crypto/tests/wycheproof b/crypto/tests/wycheproof index 2904be69e..219600060 160000 --- a/crypto/tests/wycheproof +++ b/crypto/tests/wycheproof @@ -1 +1 @@ -Subproject commit 2904be69e9d666bf3064fdc15093747e695cfae6 +Subproject commit 2196000605e45d91097147c9c71f26b72af58003