When testing AEADs, don't split both the AAD and the plaintext.

This greatly reduces the number of test cases tried at no cost in
coverage.

Bug: 383343306
Change-Id: Ia667848912915d6a5f9269b8eb9608985aab6ae1
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/85487
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: Rudolf Polzer <rpolzer@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/cipher/aead_test.cc b/crypto/cipher/aead_test.cc
index 12a4819..b937c77 100644
--- a/crypto/cipher/aead_test.cc
+++ b/crypto/cipher/aead_test.cc
@@ -528,7 +528,7 @@
   const size_t last_block_start = (length - 1) / block_size * block_size;
 
   // 1 chunk.
-  ideas.insert({});
+  ideas.insert(std::set<size_t>{});
 
   // 2 chunks.
   ideas.insert({0});
@@ -613,6 +613,12 @@
           !(aead_config.flags & kNondeterministic)) {
         for (const auto &splits :
              InterestingSplitsForLength(in.size(), /*block_size=*/16)) {
+          if (!adsplits.empty() && !splits.empty()) {
+            // No need to test both with split AAD and split iovec. Each split
+            // on its own should already hit everything interesting.
+            continue;
+          }
+
           SCOPED_TRACE(FormatSplits(splits));
           TestIOVecs iovecs = TestIOVecs::Split(in, splits, in_place);
 
@@ -660,6 +666,12 @@
         // Test the openv_detached API.
         for (const auto &splits :
              InterestingSplitsForLength(out.size(), /*block_size=*/16)) {
+          if (!adsplits.empty() && !splits.empty()) {
+            // No need to test both with split AAD and split iovec. Each split
+            // on its own should already hit everything interesting.
+            continue;
+          }
+
           SCOPED_TRACE(FormatSplits(splits));
           TestIOVecs iovecs = TestIOVecs::Split(out, splits, in_place);
 
@@ -748,6 +760,12 @@
         combined.insert(combined.end(), out_tag.begin(), out_tag.end());
         for (const auto &splits :
              InterestingSplitsForLength(combined.size(), /*block_size=*/16)) {
+          if (!adsplits.empty() && !splits.empty()) {
+            // No need to test both with split AAD and split iovec. Each split
+            // on its own should already hit everything interesting.
+            continue;
+          }
+
           SCOPED_TRACE(FormatSplits(splits));
           TestIOVecs iovecs = TestIOVecs::Split(combined, splits, in_place);