From patchwork Tue Oct 25 22:03:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 79288 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp99367qge; Tue, 25 Oct 2016 15:04:16 -0700 (PDT) X-Received: by 10.237.53.42 with SMTP id a39mr22246742qte.4.1477433056535; Tue, 25 Oct 2016 15:04:16 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q125si14681629qkb.93.2016.10.25.15.04.15; Tue, 25 Oct 2016 15:04:16 -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 23AB760950; Tue, 25 Oct 2016 22:04:15 +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_H2 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 DCB5B60E5B; Tue, 25 Oct 2016 22:03:23 +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 CE8D0607CD; Tue, 25 Oct 2016 22:03:18 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by lists.linaro.org (Postfix) with ESMTPS id 96918607D9 for ; Tue, 25 Oct 2016 22:03:16 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id m72so120947845oik.3 for ; Tue, 25 Oct 2016 15:03:16 -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=eU6vbfU0JFae51kOsmaHHO+ntqkByAAs3sfivAtJ/8w=; b=Sa4js221zW3O96ukbVSVQPgcP5nYfWtIzWJGsv/P3tGgn43MrnIfcJ/1Z5WLR7Y3x1 l/cjolnpQ0wMYeO7BkOLPIp3OJWYG++QAuaHgP2HUnWrJ+M7YRYEmIJSNTOWryiBZyer XuA+4ZmzL3xTV9ROu/VvKOFv/NenW5uUVLDEu0kBIrXWa/wAMenDCFd8S0o5Ni0zx7bv C7XvvRmOFmGBQTMzaL4BDazACt+9mZdtPuf+y7bpaVvrm7of8NtJWQl9VeEqLr9ZxSEA F9SrTSwHkR9q1xPUEYG9KP6/hkdLCRV0BLbhGLQPLh0EUgSulkSLLXnsEulfNrGrmcV6 /5vg== X-Gm-Message-State: ABUngvfwVM6aHyAjCuoHx1P4JimMolX38qvEIMNXWCADO+ubeLWToyEVxOxD/yNkoJBdbObI/r8= X-Received: by 10.157.29.204 with SMTP id w12mr6795112otw.80.1477432995515; Tue, 25 Oct 2016 15:03:15 -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 s23sm7363519ots.1.2016.10.25.15.03.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Oct 2016 15:03:15 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 25 Oct 2016 17:03:11 -0500 Message-Id: <1477432992-21770-3-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477432992-21770-1-git-send-email-bill.fischofer@linaro.org> References: <1477432992-21770-1-git-send-email-bill.fischofer@linaro.org> X-Topics: crypto patch Subject: [lng-odp] [API-NEXT PATCHv2 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_RAND_CRYPTO. 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..f7e380e 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->max_kind = ODP_RAND_CRYPTO; + capa->max_kind_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_rand_kind_t kind) { int32_t rc; + + if (kind > ODP_RAND_CRYPTO) + return -1; + rc = RAND_bytes(buf, len); return (1 == rc) ? len /*success*/: -1 /*failure*/; }