Gate SHA_CTX compatibility on !WINDOWS.

Windows does support anonymous unions but warns about it. Since I'm not
sure what warnings we have enabled in Chromium, this change just drops
the union for Windows.

Change-Id: I914f8cd5855eb07153105250c0f026eaedb35365
Reviewed-on: https://boringssl-review.googlesource.com/6631
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2015-12-04 13:17:57 -08:00
parent 34aa55c05e
commit 902870e3b5

View File

@ -98,8 +98,11 @@ OPENSSL_EXPORT uint8_t *SHA1(const uint8_t *data, size_t len, uint8_t *out);
OPENSSL_EXPORT void SHA1_Transform(SHA_CTX *sha, const uint8_t *block); OPENSSL_EXPORT void SHA1_Transform(SHA_CTX *sha, const uint8_t *block);
struct sha_state_st { struct sha_state_st {
#if defined(OPENSSL_WINDOWS)
uint32_t h[5];
#else
/* wpa_supplicant accesses |h0|..|h4| so we must support those names /* wpa_supplicant accesses |h0|..|h4| so we must support those names
* for compatibility. */ * for compatibility with it until it can be updated. */
union { union {
uint32_t h[5]; uint32_t h[5];
struct { struct {
@ -110,7 +113,7 @@ struct sha_state_st {
uint32_t h4; uint32_t h4;
}; };
}; };
#endif
uint32_t Nl, Nh; uint32_t Nl, Nh;
uint32_t data[16]; uint32_t data[16];
unsigned int num; unsigned int num;