From 3b2667c11fb5e9c2de2c92da87d6160f51dcc53c Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 6 Nov 2023 15:07:57 +0000 Subject: [PATCH] Add aliases for AES AEAD constructions and ChaCha These used the wycheproofTestGroupAead type but an upcoming change requires to change this. Introduce the aliases now to make the next diff cleaner. --- .../lib/libcrypto/wycheproof/wycheproof.go | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/regress/lib/libcrypto/wycheproof/wycheproof.go b/regress/lib/libcrypto/wycheproof/wycheproof.go index 7994e13879e..d9eda15f072 100644 --- a/regress/lib/libcrypto/wycheproof/wycheproof.go +++ b/regress/lib/libcrypto/wycheproof/wycheproof.go @@ -1,4 +1,4 @@ -/* $OpenBSD: wycheproof.go,v 1.147 2023/11/06 14:50:12 tb Exp $ */ +/* $OpenBSD: wycheproof.go,v 1.148 2023/11/06 15:07:57 tb Exp $ */ /* * Copyright (c) 2018 Joel Sing * Copyright (c) 2018,2019,2022 Theo Buehler @@ -164,6 +164,9 @@ type wycheproofTestGroupAead struct { Tests []*wycheproofTestAead `json:"tests"` } +type wycheproofTestGroupAesAead wycheproofTestGroupAead +type wycheproofTestGroupChaCha wycheproofTestGroupAead + type wycheproofTestAead struct { TCID int `json:"tcId"` Comment string `json:"comment"` @@ -984,7 +987,7 @@ func runAesAeadTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEAD, w return openEvp && sealEvp && openAead && sealAead } -func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { +func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAesAead) bool { fmt.Printf("Running %v test group %v with IV size %d, key size %d and tag size %d...\n", algorithm, wtg.Type, wtg.IVSize, wtg.KeySize, wtg.TagSize) @@ -1288,7 +1291,7 @@ func runChaCha20Poly1305Test(algorithm string, wt *wycheproofTestAead) bool { return openSuccess && sealSuccess } -func runChaCha20Poly1305TestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { +func runChaCha20Poly1305TestGroup(algorithm string, wtg *wycheproofTestGroupChaCha) bool { // ChaCha20-Poly1305 currently only supports nonces of length 12 (96 bits) if algorithm == "CHACHA20-POLY1305" && wtg.IVSize != 96 { return true @@ -2779,13 +2782,13 @@ func runTestVectors(path string, variant testVariant) bool { case "AES-CBC-PKCS5": wtg = &wycheproofTestGroupAesCbcPkcs5{} case "AES-CCM": - wtg = &wycheproofTestGroupAead{} + wtg = &wycheproofTestGroupAesAead{} case "AES-CMAC": wtg = &wycheproofTestGroupAesCmac{} case "AES-GCM": - wtg = &wycheproofTestGroupAead{} + wtg = &wycheproofTestGroupAesAead{} case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": - wtg = &wycheproofTestGroupAead{} + wtg = &wycheproofTestGroupChaCha{} case "DSA": wtg = &wycheproofTestGroupDSA{} case "ECDH": @@ -2834,13 +2837,13 @@ func runTestVectors(path string, variant testVariant) bool { case "AES-CBC-PKCS5": return runAesCbcPkcs5TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesCbcPkcs5)) case "AES-CCM": - return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) + return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesAead)) case "AES-CMAC": return runAesCmacTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesCmac)) case "AES-GCM": - return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) + return runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAesAead)) case "CHACHA20-POLY1305", "XCHACHA20-POLY1305": - return runChaCha20Poly1305TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) + return runChaCha20Poly1305TestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupChaCha)) case "DSA": return runDSATestGroup(wtv.Algorithm, variant, wtg.(*wycheproofTestGroupDSA)) case "ECDH": -- 2.20.1