diff options
| author | tb <> | 2018-09-16 11:45:08 +0000 |
|---|---|---|
| committer | tb <> | 2018-09-16 11:45:08 +0000 |
| commit | b10895464058307a6a1994c56506841a4105550f (patch) | |
| tree | 52c69767a92a1a7aa90e74fe3b99885b9b7c1f57 /src | |
| parent | 98ef4d566fcc743c90383060bd0dfe6a35b98253 (diff) | |
| download | openbsd-b10895464058307a6a1994c56506841a4105550f.tar.gz openbsd-b10895464058307a6a1994c56506841a4105550f.tar.bz2 openbsd-b10895464058307a6a1994c56506841a4105550f.zip | |
Rename *AesCcmOrGcm* into the slightly less ugly *AesAead*.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/wycheproof/wycheproof.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/regress/lib/libcrypto/wycheproof/wycheproof.go b/src/regress/lib/libcrypto/wycheproof/wycheproof.go index 989ac0df26..ebfe105916 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.53 2018/09/15 22:09:08 tb Exp $ */ | 1 | /* $OpenBSD: wycheproof.go,v 1.54 2018/09/16 11:45:08 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 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| @@ -449,7 +449,7 @@ func runAesCbcPkcs5TestGroup(algorithm string, wtg *wycheproofTestGroupAesCbcPkc | |||
| 449 | return success | 449 | return success |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | func checkAesCcmOrGcm(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key []byte, keyLen int, iv []byte, ivLen int, aad []byte, aadLen int, in []byte, inLen int, out []byte, outLen int, tag []byte, tagLen int, wt *wycheproofTestAead) bool { | 452 | func checkAesAead(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, key []byte, keyLen int, iv []byte, ivLen int, aad []byte, aadLen int, in []byte, inLen int, out []byte, outLen int, tag []byte, tagLen int, wt *wycheproofTestAead) bool { |
| 453 | var ctrlSetIVLen C.int | 453 | var ctrlSetIVLen C.int |
| 454 | var ctrlSetTag C.int | 454 | var ctrlSetTag C.int |
| 455 | var ctrlGetTag C.int | 455 | var ctrlGetTag C.int |
| @@ -582,7 +582,7 @@ func checkAesCcmOrGcm(algorithm string, ctx *C.EVP_CIPHER_CTX, doEncrypt int, ke | |||
| 582 | return success | 582 | return success |
| 583 | } | 583 | } |
| 584 | 584 | ||
| 585 | func runAesCcmOrGcmTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEAD, wt *wycheproofTestAead) bool { | 585 | func runAesAeadTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEAD, wt *wycheproofTestAead) bool { |
| 586 | key, err := hex.DecodeString(wt.Key) | 586 | key, err := hex.DecodeString(wt.Key) |
| 587 | if err != nil { | 587 | if err != nil { |
| 588 | log.Fatalf("Failed to decode key %q: %v", wt.Key, err) | 588 | log.Fatalf("Failed to decode key %q: %v", wt.Key, err) |
| @@ -634,8 +634,8 @@ func runAesCcmOrGcmTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEA | |||
| 634 | tag = append(tag, 0) | 634 | tag = append(tag, 0) |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | openEvp := checkAesCcmOrGcm(algorithm, ctx, 0, key, keyLen, iv, ivLen, aad, aadLen, ct, ctLen, msg, msgLen, tag, tagLen, wt) | 637 | openEvp := checkAesAead(algorithm, ctx, 0, key, keyLen, iv, ivLen, aad, aadLen, ct, ctLen, msg, msgLen, tag, tagLen, wt) |
| 638 | sealEvp := checkAesCcmOrGcm(algorithm, ctx, 1, key, keyLen, iv, ivLen, aad, aadLen, msg, msgLen, ct, ctLen, tag, tagLen, wt) | 638 | sealEvp := checkAesAead(algorithm, ctx, 1, key, keyLen, iv, ivLen, aad, aadLen, msg, msgLen, ct, ctLen, tag, tagLen, wt) |
| 639 | 639 | ||
| 640 | openAead, sealAead := true, true | 640 | openAead, sealAead := true, true |
| 641 | if aead != nil { | 641 | if aead != nil { |
| @@ -657,7 +657,7 @@ func runAesCcmOrGcmTest(algorithm string, ctx *C.EVP_CIPHER_CTX, aead *C.EVP_AEA | |||
| 657 | return openEvp && sealEvp && openAead && sealAead | 657 | return openEvp && sealEvp && openAead && sealAead |
| 658 | } | 658 | } |
| 659 | 659 | ||
| 660 | func runAesCcmOrGcmTestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { | 660 | func runAesAeadTestGroup(algorithm string, wtg *wycheproofTestGroupAead) bool { |
| 661 | 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) | 661 | 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) |
| 662 | 662 | ||
| 663 | var cipher *C.EVP_CIPHER | 663 | var cipher *C.EVP_CIPHER |
| @@ -701,7 +701,7 @@ func runAesCcmOrGcmTestGroup(algorithm string, wtg *wycheproofTestGroupAead) boo | |||
| 701 | 701 | ||
| 702 | success := true | 702 | success := true |
| 703 | for _, wt := range wtg.Tests { | 703 | for _, wt := range wtg.Tests { |
| 704 | if !runAesCcmOrGcmTest(algorithm, ctx, aead, wt) { | 704 | if !runAesAeadTest(algorithm, ctx, aead, wt) { |
| 705 | success = false | 705 | success = false |
| 706 | } | 706 | } |
| 707 | } | 707 | } |
| @@ -1552,7 +1552,7 @@ func runTestVectors(path string) bool { | |||
| 1552 | success = false | 1552 | success = false |
| 1553 | } | 1553 | } |
| 1554 | case "AES-CCM": | 1554 | case "AES-CCM": |
| 1555 | if !runAesCcmOrGcmTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) { | 1555 | if !runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) { |
| 1556 | success = false | 1556 | success = false |
| 1557 | } | 1557 | } |
| 1558 | case "AES-CMAC": | 1558 | case "AES-CMAC": |
| @@ -1560,7 +1560,7 @@ func runTestVectors(path string) bool { | |||
| 1560 | success = false | 1560 | success = false |
| 1561 | } | 1561 | } |
| 1562 | case "AES-GCM": | 1562 | case "AES-GCM": |
| 1563 | if !runAesCcmOrGcmTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) { | 1563 | if !runAesAeadTestGroup(wtv.Algorithm, wtg.(*wycheproofTestGroupAead)) { |
| 1564 | success = false | 1564 | success = false |
| 1565 | } | 1565 | } |
| 1566 | case "CHACHA20-POLY1305": | 1566 | case "CHACHA20-POLY1305": |
