|
29 | 29 | SECP112r1, |
30 | 30 | SECP112r2, |
31 | 31 | SECP128r1, |
| 32 | + SECP160r1, |
32 | 33 | NIST192p, |
33 | 34 | NIST224p, |
34 | 35 | NIST256p, |
@@ -313,8 +314,15 @@ class FakeGenerator: |
313 | 314 | def order(self): |
314 | 315 | return 123456789 |
315 | 316 |
|
| 317 | + class FakeCurveFp: |
| 318 | + def p(self): |
| 319 | + return int( |
| 320 | + "6525534529039240705020950546962731340" |
| 321 | + "4541085228058844382513856749047873406763" |
| 322 | + ) |
| 323 | + |
316 | 324 | badcurve = Curve( |
317 | | - "unknown", None, FakeGenerator(), (1, 2, 3, 4, 5, 6), None |
| 325 | + "unknown", FakeCurveFp(), FakeGenerator(), (1, 2, 3, 4, 5, 6), None |
318 | 326 | ) |
319 | 327 | badpub.curve = badcurve |
320 | 328 | badder = badpub.to_der() |
@@ -832,7 +840,6 @@ def test_VerifyingKey_encode_decode(curve, encoding): |
832 | 840 | assert vk.pubkey.point == from_enc.pubkey.point |
833 | 841 |
|
834 | 842 |
|
835 | | - |
836 | 843 | class OpenSSL(unittest.TestCase): |
837 | 844 | # test interoperability with OpenSSL tools. Note that openssl's ECDSA |
838 | 845 | # sign/verify arguments changed between 0.9.8 and 1.0.0: the early |
@@ -890,7 +897,13 @@ def test_from_openssl_secp112r2(self): |
890 | 897 | def test_from_openssl_secp128r1(self): |
891 | 898 | return self.do_test_from_openssl(SECP128r1) |
892 | 899 |
|
893 | | - @pytest.mark.slow |
| 900 | + @pytest.mark.skipif( |
| 901 | + "secp160r1" not in OPENSSL_SUPPORTED_CURVES, |
| 902 | + reason="system openssl does not support secp160r1", |
| 903 | + ) |
| 904 | + def test_from_openssl_secp160r1(self): |
| 905 | + return self.do_test_from_openssl(SECP160r1) |
| 906 | + |
894 | 907 | @pytest.mark.skipif( |
895 | 908 | "prime192v1" not in OPENSSL_SUPPORTED_CURVES, |
896 | 909 | reason="system openssl does not support prime192v1", |
@@ -1076,7 +1089,13 @@ def test_to_openssl_secp112r2(self): |
1076 | 1089 | def test_to_openssl_secp128r1(self): |
1077 | 1090 | self.do_test_to_openssl(SECP128r1) |
1078 | 1091 |
|
1079 | | - @pytest.mark.slow |
| 1092 | + @pytest.mark.skipif( |
| 1093 | + "secp160r1" not in OPENSSL_SUPPORTED_CURVES, |
| 1094 | + reason="system openssl does not support secp160r1", |
| 1095 | + ) |
| 1096 | + def test_to_openssl_secp160r1(self): |
| 1097 | + self.do_test_to_openssl(SECP160r1) |
| 1098 | + |
1080 | 1099 | @pytest.mark.skipif( |
1081 | 1100 | "prime192v1" not in OPENSSL_SUPPORTED_CURVES, |
1082 | 1101 | reason="system openssl does not support prime192v1", |
|
0 commit comments