aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac16
-rw-r--r--include/odp/autoheader_internal.h.in3
-rw-r--r--platform/linux-generic/odp_random.c10
-rw-r--r--platform/linux-generic/odp_random_openssl.c4
4 files changed, 26 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 19d0a84a8..1aa5a85c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,6 +339,21 @@ AM_CONDITIONAL([WITH_OPENSSL], [test x$with_openssl != xno])
AC_DEFINE_UNQUOTED([_ODP_OPENSSL], [$have_openssl],
[Define to 1 to enable OpenSSL support])
+have_openssl_rand=1
+AC_ARG_ENABLE([openssl-rand],
+ [AS_HELP_STRING([--disable-openssl-rand],
+ [Disable OpenSSL random data (use arch-specific instead)]
+ [[default=enabled]])],
+ [if test "x$enableval" = "xno"; then
+ have_openssl_rand=0
+ fi])
+
+AS_IF([test "$have_openssl" != "1"], [have_openssl_rand=0])
+AS_IF([test "$have_openssl_rand" = "1"], [openssl_rand=yes], [openssl_rand=no])
+
+AC_DEFINE_UNQUOTED([_ODP_OPENSSL_RAND], [$have_openssl_rand],
+ [Define to 1 to enable OpenSSL support])
+
##########################################################################
# Include m4 files
##########################################################################
@@ -523,6 +538,7 @@ AC_MSG_RESULT([
testdir: ${testdir}
WITH_ARCH: ${WITH_ARCH}
with_openssl: ${with_openssl}
+ openssl_rand: ${openssl_rand}
cc: ${CC}
cc version: ${CC_VERSION}
diff --git a/include/odp/autoheader_internal.h.in b/include/odp/autoheader_internal.h.in
index b9766e33e..952675fb5 100644
--- a/include/odp/autoheader_internal.h.in
+++ b/include/odp/autoheader_internal.h.in
@@ -29,4 +29,7 @@
/* Define to 1 to enable OpenSSL support */
#undef _ODP_OPENSSL
+/* Define to 1 to enable OpenSSL random data */
+#undef _ODP_OPENSSL_RAND
+
#endif
diff --git a/platform/linux-generic/odp_random.c b/platform/linux-generic/odp_random.c
index 0379bd398..3060e8ed9 100644
--- a/platform/linux-generic/odp_random.c
+++ b/platform/linux-generic/odp_random.c
@@ -18,7 +18,7 @@ odp_random_kind_t odp_random_max_kind(void)
{
odp_random_kind_t kind, max_kind = ODP_RANDOM_BASIC;
- if (_ODP_OPENSSL)
+ if (_ODP_OPENSSL_RAND)
max_kind = ODP_RANDOM_CRYPTO;
kind = _odp_random_max_kind();
@@ -32,11 +32,11 @@ int32_t odp_random_data(uint8_t *buf, uint32_t len, odp_random_kind_t kind)
{
switch (kind) {
case ODP_RANDOM_BASIC:
- if (_ODP_OPENSSL)
+ if (_ODP_OPENSSL_RAND)
return _odp_random_openssl_data(buf, len);
return _odp_random_std_data(buf, len);
case ODP_RANDOM_CRYPTO:
- if (_ODP_OPENSSL)
+ if (_ODP_OPENSSL_RAND)
return _odp_random_openssl_data(buf, len);
return _odp_random_crypto_data(buf, len);
case ODP_RANDOM_TRUE:
@@ -53,14 +53,14 @@ int32_t odp_random_test_data(uint8_t *buf, uint32_t len, uint64_t *seed)
int _odp_random_init_local(void)
{
- if (_ODP_OPENSSL)
+ if (_ODP_OPENSSL_RAND)
return _odp_random_openssl_init_local();
return _odp_random_std_init_local();
}
int _odp_random_term_local(void)
{
- if (_ODP_OPENSSL)
+ if (_ODP_OPENSSL_RAND)
return _odp_random_openssl_term_local();
return _odp_random_std_term_local();
}
diff --git a/platform/linux-generic/odp_random_openssl.c b/platform/linux-generic/odp_random_openssl.c
index 4aee9aeab..fdc40871b 100644
--- a/platform/linux-generic/odp_random_openssl.c
+++ b/platform/linux-generic/odp_random_openssl.c
@@ -11,7 +11,7 @@
#include <odp_init_internal.h>
#include <odp_random_openssl_internal.h>
-#if _ODP_OPENSSL
+#if _ODP_OPENSSL_RAND
#include <openssl/rand.h>
int32_t _odp_random_openssl_data(uint8_t *buf, uint32_t len)
@@ -28,7 +28,7 @@ int32_t _odp_random_openssl_data(uint8_t *buf ODP_UNUSED,
{
return -1;
}
-#endif /* _ODP_OPENSSL */
+#endif /* _ODP_OPENSSL_RAND */
int _odp_random_openssl_init_local(void)
{