Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2766283ybl; Mon, 19 Aug 2019 07:14:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYFTOCFRjOvgzNDT+H9CqEiSlK2zmPRlb/yLioEsXb11gzVUlwVzqUgYScBGbPpyMoHQ2G X-Received: by 2002:a17:902:7786:: with SMTP id o6mr12302896pll.11.1566224092831; Mon, 19 Aug 2019 07:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566224092; cv=none; d=google.com; s=arc-20160816; b=wiwwKBUuedtnrdV+fOtg1LRSLl+vFD551B1w1E9Ou2NbFrYJiIo3WoKg+ndA0UMZqt pWwYArdT0DO580wE4+t023VePIaWrILhwFSoG9slS5tYHfuNEbAaIrL9m9Cv2s46sWJi N0sfXIFQP2Uxmbq4l9vGZKoEPUQ6QsWSkD35bysie15F7zkruW6xcb37lYJBOyut+Cd4 HO36lm/qETQjakscI4j39ym3RHouX8Bw8uvfqoHwFUrXP88VmdkikzlvgObuWTip/vmZ 59BgE5R+tIzNguOMcqZwxu0MBYrjQxvrtmDknPAvJ0aq4gp8IeR1fAlteMBS8FxOn83s Etsg== 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=wac/8K0PlB5YqvgpI9XB84WnEjzGgiNR49Px3uNmKW4=; b=jU5wBhsuO+UODRa76hbqnsHyMtkzJj1Mwh93FCjLKfUByi/XlBl4NcbrqoroRJFgKh KuOOngYWiQ1G7oQkGnWUvYQzTRo1aFOCUozCdmTZ3Hov8LUhD+TV2NwUENp960q9riiJ eDvVzmUKRi654HvH/+9BQZga9Uz1pEbAmsCIpNikaapQXAFZt6+95YQl+bfg+Mv7mFxQ xDgaQfzbIfioGDTxJP0QLG4ilK2MwcfvSgcLOkhWchbMIKEGOVj7c4OfWoO6TnyFYq+g uLsDhEzRyTEaH8/KjUVBrAQe4Hjn2P612d39rCHIGBWh7N08Q8NjLX5OYHAGn2eW8TFS aQ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XFkdapvj; 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 x12si8113701pln.219.2019.08.19.07.14.31; Mon, 19 Aug 2019 07:14:52 -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=XFkdapvj; 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 S1726742AbfHSOO3 (ORCPT + 99 others); Mon, 19 Aug 2019 10:14:29 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40935 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfHSOO2 (ORCPT ); Mon, 19 Aug 2019 10:14:28 -0400 Received: by mail-wr1-f65.google.com with SMTP id c3so8907776wrd.7 for ; Mon, 19 Aug 2019 07:14:27 -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=wac/8K0PlB5YqvgpI9XB84WnEjzGgiNR49Px3uNmKW4=; b=XFkdapvjB9ydQEoU7RWQdtlXojOwik5hizdLU9r2m8gd/IMDBuB1WcWbX6GxKduW06 eqfg/JzDDnFlhRAb3Zjg1PMHT/2+lIZDLxwtPzakUBcxeeih7FVPqv2b2dSq1hwIJ2qk IBMbtHQ4TCDt1a8B6opSINSLFpvToXarInaeq3ntBbVSmSMmAw+jz0Z1J6Q8opDqmOn2 JCYj4LcgzpcebgU4w4n//XHtfjKUV/DwL+rFvZ/6La2TcOVHb59BvhcNvgMqWiiuLS7S bCUN0+cxlt5dQ+AP15mSrdAbsMRm9m3tpLEZCnAsihJhYy6R6f4XotpJfNYDS1d1ZHkI oICw== 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=wac/8K0PlB5YqvgpI9XB84WnEjzGgiNR49Px3uNmKW4=; b=kCF55Lao4XhPGSzfmzPGZn5Ez8ZoKv+FwmAoVBJTbf1t2EouZTJHL4GEAi4yAhS133 Cfjn5Kba7eQKcM3SIn1yMsetaCGwLmFeRMic/ol42zcPi6II1FD3ULBtMwGloKgdIdpl BJ//j8c+sYZjZoT0aY03AgyDcpEixlQlFP4TKFYMspsc60RW0dE739waIUtt9BrzL55l Tw74/UbLGAqACuaqDjOXN2dl77mx5I2KTotpiE5E25oEMOO8cnVEYiI5cgDkyVojNOUr EVKZ99Ix5vM5Mahl6yG7G63JdqgRfCsIpKV5j0kM+Q7tlisMCS6ZsDE5kQ2IvdmqkkSf 2tAw== X-Gm-Message-State: APjAAAWvqc+uxYaO9x5uZIkXPXsEvda8VsSDdHY2Wq1w2xiylJd1hpNF 0iZ1gwbQa/U+FeI1qZsiPT4Eu0eyihgAEvABeOMt0g== X-Received: by 2002:a5d:5450:: with SMTP id w16mr14907929wrv.174.1566224066287; Mon, 19 Aug 2019 07:14:26 -0700 (PDT) MIME-Version: 1.0 References: <20190815192858.28125-1-ard.biesheuvel@linaro.org> <20190815192858.28125-2-ard.biesheuvel@linaro.org> <20190819063218.GA31821@gondor.apana.org.au> In-Reply-To: <20190819063218.GA31821@gondor.apana.org.au> From: Ard Biesheuvel Date: Mon, 19 Aug 2019 17:14:25 +0300 Message-ID: Subject: Re: [PATCH v12 1/4] crypto: essiv - create wrapper template for ESSIV generation To: Herbert Xu Cc: "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Eric Biggers , device-mapper development , linux-fscrypt@vger.kernel.org, Gilad Ben-Yossef , Milan Broz 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 Mon, 19 Aug 2019 at 09:32, Herbert Xu wrote: > > On Thu, Aug 15, 2019 at 10:28:55PM +0300, Ard Biesheuvel wrote: > > > > + /* Synchronous hash, e.g., "sha256" */ > > + ictx->hash = crypto_alloc_shash(shash_name, 0, 0); > > + if (IS_ERR(ictx->hash)) { > > + err = PTR_ERR(ictx->hash); > > + goto out_drop_skcipher; > > + } > > Holding a reference to this algorithm for the life-time of the > instance is not nice. How about just doing a lookup as you were > doing before with crypto_alg_mod_lookup and getting the cra_name > from that? > OK, but it should be the cra_driver_name not the cra_name. Otherwise, allocating essiv(cbc(aes),sha256-generic) may end up using a different implementation of sha256, which would be bad.