Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp833910ybi; Thu, 30 May 2019 07:28:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqydl4/F6s4KyCvZq9zOLxBYgSL+iz3wDv5WbYDrujEtmmPmdZuLZQRkbAb4TCnLXh4YmKza X-Received: by 2002:aa7:9a8c:: with SMTP id w12mr3936148pfi.187.1559226490070; Thu, 30 May 2019 07:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559226490; cv=none; d=google.com; s=arc-20160816; b=wLyDSGfKjQRQuCePg6Y77lAsZ0i53oI5PE8wvm326FZUaBd+1yncc20Uy+k4S1HBaq wNoP56d/2HFytfmNlNiEaeVhbOZlY8KRYuUCRLZ8og+gXFiSe5N9jBSIniIJHstnunru VuOTH8l/kMiKd7XnpTMNElT0KiMaennVu5brGvsVj0xpDU3LV1tI5rRkhWu8rdqhOKZz rn0Pp757lUleoocytmfKG3UY+eE0x3kUZZLvDAs1Ud4TS1yj6Z+6tJOq+WpOQK5dRawf 94vNEcQZuNdwfunrraY/LfVAs3FcDgyaf3FZ2klI8u94DxZT0JiAe6XT/FaMvNUpMDa/ zscQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=5Nn0dNmp5bE0B+n78XxQEHSahlJe9R+YKBgQ3W7hrng=; b=Y7uJPBWVR2pyQfgkpDWs5bzNwe2wjd6wL12J+q3KMa1z/jtioYe1ta8yMoSW9oQOOa Q10gIKLZsBjSo/G/Fhu9/jRQinKtojYP/1J125JA5Ak0HgY7UrPaknhAphPdt6GFgFJ0 RP3EZPF3bE9R+cMM1d+gdU7o2A2JGzi9Q/8xkSA0dRjRVWHEtw7KnSdbWD6ui3LJ6afK Edg1vFj4znqUAdOd1s0aGqMfRf+A2DVKJkxnrWBhiv9byPdzpN8n1sm+ixJ6MQIT2bJJ FeDoBkKLuUyCgNtjvNBSbQDNW2fRfp4L8nthr1eATotLVNzZOboN17GXYqUwoU5JAM9Z whMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 189si3517938pff.281.2019.05.30.07.27.50; Thu, 30 May 2019 07:28:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726080AbfE3O1r (ORCPT + 99 others); Thu, 30 May 2019 10:27:47 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:38382 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726079AbfE3O1r (ORCPT ); Thu, 30 May 2019 10:27:47 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1hWM1u-0006i2-9X; Thu, 30 May 2019 22:27:42 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1hWM1m-000474-6D; Thu, 30 May 2019 22:27:34 +0800 Date: Thu, 30 May 2019 22:27:34 +0800 From: Herbert Xu To: Ard Biesheuvel Cc: Iuliana Prodan , Eric Biggers , "David S. Miller" , Horia Geanta , Sascha Hauer , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Linux Kernel Mailing List , dl-linux-imx Subject: Re: [PATCH] crypto: gcm - fix cacheline sharing Message-ID: <20190530142734.qlhgzeal22zxfhk5@gondor.apana.org.au> References: <1559149856-7938-1-git-send-email-iuliana.prodan@nxp.com> <20190529202728.GA35103@gmail.com> <20190530133427.qrwjzctac2x6nsby@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, May 30, 2019 at 03:55:07PM +0200, Ard Biesheuvel wrote: > > > Would this work? I see. You need to preserve the original IV. > > diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c > > index c0ece44f303b..2ef2f76a3cb8 100644 > > --- a/drivers/crypto/caam/caamalg.c > > +++ b/drivers/crypto/caam/caamalg.c > > @@ -1832,22 +1832,25 @@ static int skcipher_decrypt(struct > > skcipher_request *req) > > struct caam_ctx *ctx = crypto_skcipher_ctx(skcipher); > > int ivsize = crypto_skcipher_ivsize(skcipher); > > struct device *jrdev = ctx->jrdev; > > + u8 out_iv[AES_BLOCK_SIZE]; > > u32 *desc; > > int ret = 0; > > > > - /* allocate extended descriptor */ > > - edesc = skcipher_edesc_alloc(req, DESC_JOB_IO_LEN * CAAM_CMD_SZ); > > - if (IS_ERR(edesc)) > > - return PTR_ERR(edesc); > > - > > /* > > * The crypto API expects us to set the IV (req->iv) to the last > > * ciphertext block. > > */ > > if (ivsize) > > - scatterwalk_map_and_copy(req->iv, req->src, req->cryptlen - > > + scatterwalk_map_and_copy(out_iv, req->src, req->cryptlen - > > ivsize, ivsize, 0); > > > > + /* allocate extended descriptor */ > > + edesc = skcipher_edesc_alloc(req, DESC_JOB_IO_LEN * CAAM_CMD_SZ); > > + if (IS_ERR(edesc)) > > + return PTR_ERR(edesc); > > + > > + memcpy(req->iv, out_iv, ivsize); > > + > > /* Create and submit job descriptor*/ > > init_skcipher_job(req, edesc, false); > > desc = edesc->hw_desc; > > Umm never mind > > /me hides in shame So why doesn't this work? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt