diff options
| author | tb <> | 2019-11-27 21:20:03 +0000 | 
|---|---|---|
| committer | tb <> | 2019-11-27 21:20:03 +0000 | 
| commit | 5c9964a6e04d5b858c306ff4b1ce8d050f782cf2 (patch) | |
| tree | 2c4281947e49aa3518a4803891478b6108b96359 /src/regress/lib/libc | |
| parent | 51ead3251e776031b166c7bf7ecf42df0ee0e3d4 (diff) | |
| download | openbsd-5c9964a6e04d5b858c306ff4b1ce8d050f782cf2.tar.gz openbsd-5c9964a6e04d5b858c306ff4b1ce8d050f782cf2.tar.bz2 openbsd-5c9964a6e04d5b858c306ff4b1ce8d050f782cf2.zip | |
RSASig now has the more specific name RSASSA-PKCS1-v1_5.
Diffstat (limited to '')
| -rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 24 | 
1 files changed, 14 insertions, 10 deletions
| diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index 1bff4155a8..a04540f6f3 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.96 2019/11/27 19:54:40 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.97 2019/11/27 21:20:03 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> | 
| @@ -327,7 +327,7 @@ type wycheproofTestGroupRsaesPkcs1 struct { | |||
| 327 | Tests []*wycheproofTestRsaes `json:"tests"` | 327 | Tests []*wycheproofTestRsaes `json:"tests"` | 
| 328 | } | 328 | } | 
| 329 | 329 | ||
| 330 | type wycheproofTestRSASSA struct { | 330 | type wycheproofTestRsassa struct { | 
| 331 | TCID int `json:"tcId"` | 331 | TCID int `json:"tcId"` | 
| 332 | Comment string `json:"comment"` | 332 | Comment string `json:"comment"` | 
| 333 | Msg string `json:"msg"` | 333 | Msg string `json:"msg"` | 
| @@ -336,7 +336,7 @@ type wycheproofTestRSASSA struct { | |||
| 336 | Flags []string `json:"flags"` | 336 | Flags []string `json:"flags"` | 
| 337 | } | 337 | } | 
| 338 | 338 | ||
| 339 | type wycheproofTestGroupRSASSA struct { | 339 | type wycheproofTestGroupRsassa struct { | 
| 340 | E string `json:"e"` | 340 | E string `json:"e"` | 
| 341 | KeyASN string `json:"keyAsn"` | 341 | KeyASN string `json:"keyAsn"` | 
| 342 | KeyDER string `json:"keyDer"` | 342 | KeyDER string `json:"keyDer"` | 
| @@ -348,7 +348,7 @@ type wycheproofTestGroupRSASSA struct { | |||
| 348 | SLen int `json:"sLen"` | 348 | SLen int `json:"sLen"` | 
| 349 | SHA string `json:"sha"` | 349 | SHA string `json:"sha"` | 
| 350 | Type string `json:"type"` | 350 | Type string `json:"type"` | 
| 351 | Tests []*wycheproofTestRSASSA `json:"tests"` | 351 | Tests []*wycheproofTestRsassa `json:"tests"` | 
| 352 | } | 352 | } | 
| 353 | 353 | ||
| 354 | type wycheproofTestX25519 struct { | 354 | type wycheproofTestX25519 struct { | 
| @@ -2043,7 +2043,7 @@ func runRsaesPkcs1TestGroup(algorithm string, wtg *wycheproofTestGroupRsaesPkcs1 | |||
| 2043 | return success | 2043 | return success | 
| 2044 | } | 2044 | } | 
| 2045 | 2045 | ||
| 2046 | func runRSASSATest(rsa *C.RSA, h hash.Hash, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLen int, wt *wycheproofTestRSASSA) bool { | 2046 | func runRsassaTest(rsa *C.RSA, h hash.Hash, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLen int, wt *wycheproofTestRsassa) bool { | 
| 2047 | msg, err := hex.DecodeString(wt.Msg) | 2047 | msg, err := hex.DecodeString(wt.Msg) | 
| 2048 | if err != nil { | 2048 | if err != nil { | 
| 2049 | log.Fatalf("Failed to decode message %q: %v", wt.Msg, err) | 2049 | log.Fatalf("Failed to decode message %q: %v", wt.Msg, err) | 
| @@ -2102,7 +2102,7 @@ func runRSASSATest(rsa *C.RSA, h hash.Hash, sha *C.EVP_MD, mgfSha *C.EVP_MD, sLe | |||
| 2102 | return success | 2102 | return success | 
| 2103 | } | 2103 | } | 
| 2104 | 2104 | ||
| 2105 | func runRSASSATestGroup(algorithm string, wtg *wycheproofTestGroupRSASSA) bool { | 2105 | func runRsassaTestGroup(algorithm string, wtg *wycheproofTestGroupRsassa) bool { | 
| 2106 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", | 2106 | fmt.Printf("Running %v test group %v with key size %d and %v...\n", | 
| 2107 | algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | 2107 | algorithm, wtg.Type, wtg.KeySize, wtg.SHA) | 
| 2108 | rsa := C.RSA_new() | 2108 | rsa := C.RSA_new() | 
| @@ -2140,7 +2140,7 @@ func runRSASSATestGroup(algorithm string, wtg *wycheproofTestGroupRSASSA) bool { | |||
| 2140 | 2140 | ||
| 2141 | success := true | 2141 | success := true | 
| 2142 | for _, wt := range wtg.Tests { | 2142 | for _, wt := range wtg.Tests { | 
| 2143 | if !runRSASSATest(rsa, h, sha, mgfSha, wtg.SLen, wt) { | 2143 | if !runRsassaTest(rsa, h, sha, mgfSha, wtg.SLen, wt) { | 
| 2144 | success = false | 2144 | success = false | 
| 2145 | } | 2145 | } | 
| 2146 | } | 2146 | } | 
| @@ -2319,7 +2319,9 @@ func runTestVectors(path string, webcrypto bool) bool { | |||
| 2319 | case "RSAES-PKCS1-v1_5": | 2319 | case "RSAES-PKCS1-v1_5": | 
| 2320 | wtg = &wycheproofTestGroupRsaesPkcs1{} | 2320 | wtg = &wycheproofTestGroupRsaesPkcs1{} | 
| 2321 | case "RSASSA-PSS": | 2321 | case "RSASSA-PSS": | 
| 2322 | wtg = &wycheproofTestGroupRSASSA{} | 2322 | wtg = &wycheproofTestGroupRsassa{} | 
| 2323 | case "RSASSA-PKCS1-v1_5": | ||
| 2324 | fallthrough | ||
| 2323 | case "RSASig": | 2325 | case "RSASig": | 
| 2324 | wtg = &wycheproofTestGroupRSA{} | 2326 | wtg = &wycheproofTestGroupRSA{} | 
| 2325 | case "X25519": | 2327 | case "X25519": | 
| @@ -2392,9 +2394,11 @@ func runTestVectors(path string, webcrypto bool) bool { | |||
| 2392 | success = false | 2394 | success = false | 
| 2393 | } | 2395 | } | 
| 2394 | case "RSASSA-PSS": | 2396 | case "RSASSA-PSS": | 
| 2395 | if !runRSASSATestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupRSASSA)) { | 2397 | if !runRsassaTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupRsassa)) { | 
| 2396 | success = false | 2398 | success = false | 
| 2397 | } | 2399 | } | 
| 2400 | case "RSASSA-PKCS1-v1_5": | ||
| 2401 | fallthrough | ||
| 2398 | case "RSASig": | 2402 | case "RSASig": | 
| 2399 | if !runRSATestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupRSA)) { | 2403 | if !runRSATestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupRSA)) { | 
| 2400 | success = false | 2404 | success = false | 
| @@ -2454,7 +2458,7 @@ func main() { | |||
| 2454 | } | 2458 | } | 
| 2455 | for _, tv := range tvs { | 2459 | for _, tv := range tvs { | 
| 2456 | if skip.Match([]byte(tv)) { | 2460 | if skip.Match([]byte(tv)) { | 
| 2457 | fmt.Printf("INFO: Skipping tests from \"%s\"\n", strings.TrimPrefix(tv, testVectorPath + "/")) | 2461 | fmt.Printf("INFO: Skipping tests from \"%s\"\n", strings.TrimPrefix(tv, testVectorPath+"/")) | 
| 2458 | continue | 2462 | continue | 
| 2459 | } | 2463 | } | 
| 2460 | if !runTestVectors(tv, webcrypto) { | 2464 | if !runTestVectors(tv, webcrypto) { | 
