Message ID | 1422971062-32528-1-git-send-email-petri.savolainen@linaro.org |
---|---|
State | Accepted |
Commit | 0173f48f780ba5b4775dd22e521334833bee3996 |
Headers | show |
See previous comment. Not relevant to v1.0 and in any event should require Robbie's review. On Tue, Feb 3, 2015 at 7:44 AM, Petri Savolainen < petri.savolainen@linaro.org> wrote: > Added random number API. The only API call is moved and > renamed from crypto.h. > > Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> > --- > 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 > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
Merged, Maxim. On 02/04/2015 05:53 PM, Robbie King (robking) wrote: > Per our conversation on today's call we are making the API change > and still have the future "@todo" to document entropy once we have > input for vendor implementations. > > Reviewed-by: Robbie King <robking@cisco.com> > > -----Original Message----- > From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of Petri Savolainen > Sent: Tuesday, February 03, 2015 8:44 AM > To: lng-odp@lists.linaro.org > Subject: [lng-odp] [PATCH 1/2] api: random: Added random.h > > Added random number API. The only API call is moved and > renamed from crypto.h. > > Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> > --- > 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
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
Added random number API. The only API call is moved and renamed from crypto.h. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- 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