Received: by 10.223.176.5 with SMTP id f5csp640335wra; Wed, 7 Feb 2018 05:13:33 -0800 (PST) X-Google-Smtp-Source: AH8x225DyRb8VT/MTMX/X5N5cV+HuTxT94y+uhDH9fHZ0pyN70dynWvvGx0Ja8uQASLQj4ElaVqB X-Received: by 10.101.68.138 with SMTP id l10mr4966466pgq.119.1518009212970; Wed, 07 Feb 2018 05:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518009212; cv=none; d=google.com; s=arc-20160816; b=RvMUyvjmUv+i6qNTNMN+MQeWlIsdQSaWHpt7scvEz1XSOzFCAf7ctAC3VxlNAhxqnX hP0D9exYKNDo7VKudrt+PloOGr8hU5rK4GYh2iZUR9S2Q3/8ThJMQgiDFnX7kugiOqeV eo6Nf86MrnGCZpnb0cY8ugApP+0K2E05FheDNm2P9HNkfzg/sEbhpudPvTAWO+4SdnzM ZnOFCjGcsXOxodPYkKjK7COmjK/Se9m/wdGfGxdesTGeV4sRJFvroOTZ8M+LN9ZvxeYo 5rhId+Y0RVgQJJ4fRQqNiBU5/cw5F5S32vXmrhSy8I4aEfmffR0SEWwiRLNwbsnXZFJc 7VGQ== 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:dkim-signature:arc-authentication-results; bh=r6bwHX6iZt/QestfLxllWyjk1reK9+iEd29VHVDiEMY=; b=KbnHBldnHspbK0S3EZnLxpDzolQnNqE+qFHIHtd81ESJolvZPu6dUcOcZYqke2GTG6 UnZjDoIMVtl27GnONl7cC16bKuIbiRDdYHmAA6cHlpifazqwH6wI1SRJevDLQykCbyle iUWHl26XtJaqxbcd23cIcEzTLjgeTixMOndFouLjktLzRyFSNLGJO8dB602uNWKTlkMc DFLULCsoWBV0uRZh6DT6br66sGr9sW07VnWltBh2xKVnpioc+DZhgvMvHQk7jH5LkMwo D0HWv022sGHVssSWN3yq2MNLoyKAV2apXL3Lt1DYOHkD5Tfn3gthSWnKCHHZVHRQu6rz fg7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Hg0Icmt5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si1058966pls.587.2018.02.07.05.13.18; Wed, 07 Feb 2018 05:13:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Hg0Icmt5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754059AbeBGNMT (ORCPT + 99 others); Wed, 7 Feb 2018 08:12:19 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:44056 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753497AbeBGNMS (ORCPT ); Wed, 7 Feb 2018 08:12:18 -0500 Received: by mail-wr0-f195.google.com with SMTP id v31so956681wrc.11; Wed, 07 Feb 2018 05:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=r6bwHX6iZt/QestfLxllWyjk1reK9+iEd29VHVDiEMY=; b=Hg0Icmt5U8vB13BHj9SR7njYMLm+rXihjBUBM0wou3x1CaCLq/uWaXn9BizMLStlsO c7OwHcwD79WBTg01hpj9JjdKsceCAUeQ+lI0GYWT0dUC/hQL7aUYbFNrf9uBLCTKmEq4 qcvvtRCb6+YLUDvk2a7V2tNK7Cl/ce5RSGciPgij0kv2nEQ7L9L79GKymKrtFrvZ7Lp3 EATizduKe8skSkHA61bCD3+ZyXoaNRl1ZVyl8eITk4qu/rDwbNX43AtaXbF5X31Y0jPS INoXlmtPZ6Gyvy0L0+Q2C1zt7CFV2T8+sA4lhQxqUTbiobFDk3TRlXgAcUNZwsZohZVN KXrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=r6bwHX6iZt/QestfLxllWyjk1reK9+iEd29VHVDiEMY=; b=VtVCE5VeZRI1GNrck+LzosvaiNKmQKVdsLzTQj22KLtgxa/DPZtHNfx7AdWhzRI/1j B+XzSVCT/yYmdjuF+gHsCncgdy5aW1wn+J4fDhIHMZzzXQ7+RvADtOE8fOkylH+876Re THPRuTLQzE2hjEbqwYkK8xhqBiP0bTlJwv8wmbGffikTjM+oqejJWJyf4BYReN1xgA17 nRD1TyxwsycAs/17QF13nLn2IS9t00TCvl/WWn3S65mCIwAQNBnih1kr9nY9XNc+3CaK MOa9ZhryhodE1KaAJ+nQPxOIeP2ZnjZ0WFtgBFB9dKGichCUUa8FY9JKS+c3+7ucVDZn 8NnA== X-Gm-Message-State: APf1xPB6BcQF5Hwjb3FgPHbnKF01wdhCzlBdCgyO8KsSeQTeTrc/nMjC qS0y+okud1p1CMVXaG7fwNO4WLPG X-Received: by 10.223.130.234 with SMTP id 97mr5587958wrc.144.1518009136664; Wed, 07 Feb 2018 05:12:16 -0800 (PST) Received: from Red (LFbn-MAR-1-494-174.w2-15.abo.wanadoo.fr. [2.15.82.174]) by smtp.googlemail.com with ESMTPSA id 1sm3126841wru.19.2018.02.07.05.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Feb 2018 05:12:16 -0800 (PST) Date: Wed, 7 Feb 2018 14:12:14 +0100 From: Corentin Labbe To: Artem Savkov 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: <20180207131214.GC19249@Red> References: <20180206212022.1309-1-artem.savkov@gmail.com> <20180206212022.1309-2-artem.savkov@gmail.com> <20180207095659.GA19249@Red> <20180207105201.pnn2s57wdk5zuda2@shodan.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180207105201.pnn2s57wdk5zuda2@shodan.usersys.redhat.com> User-Agent: Mutt/1.7.2 (2016-11-26) 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 11:52:01AM +0100, Artem Savkov wrote: > 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. crypto_rng_get_bytes() use crypto_rng_generate() which work on crypto_rng > > > 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. > Perhaps the example is wrong because "copied from/inspirated by" hwrng API which have this behavior. After checking, other crypto_rng driver, you are probably right, so you can add: Acked-by: Corentin Labbe Thanks Regards