Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3553249pxp; Tue, 15 Mar 2022 00:35:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRc+qYGzQC8LU/mmj0AOvYtNFPlZPL3qkQC93kiWxyorZDaqVXmVzBgPyQbR0w2jK+avpk X-Received: by 2002:a17:907:7f8d:b0:6db:7227:daea with SMTP id qk13-20020a1709077f8d00b006db7227daeamr21171437ejc.100.1647329714727; Tue, 15 Mar 2022 00:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647329714; cv=none; d=google.com; s=arc-20160816; b=bw7zRb3Skj1gZkGBxLlB+Zh+GY0VjyhKH4jXH7wTXgX8NDrAtv9Tgghjz7hhZPVtms UZMfK/5a3rsqpYYL5eNwyQge2B7527xLTg5RhbNIW76+lLicz4ZJjub3iSlaala07dSW BxwYtrwalt8/dFadz1BKn8Ye8SgfAeXMfW45tHUQpW3KpnTc1hNCBb2j/xvSJ7DPOfUq 93JttP1uaO386lxziUTKdyqXmPBmwII4PEcQw5xLwcjs3erlRrqrxMR+r6yrn4RE+kjQ ERrsccNtcWgZPasiYJOrLlMqZDL5+j61w32yrfPq8XowZaAjP95jSFGF4Oz1gzq5KsGk MvaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=AMSeHQ1nIX6xw59DI2dilTlggzb9xC8E8a6CIS4he/g=; b=nLtJFC6wNjdUl54o65pso/vLwCZG9mfUdS0cKL6uFiD+5DVK8gHjx8v2ikwYkBBTbA BkQ2sV606Do46gZ0rcwcYlNVzLBJZ+4tkZAjuU45Q4S6dgh790E10xaxIC9HwfLKIYU3 1bYPwk3WzE1kNWCLtsNruqi0eP76C28pTNpanc3w/ERlrUCQ9VNeQ4d7l8VoN8/nOrwe H8jiAueh1sVQkJHNXUk+mWkyIEgWNrUmYhgNv1ibv3Zku3b0P2lLr+2vmBk/+QxMPhKF x1VV6v0E/XEwUXJVf4YvpbQnsd5Pp/MuNtHiTsf05zPUqnDIjZN+JxMUZxnSh4ak4tkp 59LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a056402351100b004162a3bc958si1977264edd.272.2022.03.15.00.34.35; Tue, 15 Mar 2022 00:35:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242525AbiCNPfa (ORCPT + 99 others); Mon, 14 Mar 2022 11:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242533AbiCNPf1 (ORCPT ); Mon, 14 Mar 2022 11:35:27 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1CFF1EAF8 for ; Mon, 14 Mar 2022 08:34:17 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1nTmhd-0006ou-Cw; Mon, 14 Mar 2022 16:33:45 +0100 Message-ID: <7f1e4cbd-2d02-2345-493b-68ded3357f26@pengutronix.de> Date: Mon, 14 Mar 2022 16:33:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [EXT] Re: [PATCH v5 4/5] crypto: caam - add in-kernel interface for blob generator Content-Language: en-US To: Pankaj Gupta , Jarkko Sakkinen Cc: David Gstir , Aymen Sghaier , Mimi Zohar , David Howells , "keyrings@vger.kernel.org" , Matthias Schiffer , Herbert Xu , Horia Geanta , Richard Weinberger , James Morris , Eric Biggers , James Bottomley , "Serge E. Hallyn" , "tharvey@gateworks.com" , Franck Lenormand , Jan Luebbe , Sumit Garg , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-crypto@vger.kernel.org" , "kernel@pengutronix.de" , "linux-integrity@vger.kernel.org" , "David S. Miller" References: <20220222195819.2313913-1-a.fatoum@pengutronix.de> <20220222195819.2313913-5-a.fatoum@pengutronix.de> From: Ahmad Fatoum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hello Pankaj, On 25.02.22 13:20, Pankaj Gupta wrote: >>>> +static u32 *caam_blob_alloc_desc(size_t keymod_len) { >>>> + size_t len; >>>> + >>>> + /* header + (key mod immediate) + 2x pointers + op */ >>>> + len = 4 + (4 + ALIGN(keymod_len, 4)) + 2*(4 + 4 + >>>> + CAAM_PTR_SZ_MAX) + 4; >>> >>> Nit: the amount of magic numbers is overwhelming here. I neither >>> understand the statement nor how that comment should help me to >> understand it. >> >> header = 4 >> (key mod immediate) = (4 + ALIGN(keymod_len, 4)) >> 2x pointer = 2 * (4 + 4 + CAAM_PTR_SZ_MAX) >> op = 4 > > Instead of the function caam_blob_alloc_desc(), it will be great if the caller functions caam_encap_blob()/caam_encap_blob (), could add local array: > uint32_t desc[CAAM_DESC_BYTES_MAX]; I just looked into this and placing desc on stack is not possible as it is used for DMA inside caam_jr_enqueue(). Cheers, Ahmad -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |