Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp439770imm; Tue, 3 Jul 2018 23:12:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdfFVrvrFhhoRkI77a6Stp+Q9bSJIOvqrYpxWc4sd2fl/VrUgYKTkhcW5Ip3+WzIlFcUb6/ X-Received: by 2002:a62:11c4:: with SMTP id 65-v6mr809161pfr.54.1530684774275; Tue, 03 Jul 2018 23:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530684774; cv=none; d=google.com; s=arc-20160816; b=LAhV1t74avp/kbCfLOuA/UYjmWviO3k6N0G6p0HfuncItgnwHDys8kWp51Bj2ZfxuM pnLi5/IcjrZ4SNNrhjHbciEwZO3XCRlLWk8vVsuPJ8dbKNBsvg7FWyDHR+MM2CT2vEmx 7b83NdhiWTylDt1VBoo/bj/xzq8YpzstRbxgIm43Go6XJAJ8yg1k9ZfoM9NFpPIOyUNe 7zLFvprv12CpvFN0ehn8MQpfzE2RjXze9R5bIsynuimUtHCjvwZ9E0dcoTJSu6Zh88xn IMtB2dIVLkGbM0+9BSCRIyqGvlL5bj9CuVlMGkRHqVw1wzba8qOIEulrITJHrijTM+Lb 2buA== 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=0+rbAmZqLiXvDa3kV+Wtdbe9UGkxybGXqg0/js5CwWM=; b=0CvQX1MSGWd6iiDRue9BOgdh/U7yYrrFaTfdtutDz+Ylzdt5ClopHBWJPIRFP9OHxs wUhrH4aH3hyXkEU/rrcJHZ07An+ujZri3LIUyFwT8uK3ltahOPHCIBE+Nx2Lc/sK+xK5 oCHW4g28c/ropu42ZJHY4uTRbT2Hhl53NVsmz08FF7YiPI9bl35EBVXvWdGWGosQEiu3 fkuEe06lxIPWAd1w20auI4EeRyM2s/LlAGyyMG3LAnTAmP2FrrwjtnB7HfwCKxOYQ69u 56JvrquTdLJdTWJCklWX0tbFpMoGpCBAlRL6ByYl43kpCUAso+RRZbUbxJAcxe0edF/X 9c+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vrkt+ZVW; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d132-v6si2546868pga.355.2018.07.03.23.12.39; Tue, 03 Jul 2018 23:12:54 -0700 (PDT) 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=@kernel.org header.s=default header.b=Vrkt+ZVW; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933059AbeGDGKq (ORCPT + 99 others); Wed, 4 Jul 2018 02:10:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:55844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932586AbeGDGKo (ORCPT ); Wed, 4 Jul 2018 02:10:44 -0400 Received: from localhost (unknown [171.76.122.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20CD024687; Wed, 4 Jul 2018 06:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530684643; bh=6k0wGA0K2mOvi7kkjpgV590JAND5taF4A4cJwIK6wOA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vrkt+ZVWq2fz8jmweSCbE/x7ocSPA8EmEsokH0RaprGLke0rrY/PWMgr+FhPmSz2I Gi/GhVJgYKLz1oHmxNu8dr7geQ8pOB+OZ1dmVJSWeUJnlLNlfN0PXas452ALqEc/is /xy0WZ+eHufZHVTneoeLvr92zmS6am/Jy7ecz3SE= Date: Wed, 4 Jul 2018 11:40:35 +0530 From: Vinod To: Stephan Mueller Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Stephen Boyd , Timur Tabi Subject: Re: [PATCH v3 3/6] crypto: Add Qcom prng driver Message-ID: <20180704061035.GY22377@vkoul-mobl> References: <20180703060434.19293-1-vkoul@kernel.org> <20180703060434.19293-4-vkoul@kernel.org> <2990655.vKmMgW600W@tauon.chronox.de> <20180704041059.GT22377@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180704041059.GT22377@vkoul-mobl> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04-07-18, 09:40, Vinod wrote: > Hi Stephan, > > On 03-07-18, 15:28, Stephan Mueller wrote: > > Am Dienstag, 3. Juli 2018, 08:04:31 CEST schrieb Vinod Koul: > > > +static int qcom_rng_read(struct qcom_rng *rng, void *data, size_t max) > > > +{ > > > + size_t currsize = 0; > > > + u32 *retdata = data; > > > > How can you be sure that this cast is appropriate? I.e. how is it guaranteed > > that data is 4-byte aligned? > > While reading we check the alignment: > > /* make sure we stay on 32bit boundary */ > if ((max - currsize) < WORD_SZ) > break; > > > Also, the data variable in qcom_rng_generate is a u8 -- shouldn't this type be > > used instead of a void? > > That does make sense to me. IIRC the read is for a byte. I will check > this and update it Okay so I rechecked this, the hardware gives 32 bits of random data. I am thinking of splitting the word and updating by each byte. That way trailing zero can also be avoided which is the case now -- ~Vinod