Restore the __SHA__ compile-time check for Intel SHA Extensions

It's been about a year since the CrOS toolchain was fixed, and QEMU 8.2
has been around for a while. Let's see if it works.

Update-Note: If SHA starts crashing on illegal instruction, check if you
are building in a configuration that assumes Intel SHA extensions (e.g.
-march=goldmont) and then running on a machine that lacks them. (If
using QEMU, update to QEMU 8.2 or later to be able to correctly emulate
a processor with SHA extensions.) If so, let us know, though if you can
simply fix your build, that's simplest.

Bug: 320482539
Change-Id: Ie4584cde452a1ff9416fbac89369813a6991ff8a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/75869
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/crypto/internal.h b/crypto/internal.h
index bdbe82a..960724e 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -1219,27 +1219,11 @@
 
 // SHA-1 and SHA-256 are defined as a single extension.
 inline int CRYPTO_is_x86_SHA_capable(void) {
-  // We should check __SHA__ here, but for now we ignore it. We've run into a
-  // few places where projects build with -march=goldmont, but need a build that
-  // does not require SHA extensions:
-  //
-  // - Some CrOS toolchain definitions are incorrect and build with
-  //   -march=goldmont when targetting boards that are not Goldmont. b/320482539
-  //   tracks fixing this.
-  //
-  // - Sometimes projects build with -march=goldmont as a rough optimized
-  //   baseline. However, Intel CPU capabilities are not strictly linear, so
-  //   this does not quite work. Some combination of -mtune and
-  //   -march=x86-64-v{1,2,3,4} would be a better strategy here.
-  //
-  // - QEMU versions before 8.2 do not support SHA extensions and disable it
-  //   with a warning. Projects that target Goldmont and test on QEMU will
-  //   break. The long-term fix is to update to 8.2. A principled short-term fix
-  //   would be -march=goldmont -mno-sha, to reflect that the binary needs to
-  //   run on both QEMU-8.1-Goldmont and actual-Goldmont.
-  //
-  // TODO(b/320482539): Once the CrOS toolchain is fixed, try this again.
+#if defined(__SHA__)
+  return 1;
+#else
   return (OPENSSL_get_ia32cap(2) & (1u << 29)) != 0;
+#endif
 }
 
 // CRYPTO_cpu_perf_is_like_silvermont returns one if, based on a heuristic, the