diff options
Diffstat (limited to '')
| -rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index 2e8513dddf..59d9e0766d 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.109 2019/12/03 16:02:49 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.110 2019/12/03 16:05:14 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2018, 2019 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018, 2019 Theo Buehler <tb@openbsd.org> |
| @@ -1616,7 +1616,7 @@ func runECDHWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDHWeb | |||
| 1616 | return success | 1616 | return success |
| 1617 | } | 1617 | } |
| 1618 | 1618 | ||
| 1619 | func runECDSATest(ecKey *C.EC_KEY, nid int, h hash.Hash, webcrypto bool, wt *wycheproofTestECDSA) bool { | 1619 | func runECDSATest(ecKey *C.EC_KEY, nid int, h hash.Hash, variant testVariant, wt *wycheproofTestECDSA) bool { |
| 1620 | msg, err := hex.DecodeString(wt.Msg) | 1620 | msg, err := hex.DecodeString(wt.Msg) |
| 1621 | if err != nil { | 1621 | if err != nil { |
| 1622 | log.Fatalf("Failed to decode message %q: %v", wt.Msg, err) | 1622 | log.Fatalf("Failed to decode message %q: %v", wt.Msg, err) |
| @@ -1632,7 +1632,7 @@ func runECDSATest(ecKey *C.EC_KEY, nid int, h hash.Hash, webcrypto bool, wt *wyc | |||
| 1632 | } | 1632 | } |
| 1633 | 1633 | ||
| 1634 | var ret C.int | 1634 | var ret C.int |
| 1635 | if webcrypto { | 1635 | if variant == Webcrypto || variant == P1363 { |
| 1636 | cDer, derLen := encodeECDSAWebCryptoSig(wt.Sig) | 1636 | cDer, derLen := encodeECDSAWebCryptoSig(wt.Sig) |
| 1637 | if cDer == nil { | 1637 | if cDer == nil { |
| 1638 | fmt.Print("FAIL: unable to decode signature") | 1638 | fmt.Print("FAIL: unable to decode signature") |
| @@ -1669,7 +1669,7 @@ func runECDSATest(ecKey *C.EC_KEY, nid int, h hash.Hash, webcrypto bool, wt *wyc | |||
| 1669 | return success | 1669 | return success |
| 1670 | } | 1670 | } |
| 1671 | 1671 | ||
| 1672 | func runECDSATestGroup(algorithm string, wtg *wycheproofTestGroupECDSA) bool { | 1672 | func runECDSATestGroup(algorithm string, variant testVariant, wtg *wycheproofTestGroupECDSA) bool { |
| 1673 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", | 1673 | fmt.Printf("Running %v test group %v with curve %v, key size %d and %v...\n", |
| 1674 | algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) | 1674 | algorithm, wtg.Type, wtg.Key.Curve, wtg.Key.KeySize, wtg.SHA) |
| 1675 | 1675 | ||
| @@ -1714,7 +1714,7 @@ func runECDSATestGroup(algorithm string, wtg *wycheproofTestGroupECDSA) bool { | |||
| 1714 | 1714 | ||
| 1715 | success := true | 1715 | success := true |
| 1716 | for _, wt := range wtg.Tests { | 1716 | for _, wt := range wtg.Tests { |
| 1717 | if !runECDSATest(ecKey, nid, h, false, wt) { | 1717 | if !runECDSATest(ecKey, nid, h, variant, wt) { |
| 1718 | success = false | 1718 | success = false |
| 1719 | } | 1719 | } |
| 1720 | } | 1720 | } |
| @@ -1809,7 +1809,7 @@ func runECDSAWebCryptoTestGroup(algorithm string, wtg *wycheproofTestGroupECDSAW | |||
| 1809 | 1809 | ||
| 1810 | success := true | 1810 | success := true |
| 1811 | for _, wt := range wtg.Tests { | 1811 | for _, wt := range wtg.Tests { |
| 1812 | if !runECDSATest(ecKey, nid, h, true, wt) { | 1812 | if !runECDSATest(ecKey, nid, h, Webcrypto, wt) { |
| 1813 | success = false | 1813 | success = false |
| 1814 | } | 1814 | } |
| 1815 | } | 1815 | } |
| @@ -2521,7 +2521,7 @@ func runTestVectors(path string, variant testVariant) bool { | |||
| 2521 | success = false | 2521 | success = false |
| 2522 | } | 2522 | } |
| 2523 | default: | 2523 | default: |
| 2524 | if !runECDSATestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupECDSA)) { | 2524 | if !runECDSATestGroup(wtv.Algorithm, variant, wtg.(*wycheproofTestGroupECDSA)) { |
| 2525 | success = false | 2525 | success = false |
| 2526 | } | 2526 | } |
| 2527 | } | 2527 | } |
| @@ -2592,7 +2592,7 @@ func main() { | |||
| 2592 | {"ECDH webcrypto", "ecdh_webcrypto_test.json", Webcrypto}, | 2592 | {"ECDH webcrypto", "ecdh_webcrypto_test.json", Webcrypto}, |
| 2593 | {"ECDSA", "ecdsa_test.json", Normal}, | 2593 | {"ECDSA", "ecdsa_test.json", Normal}, |
| 2594 | {"ECDSA", "ecdsa_[^w]*test.json", Normal}, | 2594 | {"ECDSA", "ecdsa_[^w]*test.json", Normal}, |
| 2595 | {"ECDSA P1363", "ecdsa_*_p1363_test.json", Skip}, | 2595 | {"ECDSA P1363", "ecdsa_*_p1363_test.json", P1363}, |
| 2596 | {"ECDSA webcrypto", "ecdsa_webcrypto_test.json", Webcrypto}, | 2596 | {"ECDSA webcrypto", "ecdsa_webcrypto_test.json", Webcrypto}, |
| 2597 | {"HKDF", "hkdf_sha*_test.json", Normal}, | 2597 | {"HKDF", "hkdf_sha*_test.json", Normal}, |
| 2598 | {"KW", "kw_test.json", Normal}, | 2598 | {"KW", "kw_test.json", Normal}, |
