Remove union from |SHA512_CTX|.

With 2fe0360a4e1b988e7b0aa0b4348bf55805512c09, we no longer use the
other member of this union so it can be removed.

Change-Id: Ideb7c47a72df0b420eb1e7d8c718e1cacb2129f5
Reviewed-on: https://boringssl-review.googlesource.com/c/34449
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/fipsmodule/sha/sha512.c b/crypto/fipsmodule/sha/sha512.c
index 517e9b0..f96cfbd 100644
--- a/crypto/fipsmodule/sha/sha512.c
+++ b/crypto/fipsmodule/sha/sha512.c
@@ -143,7 +143,7 @@
 
 int SHA512_Update(SHA512_CTX *c, const void *in_data, size_t len) {
   uint64_t l;
-  uint8_t *p = c->u.p;
+  uint8_t *p = c->p;
   const uint8_t *data = in_data;
 
   if (len == 0) {
@@ -160,7 +160,7 @@
   c->Nl = l;
 
   if (c->num != 0) {
-    size_t n = sizeof(c->u) - c->num;
+    size_t n = sizeof(c->p) - c->num;
 
     if (len < n) {
       OPENSSL_memcpy(p + c->num, data, len);
@@ -174,10 +174,10 @@
     }
   }
 
-  if (len >= sizeof(c->u)) {
-    sha512_block_data_order(c->h, data, len / sizeof(c->u));
+  if (len >= sizeof(c->p)) {
+    sha512_block_data_order(c->h, data, len / sizeof(c->p));
     data += len;
-    len %= sizeof(c->u);
+    len %= sizeof(c->p);
     data -= len;
   }
 
@@ -190,34 +190,34 @@
 }
 
 int SHA512_Final(uint8_t *md, SHA512_CTX *sha) {
-  uint8_t *p = sha->u.p;
+  uint8_t *p = sha->p;
   size_t n = sha->num;
 
   p[n] = 0x80;  // There always is a room for one
   n++;
-  if (n > (sizeof(sha->u) - 16)) {
-    OPENSSL_memset(p + n, 0, sizeof(sha->u) - n);
+  if (n > (sizeof(sha->p) - 16)) {
+    OPENSSL_memset(p + n, 0, sizeof(sha->p) - n);
     n = 0;
     sha512_block_data_order(sha->h, p, 1);
   }
 
-  OPENSSL_memset(p + n, 0, sizeof(sha->u) - 16 - n);
-  p[sizeof(sha->u) - 1] = (uint8_t)(sha->Nl);
-  p[sizeof(sha->u) - 2] = (uint8_t)(sha->Nl >> 8);
-  p[sizeof(sha->u) - 3] = (uint8_t)(sha->Nl >> 16);
-  p[sizeof(sha->u) - 4] = (uint8_t)(sha->Nl >> 24);
-  p[sizeof(sha->u) - 5] = (uint8_t)(sha->Nl >> 32);
-  p[sizeof(sha->u) - 6] = (uint8_t)(sha->Nl >> 40);
-  p[sizeof(sha->u) - 7] = (uint8_t)(sha->Nl >> 48);
-  p[sizeof(sha->u) - 8] = (uint8_t)(sha->Nl >> 56);
-  p[sizeof(sha->u) - 9] = (uint8_t)(sha->Nh);
-  p[sizeof(sha->u) - 10] = (uint8_t)(sha->Nh >> 8);
-  p[sizeof(sha->u) - 11] = (uint8_t)(sha->Nh >> 16);
-  p[sizeof(sha->u) - 12] = (uint8_t)(sha->Nh >> 24);
-  p[sizeof(sha->u) - 13] = (uint8_t)(sha->Nh >> 32);
-  p[sizeof(sha->u) - 14] = (uint8_t)(sha->Nh >> 40);
-  p[sizeof(sha->u) - 15] = (uint8_t)(sha->Nh >> 48);
-  p[sizeof(sha->u) - 16] = (uint8_t)(sha->Nh >> 56);
+  OPENSSL_memset(p + n, 0, sizeof(sha->p) - 16 - n);
+  p[sizeof(sha->p) - 1] = (uint8_t)(sha->Nl);
+  p[sizeof(sha->p) - 2] = (uint8_t)(sha->Nl >> 8);
+  p[sizeof(sha->p) - 3] = (uint8_t)(sha->Nl >> 16);
+  p[sizeof(sha->p) - 4] = (uint8_t)(sha->Nl >> 24);
+  p[sizeof(sha->p) - 5] = (uint8_t)(sha->Nl >> 32);
+  p[sizeof(sha->p) - 6] = (uint8_t)(sha->Nl >> 40);
+  p[sizeof(sha->p) - 7] = (uint8_t)(sha->Nl >> 48);
+  p[sizeof(sha->p) - 8] = (uint8_t)(sha->Nl >> 56);
+  p[sizeof(sha->p) - 9] = (uint8_t)(sha->Nh);
+  p[sizeof(sha->p) - 10] = (uint8_t)(sha->Nh >> 8);
+  p[sizeof(sha->p) - 11] = (uint8_t)(sha->Nh >> 16);
+  p[sizeof(sha->p) - 12] = (uint8_t)(sha->Nh >> 24);
+  p[sizeof(sha->p) - 13] = (uint8_t)(sha->Nh >> 32);
+  p[sizeof(sha->p) - 14] = (uint8_t)(sha->Nh >> 40);
+  p[sizeof(sha->p) - 15] = (uint8_t)(sha->Nh >> 48);
+  p[sizeof(sha->p) - 16] = (uint8_t)(sha->Nh >> 56);
 
   sha512_block_data_order(sha->h, p, 1);
 
diff --git a/include/openssl/sha.h b/include/openssl/sha.h
index 2c0dcb7..c9b327d 100644
--- a/include/openssl/sha.h
+++ b/include/openssl/sha.h
@@ -244,10 +244,7 @@
 struct sha512_state_st {
   uint64_t h[8];
   uint64_t Nl, Nh;
-  union {
-    uint64_t d[16];
-    uint8_t p[128];
-  } u;
+  uint8_t p[128];
   unsigned num, md_len;
 };