From patchwork Tue Feb 3 13:44:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44227 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D637621513 for ; Tue, 3 Feb 2015 13:45:05 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gm9sf20916934lab.0 for ; Tue, 03 Feb 2015 05:45:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=CTWxgbD11r5wfqHavWEOe+RLo3P7HRYeRJYwG5aCfsQ=; b=P7hpZmJGRKbcMmxreEJUHBDn9YRIbMvoRQpMf2BvrrmI8qWgirZhS25Ui4vVz/89JB 9euLZtC2YDv+AjKY8rJ6d0j5tlqlUs0xwX2//OjR4bqAncdF2XJvvaBRjeWulAkQuHln pv8ErKtxZPI5M+lo/eBRswV9gnp1Ra3fn3Srig3IAEl6qsCKYN8yG9NUNdTxV40uJ+AV V6TUdPu6ArKHb2iKniybX5xZ/BBbgEzJY/iGevc4kHZl15J0AsrdmH2QrA1vGLA7ENPD EtmQYIGDwVfxL4yXsT1pcpV7FXeWgn3QstByziMzQ12ewi45T8pohd2MxyHFQyAu3wPq 0BYA== X-Gm-Message-State: ALoCoQktCQnFuj+yKzoelP9ZjLonjzeYRdJEI8dISlahCbPP+hOCUgWO2HE/60Tbc0/Kskox5apk X-Received: by 10.112.181.198 with SMTP id dy6mr3195639lbc.22.1422971104804; Tue, 03 Feb 2015 05:45:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.71 with SMTP id lu7ls380865lac.40.gmail; Tue, 03 Feb 2015 05:45:04 -0800 (PST) X-Received: by 10.152.87.83 with SMTP id v19mr2157272laz.15.1422971104595; Tue, 03 Feb 2015 05:45:04 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id e8si19183017lam.60.2015.02.03.05.45.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:45:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so51734207lab.12 for ; Tue, 03 Feb 2015 05:45:04 -0800 (PST) X-Received: by 10.112.188.227 with SMTP id gd3mr24295149lbc.22.1422971104484; Tue, 03 Feb 2015 05:45:04 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1946092lbj; Tue, 3 Feb 2015 05:45:03 -0800 (PST) X-Received: by 10.224.126.201 with SMTP id d9mr53711396qas.49.1422971103274; Tue, 03 Feb 2015 05:45:03 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id y6si28097108qcg.14.2015.02.03.05.45.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:45:03 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIdmk-0006ed-Qc; Tue, 03 Feb 2015 13:44:58 +0000 Received: from mail-qc0-f170.google.com ([209.85.216.170]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIdmf-0006eR-D9 for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 13:44:53 +0000 Received: by mail-qc0-f170.google.com with SMTP id p6so35234554qcv.1 for ; Tue, 03 Feb 2015 05:44:48 -0800 (PST) X-Received: by 10.224.112.9 with SMTP id u9mr41179607qap.38.1422971088188; Tue, 03 Feb 2015 05:44:48 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id k64sm15595617qge.37.2015.02.03.05.44.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:44:47 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 15:44:21 +0200 Message-Id: <1422971062-32528-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 X-Topics: patch Subject: [lng-odp] [PATCH 1/2] api: random: Added random.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Added random number API. The only API call is moved and renamed from crypto.h. Signed-off-by: Petri Savolainen --- 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 #include #include +#include #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 + +#ifdef __cplusplus +} +#endif + +#endif