Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp814986ybi; Thu, 30 May 2019 07:12:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/OEp+uCd3lF+5WTx+DBr1Y16QH6R68bt3NRQPR+WolyhmeGi7mBTHDGO+E8xuQtv6499P X-Received: by 2002:a63:d716:: with SMTP id d22mr3843366pgg.244.1559225534796; Thu, 30 May 2019 07:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559225534; cv=none; d=google.com; s=arc-20160816; b=Bn37RINafg2MqJxEP0imI93WEId3zZKQSUsPreBJgh1+F0PoJ+Ko2nseK0gGPkK/XP JOoZf1iiB/tWsV58E9aFnVc/REKOGFkFZ1shWACk71pu13HSitcy4WJXwAlsQGs4fIs2 1Y2oFONVN5PgFu8qrrCEKIrsn3P3qAh89+bLXouLZnLYugdoiwOmeh2cc8xxxLXwln8B Fdy6LviWrrjKotW9UfX+AtcJBO3Zk1NFGOM4w3RkS5tCE889K2twgHVMgc8d8gJp2D40 54Jwm4SV0vMvbZVNI4cR2gx/uRUxmrIzLutV5TgeItJQf9nmygrg+5EdS1i+Xz/p4N7I Y3eA== 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=3m+GACOpj4FpxTfagkQ56YHJBgCqLctr+f1GcaAlBKI=; b=jsUGyz95ETP2zQjehpSt9d4mfFsxe/0tcc6wpVleFOQphnOFlf1vhHws8IhOKLQpM4 0HSvQZzmg4j59E1xZVAsNXDB4q05cD5r6NlY4D9UllQ92ru8Czx/TL4ZGlED5rQHz5eI YHd/7nYwPwStzqxSaHDEcLWQaOhppIa8vOkikqinOtUD6YlcnB+Kboe/Wwo0SImFBZ4v HqocMreJF/rTijoSbocoZW4LNTbMQth0AEXp6ki0kXEA6o/1FVZVHv7KNWqRhzatjLgX aAdo30tq/19rARMLZ3lQvnLnlOP0yJp9C3KynBH0x0PTZsSLjGW5mvP+RfE6UURtyUjG 4Jkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r7mmQx/M"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si3118885pgc.97.2019.05.30.07.11.54; Thu, 30 May 2019 07:12:14 -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; dkim=pass header.i=@linaro.org header.s=google header.b="r7mmQx/M"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726540AbfE3OLw (ORCPT + 99 others); Thu, 30 May 2019 10:11:52 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:52676 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbfE3OLv (ORCPT ); Thu, 30 May 2019 10:11:51 -0400 Received: by mail-it1-f194.google.com with SMTP id t184so10078676itf.2 for ; Thu, 30 May 2019 07:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3m+GACOpj4FpxTfagkQ56YHJBgCqLctr+f1GcaAlBKI=; b=r7mmQx/MZFOJbicAL0UI1sOzinV94EgrU9O0u7jEhPqiptJnmddsYUSPm6on0kSrFU xQp6ZR2QHiJ8kS333/mkLjOlU0owecS7mHTcI+8Q8w1Ufa0yemmz/wFyrLvCEbMdiG4g awWPIkJOFlfBdmi1Y5w8qzOOaTJAe210hkBkpB46Sw/pRJwbjTL1DZdo888zGLDYbKAn 3zh7IGr4/NmN1B1+kmNGKVuJ/Mr8SrrOolOuPxRCZpv9/5pP6hgnFnVRiyNMinILW+3m iZahnc9s3SC8bhVTKSYkb9QT0z94Z7n7JqCOn/Gqt+Du9essV5xI2CJUYj6PLn2liJUG irxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3m+GACOpj4FpxTfagkQ56YHJBgCqLctr+f1GcaAlBKI=; b=CMTsJczi8ORGQ4WS10+Etc32u534iJB61RQwT4LOXYWRxm1WDFaKR8tJpBUvv0y85G e29uR0jKSwdetvr3Dk8kZfskAFjCZsIe7HtC8qoq06A1sA97CIwiaildCp+VTce4tXFd kacGWY6SPs/47jJrw+H6JvgJIRrVUKT2QU6kjezIrdYeP7hElgHPbAD5p4QcyKB+B6dQ uyUFoHmDKknwM8Cp0Z/Aa+FeQydLdK7DQz5AmWOW7SbxaWX5N5W8SzovvLZLJn4/dyEM OaVkUmhFZ07ilAayaRwlytK1XQMldU8M56SDXPj7rywDtctx4WOBPVZj05G2/8Ea9xC1 9xjA== X-Gm-Message-State: APjAAAWzHBN/c1DIzVJjfrJN45nR+k4YisZhXnn5Pqw19JPuAGNIzVHl XVnhQ5r7OegZ50FgHggrQthfK47aMFdbvLZ031DfDw== X-Received: by 2002:a02:a494:: with SMTP id d20mr2418000jam.62.1559225511157; Thu, 30 May 2019 07:11:51 -0700 (PDT) MIME-Version: 1.0 References: <1559149856-7938-1-git-send-email-iuliana.prodan@nxp.com> <20190529202728.GA35103@gmail.com> <20190530133427.qrwjzctac2x6nsby@gondor.apana.org.au> <20190530135800.ekcso3n2p5zkg6yv@gondor.apana.org.au> In-Reply-To: <20190530135800.ekcso3n2p5zkg6yv@gondor.apana.org.au> From: Ard Biesheuvel Date: Thu, 30 May 2019 16:11:37 +0200 Message-ID: Subject: Re: [PATCH] crypto: gcm - fix cacheline sharing To: Herbert Xu 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 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 Thu, 30 May 2019 at 15:58, Herbert Xu wrote: > > On Thu, May 30, 2019 at 01:45:47PM +0000, Iuliana Prodan wrote: > > > > On the current structure of caamalg, to work, iv needs to be copied > > before memcpy(iv, req->iv, ivsize), from skcipher_edesc_alloc function. > > For this we need edesc, but this cannot be allocated before knowing how > > much memory we need. So, to make it work, we'll need to modify more in CAAM. > > All the copying does is: > > if (ivsize) > scatterwalk_map_and_copy(req->iv, req->src, req->cryptlen - > ivsize, ivsize, 0); > > Why do you need to allocate the edesc before doing this? > Because that is where the incoming iv is currently consumed. Copying it out like this wipes the input IV from memory.