From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932290AbcELRBc (ORCPT ); Thu, 12 May 2016 13:01:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:13593 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450AbcELRBa (ORCPT ); Thu, 12 May 2016 13:01:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,610,1455004800"; d="scan'208";a="701167077" Date: Thu, 12 May 2016 10:01:05 -0700 (PDT) From: Mat Martineau X-X-Sender: mjmartin@mjmartin-mac01.local To: David Howells cc: Mat Martineau , 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: <25139.1463048363@warthog.procyon.org.uk> Message-ID: References: <20160511142152.4743.14414.stgit@warthog.procyon.org.uk> <20160511142230.4743.12500.stgit@warthog.procyon.org.uk> <25139.1463048363@warthog.procyon.org.uk> User-Agent: Alpine 2.20 (OSX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 May 2016, David Howells wrote: > Mat Martineau wrote: > >>> + 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. > > key_size is 32 bits, but the other sizes are all 16 bits, so you would need a > 524288-bit key to exceed their capacity. I'm not sure that's likely anytime > soon, but should I just make all the sizes 32-bit anyway? Given that cryto_akcipher_maxsize() returns an int and keyctl_pkey_query is part of the userspace API, I support bumping the sizes to 32-bit. -- Mat Martineau Intel OTC