Fix Windows build.
MSVC 2013 doesn't implement C++11 alignas. Use __declspec instead.
Change-Id: I48a402d56d734f3f2c434b4bdf2a5bc671c50225
Reviewed-on: https://boringssl-review.googlesource.com/5421
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/poly1305/poly1305_test.cc b/crypto/poly1305/poly1305_test.cc
index fd1c89a..0526075 100644
--- a/crypto/poly1305/poly1305_test.cc
+++ b/crypto/poly1305/poly1305_test.cc
@@ -24,6 +24,14 @@
#include "../test/stl_compat.h"
+// |CRYPTO_poly1305_finish| requires a 16-byte-aligned output.
+#if defined(OPENSSL_WINDOWS)
+// MSVC doesn't support C++11 |alignas|.
+#define ALIGNED __declspec(align(16))
+#else
+#define ALIGNED alignas(16)
+#endif
+
static bool TestPoly1305(FileTest *t, void *arg) {
std::vector<uint8_t> key, in, mac;
if (!t->GetBytes(&key, "Key") ||
@@ -40,8 +48,7 @@
poly1305_state state;
CRYPTO_poly1305_init(&state, bssl::vector_data(&key));
CRYPTO_poly1305_update(&state, bssl::vector_data(&in), in.size());
- // |CRYPTO_poly1305_finish| requires a 16-byte-aligned output.
- alignas(16) uint8_t out[16];
+ ALIGNED uint8_t out[16];
CRYPTO_poly1305_finish(&state, out);
if (!t->ExpectBytesEqual(out, 16, bssl::vector_data(&mac), mac.size())) {
t->PrintLine("Single-shot Poly1305 failed.");