summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-19 21:08:37 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-19 21:08:37 -0400
commit6102333fc3c1c73c8c5b05e7cd568ac681741c9d (patch)
tree1a54b40f518230ac1727380ea431b85cf7d87495 /config.h
parent6440921723695913cfcfffdf2c59f0cf01e59c89 (diff)
downloadcryptopp-git-6102333fc3c1c73c8c5b05e7cd568ac681741c9d.tar.gz
Add CRYPTOPP_NO_CPU_FEATURE_PROBES (GH #511)
We determine machine capabilities by performing an os/platform *query* first, like getauxv(). If the *query* fails, we move onto a cpu *probe*. The cpu *probe* tries to exeute an instruction and then catches a SIGILL on Linux or the exception EXCEPTION_ILLEGAL_INSTRUCTION on Windows. Some OSes fail to hangle a SIGILL gracefully, like Apple OSes. Apple machines corrupt memory and variables around the probe.
Diffstat (limited to 'config.h')
-rw-r--r--config.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/config.h b/config.h
index 092edbd6..6e0f2fb2 100644
--- a/config.h
+++ b/config.h
@@ -664,6 +664,18 @@ NAMESPACE_END
# define CRYPTOPP_CONSTANT(x) enum {x};
#endif
+// How to disable CPU feature probing. We determine machine
+// capabilities by performing an os/platform *query* first,
+// like getauxv(). If the *query* fails, we move onto a
+// cpu *probe*. The cpu *probe* tries to exeute an instruction
+// and then catches a SIGILL on Linux or the exception
+// EXCEPTION_ILLEGAL_INSTRUCTION on Windows. Some OSes
+// fail to hangle a SIGILL gracefully, like Apple OSes. Apple
+// machines corrupt memory and variables around the probe.
+#if defined(__APPLE__)
+# define CRYPTOPP_NO_CPU_FEATURE_PROBES 1
+#endif
+
// ***************** Initialization and Constructor priorities ********************
// CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.