From: Tudor-Dan Ambarus Subject: RE: [PATCH v3 1/3] crypto: rsa - generalize ASN.1 sequences Date: Mon, 25 Apr 2016 05:54:44 +0000 Message-ID: References: <1459949826-11840-1-git-send-email-tudor-dan.ambarus@nxp.com> <1459949826-11840-2-git-send-email-tudor-dan.ambarus@nxp.com> <20160415135245.GA334@gondor.apana.org.au> <20160415143851.GK733@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Cc: "'linux-crypto@vger.kernel.org'" , "'tadeusz.struk@intel.com'" , "'smueller@chronox.de'" , Cristian Stoica , Horia Ioan Geanta Neag To: 'Herbert Xu' Return-path: Received: from mail-db3on0081.outbound.protection.outlook.com ([157.55.234.81]:52468 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752042AbcDYFys convert rfc822-to-8bit (ORCPT ); Mon, 25 Apr 2016 01:54:48 -0400 In-Reply-To: Content-Language: en-US Sender: linux-crypto-owner@vger.kernel.org List-ID: Hi Herbert, > > On Fri, Apr 15, 2016 at 02:32:42PM +0000, Tudor-Dan Ambarus wrote: > > > > On Wed, Apr 06, 2016 at 04:37:04PM +0300, Tudor Ambarus wrote: > > > > > This approach has the advantage that users can select specific > > > > > parser actions by using a general parser with function pointers > > > > > to specific actions. > > > > > > > > I don't understand why we need different parsing functions in the > > > > first place. Can't they just return raw integers always? > > > > > > > > You can then trivially convert the raw integers to MPI, no? > > > > > > We need different parsing functions so that we don't allocate duplicate > > buffers for the same data. > > > > > > You need to allocate buffers when getting the raw integers and you need > > to allocate other (duplicate) buffers when converting the raw integers to > > MPI. > > > > > > Using the proposed API each user can select the format of data he > wants, > > eliminating the need of a double conversion (with its drawbacks: > duplicate > > buffers, unnecessary cycles). > > > > The double allocation only happens with software RSA, right? I > > don't really think that is going to matter considering how slow > > it is, no? > > The double allocation happens only with software RSA. I can't estimate the > performance hit for the double conversion. Naturally is to parse the data > only once. Plus, my suggestion is simple, faster and doesn't waste > resources. Do you want me to address some suggestions, or do you intend to apply this patch set? Thanks, ta