Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4535098ybz; Tue, 21 Apr 2020 02:20:45 -0700 (PDT) X-Google-Smtp-Source: APiQypLRH0s+XWcjDudYynV++RVMqODC4AbrxbPzypsuakt9iFLxEcfvR22ZXgLLHOK9JSII2Wjc X-Received: by 2002:a17:906:f106:: with SMTP id gv6mr20841184ejb.271.1587460844897; Tue, 21 Apr 2020 02:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587460844; cv=none; d=google.com; s=arc-20160816; b=kSpQjFAX8o+xx+EzTDS/fwu/j0NZb51BKZVPzOoooyeJrZWWIpb/12Uctkrnaa6hLk KkLpf1alazWRePOJMpUU3t1q3ZLrvcYUn06eP33t2GNSQ2SJMHaC4ZcANdLcz/vOP/Mo QXoybndx0pNHzZ9pl4nzrTimcCt6DU0VfLZ/EJ07Kocy+e/zEngqCCzRVPEePH1BE7hb UphWlw5j6nqmQ8sxBGNpgYquDie8TfGaY9YEw1mwCmiQ6Ja7CIAsknwTXPz/BaKAS9Zp zMRw6wjq6KyIH99vlJ3VDdIVkLgINZ0cQGZ8N7JDVsZCYtkrejDmuVmU2wSo/py4ziBm gvEw== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=E9BJAvjzMhCklazXBZPYBfbuu7B+KuXrP8zNnSdB9RE=; b=kswsz/1GD+1qHtTIq+CLowOsXH7DlB9kX2lce1cxzF6dAjcHS4qR1P/NVSgcka3Lkz Fe5aG6pmHkAx6rkMVbng4aRFzZjrJseb/npY9eV4Of6cdMfWWwg+FHze2kjAszcKkMXw EygkAVfllDiEf6AVrStkJueCWiO6WB/PW2G4VhedEYFxN5U7dz1TI8ONa8tapwSi81Qa zYoSjg8SoHca/kWdAWcK2DzgJyXDkPsEgie9aNp+aKbILhLpFu11YhwLI9egaZCC9Oxt /Quqre7983c0qFMt8Hw8HBxvAMvUa4pzlBkFqTq4YgEv6EbZ1bXkwFjI2Y5jKewJFUOA PrYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=ccuBKtj8; 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 qo19si1235519ejb.239.2020.04.21.02.20.13; Tue, 21 Apr 2020 02:20:44 -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; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=ccuBKtj8; 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 S1726741AbgDUJUL (ORCPT + 99 others); Tue, 21 Apr 2020 05:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726600AbgDUJUK (ORCPT ); Tue, 21 Apr 2020 05:20:10 -0400 Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66EDCC061A0F for ; Tue, 21 Apr 2020 02:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1587460806; s=strato-dkim-0002; d=chronox.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=E9BJAvjzMhCklazXBZPYBfbuu7B+KuXrP8zNnSdB9RE=; b=ccuBKtj8J+wPD6HqtBK0lrHYVvwtapkbWBbRDGDh/X+1O6MeSksOf3hdmbAwhVteyB BrtU6hqE5DTbDUOmSbk9h9+JbTsFl19p2DhNHXxCEmdYg/Ante9SgpfW+0PnG72JeyM6 oSWdwaeAZuU00KEOMhx1Re/FuHFWEBygcfUafdnQL7j5m3e6hxlcLxWo8ItLk5IWmWMT /AiTNEeKNcMKMSw0MqBp66f2ek7PWBhRe7L+74eHTWErOKwIRje1xWlm07ADjNnShJzF 9/YB3i3yf4BnuJd6WbJfedeVdqjiM86KObEyF6GsJP5Y5364WXiArrCB39dHB8SUDmzJ aAHw== X-RZG-AUTH: ":P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNyiHySGSa9k9xmwdNnzGHXPbJPSfZtvO" X-RZG-CLASS-ID: mo00 Received: from tauon.chronox.de by smtp.strato.de (RZmta 46.5.0 DYNA|AUTH) with ESMTPSA id c09283w3L9JbLgh (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 21 Apr 2020 11:19:37 +0200 (CEST) From: Stephan Mueller To: Ondrej =?utf-8?B?TW9zbsOhxI1law==?= Cc: linux-crypto@vger.kernel.org, Herbert Xu , Sahana Prasad , Tomas Mraz , Ard Biesheuvel Subject: Re: libkcapi tests are failing on kernels 5.5+ Date: Tue, 21 Apr 2020 11:19:36 +0200 Message-ID: <7154254.Uj1dk3xSE7@tauon.chronox.de> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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, 10:08:14 CEST schrieb Ondrej Mosn=C3=A1=C4=8De= k: Hi Ondrej, > Hi all, >=20 > 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 ze= ro=20 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 =3D 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 -=3D len % bs; The kernel truncates the size to be processed to the chunk size. As the=20 chunksize returns the block size of the underlying cipher (e.g. AES -> 16),= =20 the kernel code will not process non-aligned data. Herbert, could you help me identifying what exactly was the root cause for = the=20 patch 5b0fe9552336338acb52756daf65dd7a4eeca73f ? I.e. it seems that stream= =20 ciphers made out of a block cipher would not generate the data part that is= a=20 fraction of the block size (e.g. CTR, CTS). Ciao Stephan