Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2055580imm; Thu, 21 Jun 2018 06:36:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLuCo2o7vuAp7nLNo67oGGo2AudKnfNerKR0LjCS3kM+GuzY0USoD0+GsZMacY9laXulfRZ X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr28527318pls.18.1529588203128; Thu, 21 Jun 2018 06:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529588203; cv=none; d=google.com; s=arc-20160816; b=cq/iP+4iiMXzPYOcJg8coV0SIu1jcL/h79Ot5lpprUneI0pVIIM8wnhsAj5MxewoYG IvtqFq/UD/H+v+6Yo8s4p58uJSbHf6524I+Q5/kseSp0aLbEf6WasFZhiycSRG+t45Ys a9M5uhU7H+f3nOJ3v8yjUhldZMqRhvvlfcQY7N5p4qpyYwIPtMMnAqX3ouf4rypm2R35 GQG8EZ5mts+5cmhgaf/SvKEhdloEDL8DOSKn05XQjjxeOfn5soIj89+u1d1NF9KYjTHS qNhrfDTXGq8RacQzic/iTwIWs88Sb+Iy8vCr27skGU/HAzNP9SuwINilwc1nYo3EDNzV fSWA== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=xG4f3kdk0noKTA7CTBf5sDL9WPvkJ9zCMXAK4/4POtg=; b=0yuMcyRvouOY3RA2ETuoPDmszrgYinq4DYnxF2qCinE097TMxJtlPkmmaa7EM46hAy z+KM8rEZ2Jh+4wIgru1BJB5FqxMO+2kLv08tM9g1UCUZHP3WO4QSKwEp+4MI3NShFwr8 ZORG9TO8DgbGTkuckjIVzB7fmUNTWtDwZvKYFlYa8OONezcSeOzuwiXFWtsNshCCiMwc iV8xV4PvY2+M+HjQycTBbjOdJIEVKzMM/ywrLY9UJkNIbsjqQUh8y6DIz5n/BLKy4Fk/ Ds58q7/rDdKWFYGlnvnOutTeBUvuDO6+HgIyAnp+UesGE17S3Bn5QLfvdMpFdoOIWwwa th/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=Digm0WkF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si4636647plr.494.2018.06.21.06.36.25; Thu, 21 Jun 2018 06:36:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=Digm0WkF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933128AbeFUNfs (ORCPT + 99 others); Thu, 21 Jun 2018 09:35:48 -0400 Received: from mail-vk0-f66.google.com ([209.85.213.66]:40398 "EHLO mail-vk0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932845AbeFUNfq (ORCPT ); Thu, 21 Jun 2018 09:35:46 -0400 Received: by mail-vk0-f66.google.com with SMTP id o71-v6so1878562vke.7 for ; Thu, 21 Jun 2018 06:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benyossef-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xG4f3kdk0noKTA7CTBf5sDL9WPvkJ9zCMXAK4/4POtg=; b=Digm0WkF8nMSqy065IGl/j5N+0ghotrDCizd4pL5NU54RlyjFTYTOSL3kmWw2rRAmZ a9aYXYpuIkE5E+fRHNi0H/eGb6XycibgWqeKWX6BBs/LmWmSkWdzcCPgkuGVgx2b2ZGK LXM/5a/njOAanxyoEnqSaaWXuycmaJnIzDCHsMaPHdFKjbhu+Q8YaNW0RH3+l+UXYwfp WQT/sJBB+sc94wIx47oihmv5Ucw1nPNYnAe8uazjmnQyvx68+YkMx6ji3bws0gVuy9jf NtqPskq/d+OhK04hOR3oIZQzwDWjuYEPbAMGMsTXp6wBxIlkZeJ5bQYk0tOoy4RwfK8H DVjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xG4f3kdk0noKTA7CTBf5sDL9WPvkJ9zCMXAK4/4POtg=; b=bkRBWEJzOiOC9m/cnnzlk6Za0Q0Fk9yIKcvPykXncV4XSF7gNMkd6FgqVn0hghZndl WDeD0iL/hOQhwwCUKj78rxvzAjDjUTPomA9KRg9kOFOFxSBlW0k+JFbeJuH6+VjtB2Po COGcewCPzOSHG/dZTOMVFSuMWa+CPCyHoa5MXzxWoH1R/lBiOX+2JkW7p5RTsM7auxTs 1Id/d7otLFsiLiXf56u4+FSGDaW7oM0OYxsTjyC+Rwu7j8EK9aZp/ej2jNpXfHwoCiQ7 AhqjRLCX7Yve023mnLpTzUpJtv7wW6V2NfSJPLIl3swUii3nXcArnKJtvutVcg5A/2Xx piyg== X-Gm-Message-State: APt69E1M9oFdWCtM70s089rsXHuFN/uAG3eBASrSVLWMxAJiN1H1x6QL 2IflyCbeNS9iAFLHuuQNDPwUXbd1IeDdnwQb2Kdiiw== X-Received: by 2002:a1f:b393:: with SMTP id c141-v6mr15289381vkf.37.1529588145388; Thu, 21 Jun 2018 06:35:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:3c4:0:0:0:0:0 with HTTP; Thu, 21 Jun 2018 06:35:44 -0700 (PDT) X-Originating-IP: [217.140.96.140] In-Reply-To: <20180619142713.dzipyarpb23a7qne@gondor.apana.org.au> References: <1528361927-4172-1-git-send-email-gilad@benyossef.com> <20180613063030.bsrq3xmufcw4zi52@gondor.apana.org.au> <20180619142713.dzipyarpb23a7qne@gondor.apana.org.au> From: Gilad Ben-Yossef Date: Thu, 21 Jun 2018 16:35:44 +0300 Message-ID: Subject: Re: [PATCH] crypto: ccree: fix iv copying for small buffers To: Herbert Xu Cc: "David S. Miller" , Hadar Gat , Ofir Drang , stable@vger.kernel.org, Linux Crypto Mailing List , Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 19, 2018 at 5:27 PM, Herbert Xu w= rote: > On Sun, Jun 17, 2018 at 01:06:42PM +0300, Gilad Ben-Yossef wrote: >> >> It was ctr(aes). I wrongly assumed that we are supposed to unconditional= ly >> copy >> the cipher-text block post operation and let the caller do with it what = it >> wants and so the >> code now does that for all cipher operations unconditionally. > > For CTR it doesn't matter whether the last block is less than a > block, you should still increment the counter. OK. got it. Although I am not sure how does one use this to continue encryption if the plaintext was not block aligned. > >> So what is a good description of what we are supposed to provide in that >> field post operation? >> The next IV? but as you stated, that is not necessarily useful for all >> ciphers. > > When in doubt, please refer to the generic implementation. If > that is still unclear or if it seems wrong, please post to the > list. Got it. So as a sanity check if I understood correctly I need to: - Increment counter in IV for CTS - Copy last ciphertext block for CFB and CBC to output IV (partial blocks not allowed) What about OFB? unless I've missed something there is no generic implementation... ? Thanks again, Gilad --=20 Gilad Ben-Yossef Chief Coffee Drinker values of =CE=B2 will give rise to dom!