Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp528283ybm; Fri, 29 May 2020 06:11:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb25UDQCYmMeGqTuUnLEcDOnm8lmt0R+HAQPUzvY2d0XFc2kHimzvbQRBnymaHNamV36y1 X-Received: by 2002:a05:6402:b0b:: with SMTP id bm11mr8434300edb.92.1590757888736; Fri, 29 May 2020 06:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590757888; cv=none; d=google.com; s=arc-20160816; b=OyowHo2LWmplh5PkJOqrZnPjXBZXfTqK4QghRyoQzU5yIM7kKCvC/2AV4xQLXp0aDc X+ZJhANRYDym4dWMl54UwEuN6RRMyLXwWjmlxCnQNiDQUbsyQx++SQKenXcLXnLG1lnE LAgGtm3/oYeBBpU7gTdMFFRL/qvPDkWqSytHKevcTJjQ2iaAQZ14Wd1VQJS57shE5Rb3 /lf7QkS2qoeS/5OnlRvS4NnBQAtlkDnkyglbWzFeD/xkJIuVI29i0/MqYR+1IWjf2DJK pxzX2u+lc+qDItH2xLr+esvHVNO7vGfBFAmFBa78R/PMzvJnGppxPyR7EADTn4MK0/TS Y3HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fpqVd2S6sw1KSq77Y2DVJhgyP64rnlywDZYYuZ+bqz0=; b=nHAKXlsgcJVQ0YQBqUUot5cNVpnN1tKKQBiidJdSZ+iWmLCuOIsNCVANG7rmpmk717 c5Oio4sWfH6BxhuAC1c2Xt5+jr7mmfsV9icEvY8DI73taq7UnkBPZFzBxl3WWI/KGddK q41fohRQ9Z0WR7aL4WW+yMqRixx3jnc3phXytY+VAS9aWB5/ZsOy61TWzfnRS1U3pZ6Q 4MMwdGd4RmGYFbtfYA0lVjRRcIyQIe9nuFe7Gc/hcGNmQqsc/s/Yyzr86yCI/GI/2Bfq rkgvkP7mrWQk6vs/w7crP4jV75EmibZo6lxa7TALzx9PuyoZn9dBZnAhr0fC244jlCWq AOiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eyRv3lIf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si5515846ejm.673.2020.05.29.06.10.57; Fri, 29 May 2020 06:11:28 -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=pass header.i=@kernel.org header.s=default header.b=eyRv3lIf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbgE2NK4 (ORCPT + 99 others); Fri, 29 May 2020 09:10:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:50344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgE2NKz (ORCPT ); Fri, 29 May 2020 09:10:55 -0400 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30969207F5 for ; Fri, 29 May 2020 13:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590757855; bh=fpqVd2S6sw1KSq77Y2DVJhgyP64rnlywDZYYuZ+bqz0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=eyRv3lIf3nxOiFUyHfQJOkkCF749DBt8NILeq+Jgngy9UVmPvm3I40r6vL/31mJx/ J5XjucqOBosTU96NxUq31/pw9bhedn3Gn19rP26AojfMwpXY0/uHGmFJEqNBbXLMuQ xm+Xml7hLNLNp5SnjbHXKcuVMC87stHOG7biVwu0= Received: by mail-io1-f50.google.com with SMTP id m81so1236017ioa.1 for ; Fri, 29 May 2020 06:10:55 -0700 (PDT) X-Gm-Message-State: AOAM532oKB19LvGy9n+mmCroYek/O/dWTvbmwY7G+pbFS4/Xng9fUEL8 310LHtbSDh4cV8uwBOm8K07Y86hRwPS+f5BQutU= X-Received: by 2002:a05:6638:a50:: with SMTP id 16mr6709322jap.71.1590757854581; Fri, 29 May 2020 06:10:54 -0700 (PDT) MIME-Version: 1.0 References: <20200519190211.76855-1-ardb@kernel.org> <20200528073349.GA32566@gondor.apana.org.au> <20200529080508.GA2880@gondor.apana.org.au> <20200529115126.GA3573@gondor.apana.org.au> <20200529120216.GA3752@gondor.apana.org.au> In-Reply-To: <20200529120216.GA3752@gondor.apana.org.au> From: Ard Biesheuvel Date: Fri, 29 May 2020 15:10:43 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC/RFT PATCH 0/2] crypto: add CTS output IVs for arm64 and testmgr To: Herbert Xu Cc: Linux Crypto Mailing List , Linux ARM , Eric Biggers , Stephan Mueller 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 On Fri, 29 May 2020 at 14:02, Herbert Xu wrote: > > On Fri, May 29, 2020 at 02:00:14PM +0200, Ard Biesheuvel wrote: > > > > Even if this is the case, it requires that an skcipher implementation > > stores an output IV in the buffer that skcipher request's IV field > > points to. Currently, we only check whether this is the case for CBC > > implementations, and so it is quite likely that lots of h/w > > accelerators or arch code don't adhere to this today. > > They are and have always been broken because algif_skcipher has > always relied on this. > OK, so the undocumented assumption is that algif_skcipher requests are delineated by ALG_SET_IV commands, and that anything that gets sent to the socket in between should be treated as a single request, right? I think that makes sense, but do note that this deviates from Stephan's use case, where the ciphertext stealing block swap was applied after every call into af_alg, with the IV being inherited from one request to the next. I think that case was invalid to begin with, I just hope no other use cases exist where this unspecified behavior is being relied upon. > > This might be feasible for the generic CTS driver wrapping h/w > > accelerated CBC. But how is this supposed to work, e.g., for the two > > existing h/w implementations of cts(cbc(aes)) that currently ignore > > this? > > They'll have to disable chaining. > > The way I'm doing this would allow some implementations to allow > chaining while others of the same algorithm can disable chaining > and require the whole request to be presented together. > Fair enough.