From patchwork Wed Oct 26 16:39:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 79457 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp159666qge; Wed, 26 Oct 2016 09:40:02 -0700 (PDT) X-Received: by 10.36.239.196 with SMTP id i187mr7280398ith.11.1477500001921; Wed, 26 Oct 2016 09:40:01 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 30si3268208ioh.151.2016.10.26.09.40.01; Wed, 26 Oct 2016 09:40:01 -0700 (PDT) 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 641D56184F; Wed, 26 Oct 2016 16:40:01 +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=-1.9 required=5.0 tests=BAYES_00, 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 3DA0C617EB; Wed, 26 Oct 2016 16:39:35 +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 D48DA617E7; Wed, 26 Oct 2016 16:39:31 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by lists.linaro.org (Postfix) with ESMTPS id 2185760CAD for ; Wed, 26 Oct 2016 16:39:31 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id i127so99903027oia.2 for ; Wed, 26 Oct 2016 09:39:31 -0700 (PDT) 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=ktRVaFW31UfZ8sqVFObnwoVPZ6+4r0zh+6QWN+5urlA=; b=NLDpBtVkEuYBo5AUctzR1ucpw1Xx8LfHudahKx8JxF/HLujFY8kMxDxeaiIGhoqOOg m8p813kBCSQF+eXeK/j1mPw4oABCXVzO0ltwRDgDPnhX9IjhdG78F1OayKLC0BHN8Dm/ WEpeCK8GhuW7Uw+ON4Dzptw3/4LexZCQY63CPALhM8OxFfpQbfAemOUEDPi6IrXnvC5i vqaUtqFsBia6auQ/tRGyRwA01vQQ7wtjBOo/SjMzMIBbJP2je6sFYZJ4kOrsLb9RZOxK tCSDvXtty1FEeY1W2tqVvUPUxXMGe6GfklRZSzQatquqqt51Dysne4Uz+FhNRCtCeAVq u2ig== X-Gm-Message-State: ABUngvfXJbn8pThoqmK51Q39xQ/+SftbgLuLkqPq4UWoVnbAg2S89nxIXRuZj5W4voHZDkw/d5M= X-Received: by 10.202.44.19 with SMTP id s19mr2214952ois.112.1477499970480; Wed, 26 Oct 2016 09:39:30 -0700 (PDT) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id f68sm844369otb.36.2016.10.26.09.39.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Oct 2016 09:39:30 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 26 Oct 2016 11:39:25 -0500 Message-Id: <1477499966-30632-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477499966-30632-1-git-send-email-bill.fischofer@linaro.org> References: <1477499966-30632-1-git-send-email-bill.fischofer@linaro.org> X-Topics: crypto patch Subject: [lng-odp] [API-NEXT PATCHv3 3/4] linux-generic: crypto: implement crypto capabilities and random kind 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 random kind related values to odp_crypto_capability() and implement this selector field in odp_random_data(). Since odp-linux uses the OpenSSL RAND_bytes() API, the highest kind of random data supported by this implementation is ODP_RANDOM_CRYPTO. Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_crypto.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index c7431e6..fdd65b3 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -618,6 +618,8 @@ int odp_crypto_capability(odp_crypto_capability_t *capa) capa->max_sessions = MAX_SESSIONS; + capa->max_random_kind = ODP_RANDOM_CRYPTO; + return 0; } @@ -872,9 +874,13 @@ int odp_crypto_term_global(void) } int32_t -odp_random_data(uint8_t *buf, int32_t len, odp_bool_t use_entropy ODP_UNUSED) +odp_random_data(uint8_t *buf, int32_t len, odp_random_kind_t kind) { int32_t rc; + + if (kind > ODP_RANDOM_CRYPTO) + return -1; + rc = RAND_bytes(buf, len); return (1 == rc) ? len /*success*/: -1 /*failure*/; }