summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/wycheproof/wycheproof.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go
index 2ac0ff9fe4..ae24533684 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.186 2025/09/08 07:07:36 tb Exp $ */ 1/* $OpenBSD: wycheproof.go,v 1.187 2025/09/08 07:10:14 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-2025 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018,2019,2022-2025 Theo Buehler <tb@openbsd.org>
@@ -723,6 +723,10 @@ func nidFromString(ns string) (int, error) {
723 return -1, fmt.Errorf("unknown NID %q", ns) 723 return -1, fmt.Errorf("unknown NID %q", ns)
724} 724}
725 725
726func skipHash(hash string) bool {
727 return hash == "SHAKE128" || hash == "SHAKE256"
728}
729
726func skipCurve(nid int) bool { 730func skipCurve(nid int) bool {
727 switch C.int(nid) { 731 switch C.int(nid) {
728 case C.NID_secp160k1, C.NID_secp160r1, C.NID_secp160r2, C.NID_secp192k1, C.NID_X9_62_prime192v1: 732 case C.NID_secp160k1, C.NID_secp160r1, C.NID_secp160r2, C.NID_secp192k1, C.NID_X9_62_prime192v1:
@@ -1893,6 +1897,9 @@ func (wtg *wycheproofTestGroupECDSA) run(algorithm string, variant testVariant)
1893 if skipCurve(nid) { 1897 if skipCurve(nid) {
1894 return true 1898 return true
1895 } 1899 }
1900 if skipHash(wtg.SHA) {
1901 return true
1902 }
1896 ecKey := C.EC_KEY_new_by_curve_name(C.int(nid)) 1903 ecKey := C.EC_KEY_new_by_curve_name(C.int(nid))
1897 if ecKey == nil { 1904 if ecKey == nil {
1898 log.Fatal("EC_KEY_new_by_curve_name failed") 1905 log.Fatal("EC_KEY_new_by_curve_name failed")
@@ -2386,6 +2393,10 @@ func runRsaesOaepTest(rsa *C.RSA, sha *C.EVP_MD, mgfSha *C.EVP_MD, wt *wycheproo
2386func (wtg *wycheproofTestGroupRsaesOaep) run(algorithm string, variant testVariant) bool { 2393func (wtg *wycheproofTestGroupRsaesOaep) run(algorithm string, variant testVariant) bool {
2387 fmt.Printf("Running %v test group %v with key size %d MGF %v and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.MGFSHA, wtg.SHA) 2394 fmt.Printf("Running %v test group %v with key size %d MGF %v and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.MGFSHA, wtg.SHA)
2388 2395
2396 if skipHash(wtg.SHA) {
2397 return true
2398 }
2399
2389 rsa := C.RSA_new() 2400 rsa := C.RSA_new()
2390 if rsa == nil { 2401 if rsa == nil {
2391 log.Fatal("RSA_new failed") 2402 log.Fatal("RSA_new failed")
@@ -2557,6 +2568,11 @@ func runRsassaTest(rsa *C.RSA, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLen int, wt *wy
2557 2568
2558func (wtg *wycheproofTestGroupRsassa) run(algorithm string, variant testVariant) bool { 2569func (wtg *wycheproofTestGroupRsassa) run(algorithm string, variant testVariant) bool {
2559 fmt.Printf("Running %v test group %v with key size %d and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.SHA) 2570 fmt.Printf("Running %v test group %v with key size %d and %v...\n", algorithm, wtg.Type, wtg.KeySize, wtg.SHA)
2571
2572 if skipHash(wtg.SHA) {
2573 return true
2574 }
2575
2560 rsa := C.RSA_new() 2576 rsa := C.RSA_new()
2561 if rsa == nil { 2577 if rsa == nil {
2562 log.Fatal("RSA_new failed") 2578 log.Fatal("RSA_new failed")