Fix name clash in test structures Revealed by -lfto linking. Creating multiple classes with the same name but different contents is illegal. Change-Id: I184c34235f4f11e94d47dee1ca2d1a97de55d6ba Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/36304 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/base64/base64_test.cc b/crypto/base64/base64_test.cc index 9122dee..6905659 100644 --- a/crypto/base64/base64_test.cc +++ b/crypto/base64/base64_test.cc
@@ -39,14 +39,14 @@ invalid, }; -struct TestVector { +struct Base64TestVector { enum encoding_relation relation; const char *decoded; const char *encoded; }; // Test vectors from RFC 4648. -static const TestVector kTestVectors[] = { +static const Base64TestVector kTestVectors[] = { {canonical, "", ""}, {canonical, "f", "Zg==\n"}, {canonical, "fo", "Zm8=\n"}, @@ -103,7 +103,7 @@ "=======\n"}, }; -class Base64Test : public testing::TestWithParam<TestVector> {}; +class Base64Test : public testing::TestWithParam<Base64TestVector> {}; INSTANTIATE_TEST_SUITE_P(, Base64Test, testing::ValuesIn(kTestVectors)); @@ -122,7 +122,7 @@ } TEST_P(Base64Test, EncodeBlock) { - const TestVector &t = GetParam(); + const Base64TestVector &t = GetParam(); if (t.relation != canonical) { return; } @@ -140,7 +140,7 @@ } TEST_P(Base64Test, DecodeBase64) { - const TestVector &t = GetParam(); + const Base64TestVector &t = GetParam(); if (t.relation == valid) { // The non-canonical encodings will generally have odd whitespace etc // that |EVP_DecodeBase64| will reject. @@ -164,7 +164,7 @@ } TEST_P(Base64Test, DecodeBlock) { - const TestVector &t = GetParam(); + const Base64TestVector &t = GetParam(); if (t.relation != canonical) { return; } @@ -188,7 +188,7 @@ } TEST_P(Base64Test, EncodeDecode) { - const TestVector &t = GetParam(); + const Base64TestVector &t = GetParam(); EVP_ENCODE_CTX ctx; const size_t decoded_len = strlen(t.decoded); @@ -246,7 +246,7 @@ } TEST_P(Base64Test, DecodeUpdateStreaming) { - const TestVector &t = GetParam(); + const Base64TestVector &t = GetParam(); if (t.relation == invalid) { return; }
diff --git a/crypto/digest_extra/digest_test.cc b/crypto/digest_extra/digest_test.cc index 7d07c04..6d02c08 100644 --- a/crypto/digest_extra/digest_test.cc +++ b/crypto/digest_extra/digest_test.cc
@@ -55,7 +55,7 @@ static const MD sha512 = { "SHA512", &EVP_sha512, &SHA512 }; static const MD md5_sha1 = { "MD5-SHA1", &EVP_md5_sha1, nullptr }; -struct TestVector { +struct DigestTestVector { // md is the digest to test. const MD &md; // input is a NUL-terminated string to hash. @@ -66,7 +66,7 @@ const char *expected_hex; }; -static const TestVector kTestVectors[] = { +static const DigestTestVector kTestVectors[] = { // MD4 tests, from RFC 1320. (crypto/md4 does not provide a // one-shot MD4 function.) { md4, "", 1, "31d6cfe0d16ae931b73c59d7e0c089c0" }, @@ -144,7 +144,7 @@ "900150983cd24fb0d6963f7d28e17f72a9993e364706816aba3e25717850c26c9cd0d89d" }, }; -static void CompareDigest(const TestVector *test, +static void CompareDigest(const DigestTestVector *test, const uint8_t *digest, size_t digest_len) { static const char kHexTable[] = "0123456789abcdef"; @@ -159,7 +159,7 @@ EXPECT_STREQ(test->expected_hex, digest_hex); } -static void TestDigest(const TestVector *test) { +static void TestDigest(const DigestTestVector *test) { bssl::ScopedEVP_MD_CTX ctx; // Test the input provided.
diff --git a/decrepit/blowfish/blowfish_test.cc b/decrepit/blowfish/blowfish_test.cc index d19346a..4b08fe4 100644 --- a/decrepit/blowfish/blowfish_test.cc +++ b/decrepit/blowfish/blowfish_test.cc
@@ -19,7 +19,7 @@ #include "../../crypto/internal.h" #include "../../crypto/test/test_util.h" -struct TestCase { +struct BlowfishTestCase { uint8_t key[16]; uint8_t plaintext[16]; uint8_t iv[8]; @@ -28,7 +28,7 @@ uint8_t cfb_ciphertext[16]; }; -static const TestCase kTests[] = { +static const BlowfishTestCase kTests[] = { // Randomly generated test cases. Checked against vanilla OpenSSL. { {0xbb, 0x56, 0xb1, 0x27, 0x7c, 0x4c, 0xdd, 0x5a, 0x99, 0x90, 0x1e, 0x6f,
diff --git a/decrepit/cast/cast_test.cc b/decrepit/cast/cast_test.cc index 05a04cb..fd5f2a9 100644 --- a/decrepit/cast/cast_test.cc +++ b/decrepit/cast/cast_test.cc
@@ -19,7 +19,7 @@ #include "../../crypto/internal.h" #include "../../crypto/test/test_util.h" -struct TestCase { +struct CastTestCase { uint8_t key[16]; uint8_t plaintext[16]; uint8_t iv[8]; @@ -27,7 +27,7 @@ uint8_t cbc_ciphertext[24]; }; -static const TestCase kTests[] = { +static const CastTestCase kTests[] = { // Randomly generated test cases. Checked against vanilla OpenSSL. { {0xbb, 0x56, 0xb1, 0x27, 0x7c, 0x4c, 0xdd, 0x5a, 0x99, 0x90, 0x1e, 0x6f,