diff options
-rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index 7994e13879..d9eda15f07 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.147 2023/11/06 14:50:12 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.148 2023/11/06 15:07:57 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,2022 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018,2019,2022 Theo Buehler <tb@openbsd.org> |
@@ -164,6 +164,9 @@ type wycheproofTestGroupAead struct { | |||
164 | Tests []*wycheproofTestAead `json:"tests"` | 164 | Tests []*wycheproofTestAead `json:"tests"` |
165 | } | 165 | } |
166 | 166 | ||
167 | type wycheproofTestGroupAesAead wycheproofTestGroupAead | ||
168 | type wycheproofTestGroupChaCha wycheproofTestGroupAead | ||
169 | |||
167 | type wycheproofTestAead struct { | 170 | type wycheproofTestAead struct { |
168 | TCID int `json:"tcId"` | 171 | TCID int `json:"tcId"` |
169 | Comment string `json:"comment"` | 172 | Comment string `json:"comment"` |
@@ -984,7 +987,7 @@ func runAesAeadTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEAD, w | |||
984 | return openEvp && sealEvp && openAead && sealAead | 987 | return openEvp && sealEvp && openAead && sealAead |
985 | } | 988 | } |
986 | 989 | ||
987 | func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { | 990 | func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAesAead) bool { |
988 | fmt.Printf("Running %v test group %v with IV size %d, key size %d and tag size %d...\n", | 991 | fmt.Printf("Running %v test group %v with IV size %d, key size %d and tag size %d...\n", |
989 | algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) | 992 | algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) |
990 | 993 | ||
@@ -1288,7 +1291,7 @@ func runChaCha20Poly1305Test(algorithm string, wt *wycheproofTestAead) bool { | |||
1288 | return openSuccess && sealSuccess | 1291 | return openSuccess && sealSuccess |
1289 | } | 1292 | } |
1290 | 1293 | ||
1291 | func runChaCha20Poly1305TestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { | 1294 | func runChaCha20Poly1305TestGroup(algorithm string, wtg *wycheproofTestGroupChaCha) bool { |
1292 | // ChaCha20-Poly1305 currently only supports nonces of length 12 (96 bits) | 1295 | // ChaCha20-Poly1305 currently only supports nonces of length 12 (96 bits) |
1293 | if algorithm == "CHACHA20-POLY1305" && wtg.IVSize != 96 { | 1296 | if algorithm == "CHACHA20-POLY1305" && wtg.IVSize != 96 { |
1294 | return true | 1297 | return true |
@@ -2779,13 +2782,13 @@ func runTestVectors(path string, variant testVariant) bool { | |||
2779 | case "AES-CBC-PKCS5": | 2782 | case "AES-CBC-PKCS5": |
2780 | wtg = &wycheproofTestGroupAesCbcPkcs5{} | 2783 | wtg = &wycheproofTestGroupAesCbcPkcs5{} |
2781 | case "AES-CCM": | 2784 | case "AES-CCM": |
2782 | wtg = &wycheproofTestGroupAead{} | 2785 | wtg = &wycheproofTestGroupAesAead{} |
2783 | case "AES-CMAC": | 2786 | case "AES-CMAC": |
2784 | wtg = &wycheproofTestGroupAesCmac{} | 2787 | wtg = &wycheproofTestGroupAesCmac{} |
2785 | case "AES-GCM": | 2788 | case "AES-GCM": |
2786 | wtg = &wycheproofTestGroupAead{} | 2789 | wtg = &wycheproofTestGroupAesAead{} |
2787 | case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": | 2790 | case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": |
2788 | wtg = &wycheproofTestGroupAead{} | 2791 | wtg = &wycheproofTestGroupChaCha{} |
2789 | case "DSA": | 2792 | case "DSA": |
2790 | wtg = &wycheproofTestGroupDSA{} | 2793 | wtg = &wycheproofTestGroupDSA{} |
2791 | case "ECDH": | 2794 | case "ECDH": |
@@ -2834,13 +2837,13 @@ func runTestVectors(path string, variant testVariant) bool { | |||
2834 | case "AES-CBC-PKCS5": | 2837 | case "AES-CBC-PKCS5": |
2835 | return runAesCbcPkcs5TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesCbcPkcs5)) | 2838 | return runAesCbcPkcs5TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesCbcPkcs5)) |
2836 | case "AES-CCM": | 2839 | case "AES-CCM": |
2837 | return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) | 2840 | return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesAead)) |
2838 | case "AES-CMAC": | 2841 | case "AES-CMAC": |
2839 | return runAesCmacTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesCmac)) | 2842 | return runAesCmacTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesCmac)) |
2840 | case "AES-GCM": | 2843 | case "AES-GCM": |
2841 | return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) | 2844 | return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesAead)) |
2842 | case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": | 2845 | case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": |
2843 | return runChaCha20Poly1305TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) | 2846 | return runChaCha20Poly1305TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupChaCha)) |
2844 | case "DSA": | 2847 | case "DSA": |
2845 | return runDSATestGroup(wtv.Algorithm, variant, wtg.(*wycheproofTestGroupDSA)) | 2848 | return runDSATestGroup(wtv.Algorithm, variant, wtg.(*wycheproofTestGroupDSA)) |
2846 | case "ECDH": | 2849 | case "ECDH": |