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>
This commit is contained in:
David Benjamin 2015-07-10 14:58:29 -04:00 committed by Adam Langley
parent 723f3534ff
commit 4a59709ca1

View File

@ -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 @@ static bool TestPoly1305(FileTest *t, void *arg) {
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.");