Received: by 10.223.176.5 with SMTP id f5csp499818wra; Wed, 7 Feb 2018 02:53:12 -0800 (PST) X-Google-Smtp-Source: AH8x225Zs7UhDobgx9G7ogfPKQ1KTImVHxd5flXJoUC9F0BoaXvGXq0eXWqYDNw5eqzOt8a4JRpR X-Received: by 2002:a17:902:710d:: with SMTP id a13-v6mr5625876pll.85.1518000792002; Wed, 07 Feb 2018 02:53:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518000791; cv=none; d=google.com; s=arc-20160816; b=h7gFf4HFIJgFAb0sP9iCGNuNHdA/wTnBqVvm9g6adC6LA3YIkMFWJ2f28Al9qybI9k ofwL3jates3x95EtI0I2xVO9lHUI6gtWib4B0O8ZAr86pop9kLUUaPQIyYOXVYq85nky gk5PJ36F2Eogfw4+auQ2mutRxkW1brwzjj9Sko5X7/u7un73kllG3PLv2myosFzRvdaW nR4oPiqbct2k3XWZTvho1hebhfeIkeBlo0qq7tZMVRRLV6ECPz6sezBLN1lOkEI9wmqZ nbmgS+HS0BUTbozRF7zdeWOno+LWRI5dJaxj+nuiZN9XLo8m3vYFT92wwlAonKm7oBxp be2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=uMVrq2FJ9hEryOGtLoNl4+CkeTwDMmHmv+VwjA/HHbw=; b=oQvnrx6V0Jz9GwEAc2adiI3Qb5ehnRy4jqiOST0acvgZx6mkvvKaQQyJDTLi0uZtBs owSUJ++fDCVF7RNvudScKp7HIsPAgpf1ZdwHCVxJLcljKhZyD6eJudBoRrslxHebRPHl LbFvFWqHF0Va4ajgAHecl1zxhyEBPt8WeP+HVQJBHnbl3zWEFjq/POv59VF5SpCDuHzy 52lBtp9r4YIcI0yROAjzaKOpvzxCNM7v8tiiNMSQdGXY9c2QX5IcNHSR7OfymGJT324g 3vB2vF+/HAtKX+uOkgj6rkIC2ZhTt7MkaspYOe+5aVNmaKv4AizdWvQhOz4XHLR8hwXa wSkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3-v6si926001plp.625.2018.02.07.02.52.58; Wed, 07 Feb 2018 02:53:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753901AbeBGKwH (ORCPT + 99 others); Wed, 7 Feb 2018 05:52:07 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33132 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753852AbeBGKwF (ORCPT ); Wed, 7 Feb 2018 05:52:05 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 840F97C6BB; Wed, 7 Feb 2018 10:52:04 +0000 (UTC) Received: from shodan.usersys.redhat.com (unknown [10.43.17.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CEC72024CA2; Wed, 7 Feb 2018 10:52:01 +0000 (UTC) Received: by shodan.usersys.redhat.com (Postfix, from userid 1000) id 8F59B2C07A5; Wed, 7 Feb 2018 11:52:01 +0100 (CET) Date: Wed, 7 Feb 2018 11:52:01 +0100 From: Artem Savkov To: Corentin Labbe Cc: Artem Savkov , herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] sun4i_ss_prng: fix return value of sun4i_ss_prng_generate Message-ID: <20180207105201.pnn2s57wdk5zuda2@shodan.usersys.redhat.com> References: <20180206212022.1309-1-artem.savkov@gmail.com> <20180206212022.1309-2-artem.savkov@gmail.com> <20180207095659.GA19249@Red> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180207095659.GA19249@Red> User-Agent: NeoMutt/20161126 (1.7.1) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 07 Feb 2018 10:52:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 07 Feb 2018 10:52:04 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'asavkov@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 10:56:59AM +0100, Corentin Labbe wrote: > On Tue, Feb 06, 2018 at 10:20:21PM +0100, Artem Savkov wrote: > > According to crypto/rng.h generate function should return 0 on success > > and < 0 on error. > > > > Fixes: b8ae5c7387ad ("crypto: sun4i-ss - support the Security System PRNG") > > Signed-off-by: Artem Savkov > > --- > > drivers/crypto/sunxi-ss/sun4i-ss-prng.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-prng.c b/drivers/crypto/sunxi-ss/sun4i-ss-prng.c > > index 0d01d1624252..5754e0b92fb0 100644 > > --- a/drivers/crypto/sunxi-ss/sun4i-ss-prng.c > > +++ b/drivers/crypto/sunxi-ss/sun4i-ss-prng.c > > @@ -52,5 +52,5 @@ int sun4i_ss_prng_generate(struct crypto_rng *tfm, const u8 *src, > > > > writel(0, ss->base + SS_CTL); > > spin_unlock(&ss->slock); > > - return dlen; > > + return 0; > > } > > -- > > 2.15.1 > > > > According to Documentation/crypto/api-samples.rst ("Code Example For Random Number Generator Usage") > you must return the length of data generated. I don't think that example is the same as rng_alg.generate, it has a different protottype. > So crypto_rng_generate/crypto_rng_get_bytes documentation in crypto/rng.h must be fixed. It's not just documentation, every other rng driver returns it this way and it gets aead_init_geniv() (and subsequently crypto_create_tfm()) really confused because they expect the return value to be 0 or < 0. > Herbert could you confirm ? -- Regards, Artem