From patchwork Wed Feb 25 12:58:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 45049 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB8C920502 for ; Wed, 25 Feb 2015 12:59:06 +0000 (UTC) Received: by wghk14 with SMTP id k14sf2755981wgh.0 for ; Wed, 25 Feb 2015 04:59:06 -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: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=TT77cbLXS5Ih1U2oHfPmqEtt6DeFeIi5YqQWP1pJ+KI=; b=ZADTm/AJJ130UPOv/SQ9SkcbyGM9c/w6xb5L1GMbkS7WRtjeQoaULwG7kpddjAdtJ3 ykAA9HNAmTembo6OcWy6tH/wIrUDB3jyJvR+8a7M9Z98FTlK548n8YDOUGj4uyMsdfuF X3qsrwTJ+2OhTRTieU66cXMfZ4Gseh7g5j/EllxHII95FyGuvvUGklviNSxdOHujTz8F ycE7lOzJEd+fUE6uM4rEZTSkv93dY1h4vrY2RwGokwx7WjFZskFdBMGih0FRJaKm+gIX ZQ0cu/nLPDtirxDVBj047UJYzEcqqyLX0f+CH/6M9kT1WzWXW50RVRmLVtMhlfvWE1Fb j6Hw== X-Gm-Message-State: ALoCoQk+nnpYwhz+x2n1m0bx/T5nDXyrOt2qx0tOBdClTFvnsGwe1juoz7ZsXB42RXryMz1F/xRt X-Received: by 10.152.88.40 with SMTP id bd8mr465131lab.0.1424869146188; Wed, 25 Feb 2015 04:59:06 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.131 with SMTP id k3ls796710lak.21.gmail; Wed, 25 Feb 2015 04:59:05 -0800 (PST) X-Received: by 10.112.154.234 with SMTP id vr10mr2552201lbb.115.1424869145946; Wed, 25 Feb 2015 04:59:05 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id jp19si30753857lab.96.2015.02.25.04.59.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 04:59:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labgf13 with SMTP id gf13so3686815lab.0 for ; Wed, 25 Feb 2015 04:59:05 -0800 (PST) X-Received: by 10.152.43.51 with SMTP id t19mr2570531lal.73.1424869145836; Wed, 25 Feb 2015 04:59:05 -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 h5csp2599819lbj; Wed, 25 Feb 2015 04:59:05 -0800 (PST) X-Received: by 10.140.231.75 with SMTP id b72mr6640313qhc.3.1424869144622; Wed, 25 Feb 2015 04:59:04 -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 140si403950qhh.61.2015.02.25.04.59.03 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 25 Feb 2015 04:59:04 -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 1YQbYL-00085r-Bt; Wed, 25 Feb 2015 12:59:01 +0000 Received: from mail-qg0-f50.google.com ([209.85.192.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQbYG-00085f-AB for lng-odp@lists.linaro.org; Wed, 25 Feb 2015 12:58:56 +0000 Received: by mail-qg0-f50.google.com with SMTP id e89so2677488qgf.9 for ; Wed, 25 Feb 2015 04:58:51 -0800 (PST) X-Received: by 10.140.86.199 with SMTP id p65mr6310263qgd.49.1424869131067; Wed, 25 Feb 2015 04:58:51 -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 o10sm21934164qag.9.2015.02.25.04.58.47 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Feb 2015 04:58:50 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 25 Feb 2015 14:58:26 +0200 Message-Id: <1424869109-930-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.3.0 X-Topics: patch Subject: [lng-odp] [PATCH 1/4] api: random: replace ssize_t with int32_t 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.52 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 ssize_t is a POSIX type. API definition must be pure C (C99). Signed 32 bits can hold larger values than size_t (64k) and ssize_t(32k) in minimum. Signed-off-by: Petri Savolainen --- example/ipsec/odp_ipsec_cache.c | 4 ++-- include/odp/api/random.h | 4 ++-- platform/linux-generic/odp_crypto.c | 6 +++--- test/validation/crypto/odp_crypto_test_rng.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index 5a41cec..12b960d 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -96,9 +96,9 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, /* Generate an IV */ if (params.iv.length) { - ssize_t size = params.iv.length; + int32_t size = params.iv.length; - ssize_t ret = odp_random_data(params.iv.data, size, 1); + int32_t ret = odp_random_data(params.iv.data, size, 1); if (ret != size) return -1; } diff --git a/include/odp/api/random.h b/include/odp/api/random.h index 293043e..3451b0d 100644 --- a/include/odp/api/random.h +++ b/include/odp/api/random.h @@ -35,8 +35,8 @@ extern "C" { * @return Number of bytes written * @retval <0 on failure */ -ssize_t -odp_random_data(uint8_t *buf, ssize_t size, odp_bool_t use_entropy); +int32_t +odp_random_data(uint8_t *buf, int32_t size, odp_bool_t use_entropy); /** * @} diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 2df37e7..61dba6e 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -458,10 +458,10 @@ int odp_crypto_term_global(void) return ret; } -ssize_t -odp_random_data(uint8_t *buf, ssize_t len, odp_bool_t use_entropy ODP_UNUSED) +int32_t +odp_random_data(uint8_t *buf, int32_t len, odp_bool_t use_entropy ODP_UNUSED) { - int rc; + int32_t rc; rc = RAND_bytes(buf, len); return (1 == rc) ? len /*success*/: -1 /*failure*/; } diff --git a/test/validation/crypto/odp_crypto_test_rng.c b/test/validation/crypto/odp_crypto_test_rng.c index a9e3db0..6a4ad17 100644 --- a/test/validation/crypto/odp_crypto_test_rng.c +++ b/test/validation/crypto/odp_crypto_test_rng.c @@ -15,7 +15,7 @@ #define RNG_GET_SIZE "RNG_GET_SIZE" static void rng_get_size(void) { - int ret; + int32_t ret; uint8_t buf[TDES_CBC_IV_LEN]; ret = odp_random_data(buf, sizeof(buf), false);