From patchwork Tue Feb 3 13:44:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44228 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8462321513 for ; Tue, 3 Feb 2015 13:45:08 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf20738115wgh.3 for ; Tue, 03 Feb 2015 05:45:07 -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:in-reply-to :references: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=vFg7jEMBBSrxehugkerFv8uPMtjCzn55D9Jm18JCg90=; b=ZIyqz1/Rifw5WRQ58O1AaLh0anl6+a/B2LXh9PsTUoV1E3OWgOFzEYiKHeRUT7HNK4 nn5KY283cUclbI6+DSH44jrrSjZ52ZZTLgp6DpHc4VJEKGhW0HLgAFNXD8xx0ZRrmE/D Ly89QSBgs/biukQGhwgS+0CeRRaKBlYhL5tHHF3oMjxS9eIKtq/bhHMuYQrgDrjCSPqM WsmKaYtrBL80MpWMXXVj6TT1bk0DzgRVTLCwqSZ7HlXTXfYSFjrwkASIVVzgDBbMKdQt Dirbt7/N1v3GGxFn9+znuxsdZtAIHWCbpoVkTLw0UPefgMnslzRPmh5EtC5s0xTzV1tB YWdQ== X-Gm-Message-State: ALoCoQmFXyclzR+ImsgqU74ZUvSz4Y0ES3VhBi2UcQKqBILPpQcC4PfDLgl4nJtk2/oalodQ8Mxi X-Received: by 10.180.105.129 with SMTP id gm1mr1953372wib.3.1422971107842; Tue, 03 Feb 2015 05:45:07 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.165 with SMTP id m5ls448579lag.104.gmail; Tue, 03 Feb 2015 05:45:07 -0800 (PST) X-Received: by 10.112.122.52 with SMTP id lp20mr17794235lbb.98.1422971107593; Tue, 03 Feb 2015 05:45:07 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id wn10si19168636lac.76.2015.02.03.05.45.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:45:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id ms9so51737056lab.1 for ; Tue, 03 Feb 2015 05:45:07 -0800 (PST) X-Received: by 10.152.36.162 with SMTP id r2mr11320080laj.9.1422971107501; Tue, 03 Feb 2015 05:45:07 -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 h5csp1946112lbj; Tue, 3 Feb 2015 05:45:06 -0800 (PST) X-Received: by 10.224.72.8 with SMTP id k8mr53964987qaj.26.1422971106169; Tue, 03 Feb 2015 05:45:06 -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 96si28812931qgh.88.2015.02.03.05.45.04 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:45:06 -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 1YIdmp-0006fR-3x; Tue, 03 Feb 2015 13:45:03 +0000 Received: from mail-qg0-f45.google.com ([209.85.192.45]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIdmh-0006eS-IA for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 13:44:55 +0000 Received: by mail-qg0-f45.google.com with SMTP id q107so52274147qgd.4 for ; Tue, 03 Feb 2015 05:44:50 -0800 (PST) X-Received: by 10.140.109.99 with SMTP id k90mr4984758qgf.35.1422971090369; Tue, 03 Feb 2015 05:44:50 -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.48 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 05:44:49 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 15:44:22 +0200 Message-Id: <1422971062-32528-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422971062-32528-1-git-send-email-petri.savolainen@linaro.org> References: <1422971062-32528-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/2] api: random: Renamed odp_hw_random_get 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.42 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 Renamed odp_hw_random_get() to odp_random_data(). Random number API is now separated from crypto API. Signed-off-by: Petri Savolainen --- example/ipsec/odp_ipsec_cache.c | 2 +- include/odp/api/crypto.h | 14 -------------- platform/linux-generic/odp_crypto.c | 3 ++- test/validation/crypto/odp_crypto_test_rng.c | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index 904e7b6..5e128c5 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -98,7 +98,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, if (params.iv.length) { size_t size = params.iv.length; - odp_hw_random_get(params.iv.data, &size, 1); + odp_random_data(params.iv.data, &size, 1); } /* Synchronous session create for now */ diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h index 545c1a5..aad6bd9 100644 --- a/include/odp/api/crypto.h +++ b/include/odp/api/crypto.h @@ -330,20 +330,6 @@ odp_crypto_compl_result(odp_crypto_compl_t completion_event, odp_crypto_op_result_t *result); /** - * 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_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy); - -/** * @} */ diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 46766fa..de60157 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -447,7 +448,7 @@ odp_crypto_init_global(void) } int -odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED) +odp_random_data(uint8_t *buf, size_t *len, odp_bool_t use_entropy ODP_UNUSED) { int rc; rc = RAND_bytes(buf, *len); diff --git a/test/validation/crypto/odp_crypto_test_rng.c b/test/validation/crypto/odp_crypto_test_rng.c index 458f908..b6313f0 100644 --- a/test/validation/crypto/odp_crypto_test_rng.c +++ b/test/validation/crypto/odp_crypto_test_rng.c @@ -19,7 +19,7 @@ static void rng_get_size(void) size_t len = TDES_CBC_IV_LEN; uint8_t buf[TDES_CBC_IV_LEN]; - ret = odp_hw_random_get(buf, &len, false); + ret = odp_random_data(buf, &len, false); CU_ASSERT(!ret); CU_ASSERT(len == TDES_CBC_IV_LEN); }