From patchwork Mon Dec 5 01:15:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 86472 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1258066qgi; Sun, 4 Dec 2016 17:16:25 -0800 (PST) X-Received: by 10.55.71.74 with SMTP id u71mr53693025qka.251.1480900585834; Sun, 04 Dec 2016 17:16:25 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w134si7845839qkb.1.2016.12.04.17.16.25; Sun, 04 Dec 2016 17:16:25 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7602863607; Mon, 5 Dec 2016 01:16:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5545E63609; Mon, 5 Dec 2016 01:15:50 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3D99963607; Mon, 5 Dec 2016 01:15:27 +0000 (UTC) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) by lists.linaro.org (Postfix) with ESMTPS id C3FBE635E2 for ; Mon, 5 Dec 2016 01:15:25 +0000 (UTC) Received: by mail-oi0-f41.google.com with SMTP id b126so323708313oia.2 for ; Sun, 04 Dec 2016 17:15:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a/gxsYJ7DJOXzyVo0eZQklhFD5vC3Cl2ES6RBdwiT90=; b=jk5B0E7wRK6rGeo3cFPjtrLq/nkpnwRj4UeGjAnr3ougy/HgMx3S7MxwO/X9EOwai/ pQGPVlgMKE3U0kQOX+CrXp+ApWIZZW5Ukcoruj93+0byXjaIIuDdwm3ywtTtkh260iL3 QPMZkuUR1kC7TQnowuM7GDrFoM2MN0d7RBoNrqZLV39L6BGyUE2VaoQeLtwxcMoycbBG lUui3WvthVlA8/9CjCwJQKFdD9wr/i+2O1lVK6I1l3zhhs+rfLNmWhs1fymX8/QQs7dx 9YQztKVjl4Xtb3P+uZZ4Xkvr3wszZKnvLCWd7v5bmsHRuAeKBAq9roNyr70ziZ1nEy3Y TzFA== X-Gm-Message-State: AKaTC00S+4TWUXvTOlWksK9uGR0OTnyH/JsgcPdI6lFidUrmMGgfo2069sP85yZYvBo//UbyrKg= X-Received: by 10.157.49.119 with SMTP id v52mr27278095otd.134.1480900525307; Sun, 04 Dec 2016 17:15:25 -0800 (PST) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id t43sm5378971otd.27.2016.12.04.17.15.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Dec 2016 17:15:24 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 4 Dec 2016 19:15:15 -0600 Message-Id: <1480900520-21989-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480900520-21989-1-git-send-email-bill.fischofer@linaro.org> References: <1480900520-21989-1-git-send-email-bill.fischofer@linaro.org> Subject: [lng-odp] [API-NEXT PATCHv5 2/7] api: random: add ability to generate repeatable random data X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Add the new API odp_random_seeded_data() to allow generation of repeatable deterministic random data from a user-specified seed value that is updated by each call. Sequences of calls using the same initial seed value will generate the same pseudo-random sequence. The caller may specify the kind of data that is to be generated however the only required kind that need be supported is ODP_RANDOM_BASIC. Attempts to generate repeatable ODP_RANDOM_TRUE are contradictory and should be failed. Signed-off-by: Bill Fischofer --- include/odp/api/spec/random.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.7.4 diff --git a/include/odp/api/spec/random.h b/include/odp/api/spec/random.h index e732c3a..83ef84c 100644 --- a/include/odp/api/spec/random.h +++ b/include/odp/api/spec/random.h @@ -59,6 +59,28 @@ typedef enum { int32_t odp_random_data(uint8_t *buf, uint32_t len, odp_random_kind_t kind); /** + * Generate repeatable random byte data + * + * For testing purposes it is often useful to generate "random" sequences + * that are repeatable. This is accomplished by supplying a seed value that + * is used for pseudo-random data generation. The caller provides + * + * @param[out] buf Output buffer + * @param len Length of output buffer in bytes + * @param kind Specifies the type of random data required. Request + * will fail if the implementation is unable to provide + * repeatable random of the requested type. This is + * always true for true random and may be true for + * cryptographic random. + * @param[in,out] seed Seed value to use + * + * @return Number of bytes written + * @retval <0 on failure + */ +int32_t odp_random_seeded_data(uint8_t *buf, uint32_t len, + odp_random_kind_t kind, uint32_t *seed); + +/** * @} */