Add a control to disable the Poly1305 NEON code.

Some phones have a buggy NEON unit and the Poly1305 NEON code fails on
them, even though other NEON code appears to work fine.

This change:

1) Fixes a bug where NEON was assumed even when the code wasn't compiled
   in NEON mode.

2) Adds a second NEON control bit that can be disabled in order to run
   NEON code, but not the Poly1305 NEON code.

https://code.google.com/p/chromium/issues/detail?id=341598

Change-Id: Icb121bf8dba47c7a46c7667f676ff7a4bc973625
Reviewed-on: https://boringssl-review.googlesource.com/1351
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/arm_arch.h b/crypto/arm_arch.h
index d528eee..52e6f34 100644
--- a/crypto/arm_arch.h
+++ b/crypto/arm_arch.h
@@ -88,13 +88,22 @@
 #endif
 
 #if !__ASSEMBLER__
+
 /* OPENSSL_armcap_P contains flags describing the capabilities of the CPU and
  * is easy for assembly code to acesss. For C code, see the functions in
  * |cpu.h|. */
-extern unsigned int OPENSSL_armcap_P;
+extern uint32_t OPENSSL_armcap_P;
 
-#define ARMV7_NEON      (1<<0)
-#endif
+/* ARMV7_NEON is true when a NEON unit is present in the current CPU. */
+#define ARMV7_NEON (1 << 0)
+
+/* ARMV7_NEON_FUNCTIONAL is true when the NEON unit doesn't contain subtle bugs.
+ * The Poly1305 NEON code is known to trigger bugs in the NEON units of some
+ * phones. If this bit isn't set then the Poly1305 NEON code won't be used.
+ * See https://code.google.com/p/chromium/issues/detail?id=341598. */
+#define ARMV7_NEON_FUNCTIONAL (1 << 1)
+
+#endif  /* !__ASSEMBLER__ */
 
 
 #endif  /* OPENSSL_HEADER_THREAD_H */