diff options
Diffstat (limited to 'src/regress/lib/libcrypto/wycheproof/wycheproof.go')
-rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index ddd37030d4..8f0dfc8b2e 100644 --- a/src/regress/lib/libcrypto/wycheproof/wycheproof.go +++ b/src/regress/lib/libcrypto/wycheproof/wycheproof.go | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: wycheproof.go,v 1.160 2024/05/22 14:03:24 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.161 2024/11/24 10:13:16 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018,2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018,2023 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2018,2019,2022-2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018,2019,2022-2024 Theo Buehler <tb@openbsd.org> |
@@ -641,6 +641,14 @@ func nidFromString(ns string) (int, error) { | |||
641 | return -1, fmt.Errorf("unknown NID %q", ns) | 641 | return -1, fmt.Errorf("unknown NID %q", ns) |
642 | } | 642 | } |
643 | 643 | ||
644 | func skipSmallCurve(nid int) bool { | ||
645 | switch C.int(nid) { | ||
646 | case C.NID_secp160k1, C.NID_secp160r1, C.NID_secp160r2, C.NID_secp192k1, C.NID_X9_62_prime192v1: | ||
647 | return true | ||
648 | } | ||
649 | return false | ||
650 | } | ||
651 | |||
644 | var evpMds = map[string]*C.EVP_MD{ | 652 | var evpMds = map[string]*C.EVP_MD{ |
645 | "SHA-1": C.EVP_sha1(), | 653 | "SHA-1": C.EVP_sha1(), |
646 | "SHA-224": C.EVP_sha224(), | 654 | "SHA-224": C.EVP_sha224(), |
@@ -1637,6 +1645,9 @@ func (wtg *wycheproofTestGroupECDH) run(algorithm string, variant testVariant) b | |||
1637 | if err != nil { | 1645 | if err != nil { |
1638 | log.Fatalf("Failed to get nid for curve: %v", err) | 1646 | log.Fatalf("Failed to get nid for curve: %v", err) |
1639 | } | 1647 | } |
1648 | if skipSmallCurve(nid) { | ||
1649 | return true | ||
1650 | } | ||
1640 | 1651 | ||
1641 | success := true | 1652 | success := true |
1642 | for _, wt := range wtg.Tests { | 1653 | for _, wt := range wtg.Tests { |
@@ -1786,6 +1797,9 @@ func (wtg *wycheproofTestGroupECDSA) run(algorithm string, variant testVariant) | |||
1786 | if err != nil { | 1797 | if err != nil { |
1787 | log.Fatalf("Failed to get nid for curve: %v", err) | 1798 | log.Fatalf("Failed to get nid for curve: %v", err) |
1788 | } | 1799 | } |
1800 | if skipSmallCurve(nid) { | ||
1801 | return true | ||
1802 | } | ||
1789 | ecKey := C.EC_KEY_new_by_curve_name(C.int(nid)) | 1803 | ecKey := C.EC_KEY_new_by_curve_name(C.int(nid)) |
1790 | if ecKey == nil { | 1804 | if ecKey == nil { |
1791 | log.Fatal("EC_KEY_new_by_curve_name failed") | 1805 | log.Fatal("EC_KEY_new_by_curve_name failed") |
@@ -2750,7 +2764,7 @@ func main() { | |||
2750 | 2764 | ||
2751 | testc = newTestCoordinator() | 2765 | testc = newTestCoordinator() |
2752 | 2766 | ||
2753 | skipNormal := regexp.MustCompile(`_(ecpoint|p1363|sect\d{3}[rk]1)_`) | 2767 | skipNormal := regexp.MustCompile(`_(ecpoint|p1363|sect\d{3}[rk]1|secp(160|192))_`) |
2754 | 2768 | ||
2755 | for _, test := range tests { | 2769 | for _, test := range tests { |
2756 | tvs, err := filepath.Glob(filepath.Join(testVectorPath, test.pattern)) | 2770 | tvs, err := filepath.Glob(filepath.Join(testVectorPath, test.pattern)) |