Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3851227ybz; Tue, 28 Apr 2020 01:19:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLk8d+b90BzAZTER1Xj1qTQBVhWQmREVZ5dWyU66OfqMPlCkCOnLH6Z7WLNrCNTvQatV0iw X-Received: by 2002:a17:906:bcec:: with SMTP id op12mr23769447ejb.245.1588061999655; Tue, 28 Apr 2020 01:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588061999; cv=none; d=google.com; s=arc-20160816; b=kAHXqwJHIejY+SctXMcO3sF1Ip3gxviX5z7fTjY8pzIk/Jq+7VQ821v6nbOKfvieiJ L+8fJvgIp756QQG+wlrP6HRxZE405M35n4mahnEb9DzHurYvXXP1QEuFwv6KrIMYxt/9 zBNvcTBOezb6Bg/IuTaET8ELQdVlnbpwFmqQc+zkxXS58s8U0TblZi34K2luXqhMuqXW HFn/CAMdZL7Mj2I2go5Z7UhoLwVe5CNw17Zgag9uP/jSvc9tdI9DJXr2zrAKgmAb7P/r j5M27273vR3uP5omST5R7xrdD6X2lBYnNXtxYjyBZWNNH5Mw4QE8CmUgnKES67ZM5tP5 joQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=CHl1Pbsdg1/r45Y649PYOkS/IudPl+Yzo8txAX+Azgs=; b=s+ee9IzXXGDRwdtKQ6uIYJH3Ns97EyLCs4VIonrk7Wf0xvfJgyf95OUT+JTPs7Cuor OSCz9H1HbIX5EhwzLSBQbyubenbJ3UCOFI5i6/5z+XM17UkttO8gRU0LHMRQSDFwA1vb iY1WrPpmKosb7mbSSClbbHaZVFDAdn41rHm0tFMqi1qpGwJR7K2taj67Fng0sJ4YRaxv A/cLUpUmHw735fyEBDWT3AfpzsKRwVCTXjkUTBJc80BJWYUFSLVmWKaxZzgi5j5MkY55 cnpYU9XO24xnO6z+8RPtVVurKZ2MQ8K9tHYAFlJA7MU6PiyQMHOYQmUFBDh2AqzRBfWV 4d+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si1416470ejx.332.2020.04.28.01.19.27; Tue, 28 Apr 2020 01:19:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbgD1ITX convert rfc822-to-8bit (ORCPT + 99 others); Tue, 28 Apr 2020 04:19:23 -0400 Received: from mail1.atsec.com ([138.201.47.228]:8820 "EHLO mail1.atsec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbgD1ITX (ORCPT ); Tue, 28 Apr 2020 04:19:23 -0400 Received: from localhost (localhost [127.0.0.1]) by mail1.atsec.com (Postfix) with ESMTP id C2619D92; Tue, 28 Apr 2020 10:19:21 +0200 (CEST) Received: from mail1.atsec.com ([127.0.0.1]) by localhost (mail1.atsec.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id XRswVXkWLCf5; Tue, 28 Apr 2020 10:19:19 +0200 (CEST) From: Stephan Mueller To: Herbert Xu Cc: Ondrej =?utf-8?B?TW9zbsOhxI1law==?= , linux-crypto@vger.kernel.org, Sahana Prasad , Tomas Mraz , Ard Biesheuvel Subject: Re: libkcapi tests are failing on kernels 5.5+ Date: Tue, 28 Apr 2020 10:19:19 +0200 Message-ID: <2055037.HuOjPaZDMi@tauon.chronox.de> Organization: atsec information security GmbH In-Reply-To: <7154254.Uj1dk3xSE7@tauon.chronox.de> References: <7154254.Uj1dk3xSE7@tauon.chronox.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Am Dienstag, 21. April 2020, 11:19:36 CEST schrieb Stephan Mueller: Hi Herbert, could you please help us with the answer to the question below? > Am Dienstag, 21. April 2020, 10:08:14 CEST schrieb Ondrej Mosnáček: > > Hi Ondrej, > > > Hi all, > > > > the libkcapi [1] tests are failing on kernels 5.5-rc1 and above [2]. > > All encryption/decryption tests that use 'ctr(aes)' and a message size > > that is not a multiple of 16 fail due to kcapi-enc returning different > > output than expected. > > Confirmed. > > On the recent kernels, the data generated by kcapi-enc contains trailing > zero bytes for data that is a fraction of the block size. > > I think the issue is in the following kernel code in _skcipher_recvmsg: > > unsigned int bs = crypto_skcipher_chunksize(tfm); > > /* > * If more buffers are to be expected to be processed, process only > * full block size buffers. > */ > if (ctx->more || len < ctx->used) > len -= len % bs; > > > The kernel truncates the size to be processed to the chunk size. As the > chunksize returns the block size of the underlying cipher (e.g. AES -> 16), > the kernel code will not process non-aligned data. > > Herbert, could you help me identifying what exactly was the root cause for > the patch 5b0fe9552336338acb52756daf65dd7a4eeca73f ? I.e. it seems that > stream ciphers made out of a block cipher would not generate the data part > that is a fraction of the block size (e.g. CTR, CTS). > > Ciao > Stephan Ciao Stephan -- atsec information security GmbH, Steinstraße 70, 81667 München, Germany Phone: +49 89 442 49 830 - Fax: +49 89 442 49 831 Mobile DE: +49 172 216 55 78 - Mobile US: +1 737 346 1613 HRB: 129439 (Amtsgericht München) GF: Salvatore la Pietra, Staffan Persson, Manuela Gambarotto atsec it security news blog - atsec-information-security.blogspot.com