From patchwork Tue Oct 25 12:49:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 79171 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp3094274qge; Tue, 25 Oct 2016 05:50:28 -0700 (PDT) X-Received: by 10.55.12.210 with SMTP id 201mr18546218qkm.292.1477399827997; Tue, 25 Oct 2016 05:50:27 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 6si13406084qkl.267.2016.10.25.05.50.27; Tue, 25 Oct 2016 05:50:27 -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 7E2BB60A1E; Tue, 25 Oct 2016 12:50:27 +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_DNSWL_NONE, 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 B1CB960E8F; Tue, 25 Oct 2016 12:49:19 +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 62B85609FA; Tue, 25 Oct 2016 12:49:12 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.linaro.org (Postfix) with ESMTPS id 410E760A1E for ; Tue, 25 Oct 2016 12:49:09 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id t73so96438913oie.1 for ; Tue, 25 Oct 2016 05:49:09 -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=NQlkUaxvgaKUxWsY9T8+5ZNY8H0KY2b4WoEOMvsGKzw=; b=IqXu8NSc4LOhtr7/3qPIXMQsQcpNUyy1HCkN3zpRHDVI2AwxgQpG1H5cjBxiXEqeAA GCUJyTX7KGBBuVz7zbYxP5J7+e3ydFPsgdg6ohwdpYtWjS9GepBqJu51yznm9jMWJnHG lDQniCD2XQaNd1COStohp7a/9KxUN2dzpanJLb3yh7T5R3blmPr2XAC8nkoky4+LRu4d vKKK8trSB3rezDShjGj94Ly/k4D0eAV5r8btAv8WMC6hAaA72CM8KmZ9ORaDVatGP5UG CSuez1vck7u1zL4ydu1DXzfsRo8z4rj5ObMc6cY4tdvOTao2uEndXPJyNQccvWfICyty NcVg== X-Gm-Message-State: AA6/9RnowQiQegct8ICurdBnMkKob+E+81t6sv9fGqNf/ke+qoQUfSDKVuAMKBCkWY556VABTKI= X-Received: by 10.202.87.16 with SMTP id l16mr24501441oib.126.1477399748756; Tue, 25 Oct 2016 05:49:08 -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 g17sm6296544otd.38.2016.10.25.05.49.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Oct 2016 05:49:08 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 25 Oct 2016 07:49:03 -0500 Message-Id: <1477399744-16516-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477399744-16516-1-git-send-email-bill.fischofer@linaro.org> References: <1477399744-16516-1-git-send-email-bill.fischofer@linaro.org> X-Topics: crypto patch Subject: [lng-odp] [API-NEXT PATCH 3/4] linux-generic: crypto: implement crypto capabilities and entropy 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 entropy related values to odp_crypto_capability() and implement the use_entropy field of odp_random_data() Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_crypto.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index c7431e6..9011bc0 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -618,6 +618,9 @@ int odp_crypto_capability(odp_crypto_capability_t *capa) capa->max_sessions = MAX_SESSIONS; + capa->entropy_available = 0; + capa->entropy_size = 0; + return 0; } @@ -872,9 +875,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_bool_t use_entropy) { int32_t rc; + + if (use_entropy) + return -1; + rc = RAND_bytes(buf, len); return (1 == rc) ? len /*success*/: -1 /*failure*/; }