From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: * X-Spam-Status: No, score=1.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,FSL_HELO_FAKE,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69D8FC4360F for ; Thu, 4 Apr 2019 17:13:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 380C5206BA for ; Thu, 4 Apr 2019 17:13:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s5kDi9rP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="l15YJtid" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 380C5206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JEnkatQ3AUkgewcjZGshlRb5jkQPdrbvLhDkbG5GVow=; b=s5kDi9rPKHRXqc g66g9Vk4N4B3pfoMnMJfdG3Tic6TRsZDg1d9uFQOHwDxpKtZetRn2KXYe8N4x8c226KUdhVdpgoOV oyuvEQZzbQiaj/ZKcBWEfaNbksUgpsQ2qaLI+1dzAgC013+di/tv5m0wioxYc+vZVHWGNQVu2aqGO TpRBrJSLVafgRu8kSIsmoDwFkb0tj1bHClBUSTIQFx2ttZ7QkGoj2uppA4or2ciQxcOX2leUniUzH ZsZBkQC2jFP0DNI0bk3jD+d35dz6gds5n1tEBbZ74jxuqm1M8C+y9/Imem709+fAveJWNk38iShZE q53py/YgEiO7v9gRVPJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC5v1-0004qc-UT; Thu, 04 Apr 2019 17:12:51 +0000 Received: from [198.145.29.99] (helo=mail.kernel.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC5ug-0004op-KT; Thu, 04 Apr 2019 17:12:40 +0000 Received: from gmail.com (unknown [104.132.1.77]) (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 E987D206BA; Thu, 4 Apr 2019 17:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554397927; bh=aXS/er4HBQNFf3E7MTT4ZdaWtvRrMiEkXol7ICiOn0M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l15YJtid7VbR0t6Rh/c0DNOrL0+xMvIlmSbUVaq04pDH2MbSqqKjostr+5rLzpT9V Xb6xJNGxIqEq6dwaEbRGegiE5uS2T7B6OpSejTjkcPr1KYOV0K5Gc34mlCW6fZeJ5I SJqDvJnWhioUPm7LBWZBeLcAzlfwsgUT6hvHjnJc= Date: Thu, 4 Apr 2019 10:12:05 -0700 From: Eric Biggers To: Herbert Xu Subject: Re: [Bug] Rockchip crypto driver sometimes produces wrong ciphertext Message-ID: <20190404171204.GA121392@gmail.com> References: <20190126210530.GB709@sol.localdomain> <1894799.pWIprST79S@phil> <20190315033140.GB1671@sol.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_101230_707418_C5458AB6 X-CRM114-Status: GOOD ( 17.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tao Huang , Zain Wang , Heiko Stuebner , Arnd Bergmann , Ard Biesheuvel , Pascal Van Leeuwen , Zhang Zhijie , "linux-rockchip@lists.infradead.org" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Olof Johansson , "ezequiel@collabora.com" , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 04, 2019 at 01:41:50PM +0000, Pascal Van Leeuwen wrote: > > The issue is that the self-tests now verify that CBC implementations update the > > IV buffer to contain the next IV, aka the last ciphertext block. But the Rockchip > > crypto driver doesn't do that, so it needs to be fixed. > > > > This has always been a requirement for CBC implementations so that users can > > chain CBC requests. Unfortunately it was just never tested for... > > > This did not immediately trigger me when it came flying past a couple of weeks > ago, but I ran into the same issue today with the inside_secure driver I'm playing > with: it does NOT return correct IV outputs for CBC modes. > > However ... I'd like to question that very requirement ... if I may :-) > > My reasoning is that this IV output *is* available as the last block of either the > output (for encrypt) or input (for decrypt) datastream. So requiring it to be > updated in the IV buffer as well seems redundant to me. It burdens the driver > with an extra data copy operation, while in the majority of practicle use cases > you would not even *need* this output IV. (chaining IV's would not work on > a hardware accelerator anyway, because you would need to serialize the > datastream, meaning you run at the speed of the round-trip latency instead > of the throughput, which is typically one to two orders of a magnitude slower) > > And in the odd case you do need it, you can just grab it from the data buffer > yourself. > > Pascal van Leeuwen > Silicon IP Architect, Multi-Protocol Engines > Herbert, can you explain what users actually rely on the next IV being returned? I don't know all the historical context behind this. - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel