From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbcEKXuJ (ORCPT ); Wed, 11 May 2016 19:50:09 -0400 Received: from mga14.intel.com ([192.55.52.115]:62118 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbcEKXuH (ORCPT ); Wed, 11 May 2016 19:50:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,609,1455004800"; d="scan'208";a="700757186" Date: Wed, 11 May 2016 16:50:05 -0700 (PDT) From: Mat Martineau X-X-Sender: mjmartin@mjmartin-mac01.local To: David Howells cc: mathew.j.martineau@linux.intel.com, tadeusz.struk@intel.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, dwmw2@infradead.org Subject: Re: [RFC PATCH 5/8] KEYS: Provide software public key query function [ver 3] In-Reply-To: <20160511142230.4743.12500.stgit@warthog.procyon.org.uk> Message-ID: References: <20160511142152.4743.14414.stgit@warthog.procyon.org.uk> <20160511142230.4743.12500.stgit@warthog.procyon.org.uk> User-Agent: Alpine 2.20 (OSX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 May 2016, David Howells wrote: > Provide a query function for the software public key implementation. This > permits information about such a key to be obtained using > query_asymmetric_key() or KEYCTL_PKEY_QUERY. > > Signed-off-by: David Howells > --- > > crypto/asymmetric_keys/public_key.c | 96 ++++++++++++++++++++++++++++++----- > 1 file changed, 82 insertions(+), 14 deletions(-) > > diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c > index 96983906d2a2..e9967e5a2c25 100644 > --- a/crypto/asymmetric_keys/public_key.c > +++ b/crypto/asymmetric_keys/public_key.c > +static int software_key_query(const struct kernel_pkey_params *params, > + struct kernel_pkey_query *info) > +{ ... > + len = crypto_akcipher_maxsize(tfm); > + info->key_size = len * 8; > + info->max_data_size = len; > + info->max_sig_size = len; > + info->max_enc_size = len; > + info->max_dec_size = len; If len > UINT16_MAX, should UINT16_MAX be reported as the max size? Similar question for len*8 and key_size. -- Mat Martineau Intel OTC