Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3700564ybk; Tue, 19 May 2020 10:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpOkK3T1X1Z1qg+wvGZzfZFTALADu6hJN7mrfkObI9Hkl6mQwM5CJBeF2bm+Xb7KGPlU9A X-Received: by 2002:a17:906:90d4:: with SMTP id v20mr355987ejw.480.1589910721199; Tue, 19 May 2020 10:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589910721; cv=none; d=google.com; s=arc-20160816; b=tkL+C9qPMz0t0nsDxl4L4qGYDD7UURSwaKblDlkd5B3jEC90k1QHCumvyMSqtG48bG 60AunVew7V9Mqc7JbPZrN4p1jgXgYOPp9LXy2tJHU+u8BLj3+vat/2LIR3atWRDhKxgO 15iUjRAMtEWY53Ic1rEEFCUu6ApLdUKAAdPksvoqkkhJwkh2QQP3gbkaMh67cME4f1Pa +1HvCM1dSvD/X/GfnD432Kg22/O/cLjkg+6nxJzhcE4VZtvGEo4ym2zVEjxm2am1cQzx GFNnGHDP0TWEwZ2y37ZwKVHhlubakrIvCgkVkE14bBJixFI5wKahHoiBCTaUdiCIvp/D szsQ== 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=0BZRhxHinA0YPEXg7pD4vsgU15bnQZ2vQQ8PJauOyUc=; b=rY62m49lWILGofcqYeh1gcDps6vXr6jQaf1mslL85nS3PbMRZM1HBqxOL/5AHspfS6 OtE2QKWlB6Bx13tRa4zqGkmdIPoe2Xz1m9P/msSn2N8D2NKvS/babn11ZyfpEgadSXSV wgaBISJQHQJPNsEZ3P0jDfajHDIEt5eZVU/7a2U8eqtzYPiq65XvKixy8MV4+HBZ4vcu O1tUE8xKA6okZlLx1ch501swoisTZbsz+3K+VSq9oF1MZBgeD80Zvss59VzSy+Yz52HC qytLBnmHadhcaS8BuixnrX3l4fMZFaa2TeWuPnV8k8KPa92J77vibm8yr2nlcWH1JCC+ f0hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M7VCm6Aq; 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 o14si293361eja.223.2020.05.19.10.51.32; Tue, 19 May 2020 10:52:01 -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=M7VCm6Aq; 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 S1729001AbgESRug (ORCPT + 99 others); Tue, 19 May 2020 13:50:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:36112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbgESRug (ORCPT ); Tue, 19 May 2020 13:50:36 -0400 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 75E1D207D8 for ; Tue, 19 May 2020 17:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589910635; bh=0BZRhxHinA0YPEXg7pD4vsgU15bnQZ2vQQ8PJauOyUc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=M7VCm6AqtHVdqaWYlxaqBmsEi/lF5DrDHd9LO85N8OOdVsbl3wA0x73vO8VjHWG2Z rOtN0wu2Zzto9vb5lgKjiWfRdJk8x0qmjexcfT5wmdHCl3sDYpvj5rT9bYlDhFyLuG NgTwo72hCnMGHzy6t+hjT3f6TIyuQRT6DMiuJ7sE= Received: by mail-io1-f54.google.com with SMTP id f3so110692ioj.1 for ; Tue, 19 May 2020 10:50:35 -0700 (PDT) X-Gm-Message-State: AOAM532oC3YRHQiSt1qVgOVfQA3mDuZ4rU2sSS2srIi2EH5zGfu/mPrv VghtS8X9mEhBB0pGw53CE9KUwmdLIxuKvx/NauY= X-Received: by 2002:a02:c48b:: with SMTP id t11mr806385jam.71.1589910634855; Tue, 19 May 2020 10:50:34 -0700 (PDT) MIME-Version: 1.0 References: <4311723.JCXmkh6OgN@tauon.chronox.de> <8691076.XE7dyB1q2z@tauon.chronox.de> In-Reply-To: <8691076.XE7dyB1q2z@tauon.chronox.de> From: Ard Biesheuvel Date: Tue, 19 May 2020 19:50:23 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: ARM CE: CTS IV handling To: Stephan Mueller Cc: Eric Biggers , Ard Biesheuvel , Linux Crypto Mailing List 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 Tue, 19 May 2020 at 19:35, Stephan Mueller wrote: > > Am Dienstag, 19. Mai 2020, 18:21:01 CEST schrieb Ard Biesheuvel: > > Hi Ard, > > > > > To be honest, this looks like the API is being used incorrectly. Is > > this a similar issue to the one Herbert spotted recently with the CTR > > code? > > > > When you say 'leaving the TFM untouched' do you mean the skcipher > > request? The TFM should not retain any per-request state in the first > > place. > > > > The skcipher request struct is not meant to retain any state either - > > the API simply does not support incremental encryption if the input is > > not a multiple of the chunksize. > > > > Could you give some sample code on how you are using the API in this case? > > What I am doing technically is to allocate a new tfm and request at the > beginning and then reuse the TFM and request. In that sense, I think I violate > that constraint. > > But in order to implement such repetition, I can surely clear / allocate a new > TFM. But in order to get that right, I need the resulting IV after the cipher > operation. > > This IV that I get after the cipher operation completes is different between C > and CE. > So is the expected output IV simply the last block of ciphertext that was generated (as usual), but located before the truncated block in the output?