Move gcm_test to C++

Since gcm_test now contains variable decls in for loops it needs
-std=c11. However, tests are compiled with C++ test_support files in
Bazel, which doesn't work with -std=c11.

Change-Id: Ife18c2d80b01448bb3b7ee2728412289bf749bd9
Reviewed-on: https://boringssl-review.googlesource.com/11041
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/modes/CMakeLists.txt b/crypto/modes/CMakeLists.txt
index 41f71d7..e8aa272 100644
--- a/crypto/modes/CMakeLists.txt
+++ b/crypto/modes/CMakeLists.txt
@@ -57,7 +57,7 @@
 add_executable(
   gcm_test
 
-  gcm_test.c
+  gcm_test.cc
 
   $<TARGET_OBJECTS:test_support>
 )
diff --git a/crypto/modes/gcm_test.c b/crypto/modes/gcm_test.cc
similarity index 98%
rename from crypto/modes/gcm_test.c
rename to crypto/modes/gcm_test.cc
index 6f9d528..51d966e 100644
--- a/crypto/modes/gcm_test.c
+++ b/crypto/modes/gcm_test.cc
@@ -269,7 +269,7 @@
     return 0;
   }
 
-  uint8_t *buf = OPENSSL_malloc(len / 2);
+  uint8_t *buf = reinterpret_cast<uint8_t *>(OPENSSL_malloc(len / 2));
   if (buf == NULL) {
     fprintf(stderr, "%u: malloc failure.\n", test_num);
     goto err;
@@ -332,7 +332,7 @@
     goto out;
   }
 
-  out = OPENSSL_malloc(plaintext_len);
+  out = reinterpret_cast<uint8_t *>(OPENSSL_malloc(plaintext_len));
   if (plaintext_len != 0 && out == NULL) {
     goto out;
   }