Added random number API. The only API call is moved and
renamed from crypto.h.

Signed-off-by: Petri Savolainen <[email protected]>
---
 include/odp.h                               |  1 +
 include/odp/api/random.h                    | 48 +++++++++++++++++++++++++++++
 platform/linux-generic/Makefile.am          |  2 ++
 platform/linux-generic/include/odp/random.h | 34 ++++++++++++++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 include/odp/api/random.h
 create mode 100644 platform/linux-generic/include/odp/random.h

diff --git a/include/odp.h b/include/odp.h
index 30bed8e..139abdf 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -50,6 +50,7 @@ extern "C" {
 #include <odp/classification.h>
 #include <odp/rwlock.h>
 #include <odp/event.h>
+#include <odp/random.h>
 
 #ifdef __cplusplus
 }
diff --git a/include/odp/api/random.h b/include/odp/api/random.h
new file mode 100644
index 0000000..65acdb3
--- /dev/null
+++ b/include/odp/api/random.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP random number API
+ */
+
+#ifndef ODP_RANDOM_H_
+#define ODP_RANDOM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup odp_random ODP RANDOM
+ *  @{
+ */
+
+
+/**
+ * Generate random byte string
+ *
+ * @param buf          Pointer to store result
+ * @param len          Pointer to input length value as well as return value
+ * @param use_entropy  Use entropy
+ *
+ * @todo Define the implication of the use_entropy parameter
+ *
+ * @return 0 if succesful
+ */
+int odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index addb5ec..935dd24 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -29,6 +29,7 @@ odpinclude_HEADERS = \
                  $(top_srcdir)/platform/linux-generic/include/odp/packet_io.h \
                  $(top_srcdir)/platform/linux-generic/include/odp/pool.h \
                  $(top_srcdir)/platform/linux-generic/include/odp/queue.h \
+                 $(top_srcdir)/platform/linux-generic/include/odp/random.h \
                  $(top_srcdir)/platform/linux-generic/include/odp/rwlock.h \
                  $(top_srcdir)/platform/linux-generic/include/odp/schedule.h \
                  
$(top_srcdir)/platform/linux-generic/include/odp/shared_memory.h \
@@ -80,6 +81,7 @@ odpapiinclude_HEADERS = \
                  $(top_srcdir)/include/odp/api/packet_io.h \
                  $(top_srcdir)/include/odp/api/pool.h \
                  $(top_srcdir)/include/odp/api/queue.h \
+                 $(top_srcdir)/include/odp/api/random.h \
                  $(top_srcdir)/include/odp/api/rwlock.h \
                  $(top_srcdir)/include/odp/api/schedule.h \
                  $(top_srcdir)/include/odp/api/shared_memory.h \
diff --git a/platform/linux-generic/include/odp/random.h 
b/platform/linux-generic/include/odp/random.h
new file mode 100644
index 0000000..e9b4bd0
--- /dev/null
+++ b/platform/linux-generic/include/odp/random.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP random number API
+ */
+
+#ifndef ODP_PLAT_RANDOM_H_
+#define ODP_PLAT_RANDOM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_random ODP RANDOM
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/api/random.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.2.2


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to