about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-10-26 17:31:01 +0200
committerGitHub <noreply@github.com>2019-10-26 17:31:01 +0200
commit8e41a59e2e00447a97208ed7cf0d163a3d47066b (patch)
tree0091c64da66fe6238af9963f2626db578bff30bd /include
parent17729ce856058845314d1a3cb08e7a28d943db29 (diff)
parent15c920a6126e3a0b5ac5a7293188c3d7a523bbde (diff)
downloadafl++-8e41a59e2e00447a97208ed7cf0d163a3d47066b.tar.gz
Merge pull request #87 from devnexen/gcc_llvm_plugins_little_cjg
Little compiler plugins rework regarding block location picked up.
Diffstat (limited to 'include')
-rw-r--r--include/types.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/types.h b/include/types.h
index c34bf522..3f34db66 100644
--- a/include/types.h
+++ b/include/types.h
@@ -79,9 +79,21 @@ typedef int64_t s64;
   })
 
 #ifdef AFL_LLVM_PASS
+#if defined(__linux__)
+#define AFL_SR(s) (srandom(s))
 #define AFL_R(x) (random() % (x))
 #else
+#define AFL_SR(s)
+#define AFL_R(x) (arc4random_uniform(x))
+#endif
+#else
+#if defined(__linux__)
+#define SR(s) (srandom(s))
 #define R(x) (random() % (x))
+#else
+#define SR(s)
+#define R(x) (arc4random_uniform(x))
+#endif
 #endif                                                    /* ^AFL_LLVM_PASS */
 
 #define STRINGIFY_INTERNAL(x) #x