Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755259AbcC3RZK (ORCPT ); Wed, 30 Mar 2016 13:25:10 -0400 Received: from mga14.intel.com ([192.55.52.115]:10495 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbcC3RZI (ORCPT ); Wed, 30 Mar 2016 13:25:08 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,417,1455004800"; d="scan'208";a="944631078" Subject: Re: [PATCH v3 7/7] crypto: AF_ALG - add support for key_id To: David Howells References: <20160330005734.25410.28829.stgit@tstruk-mobl1> <20160330005649.25410.70508.stgit@tstruk-mobl1> <14284.1459355506@warthog.procyon.org.uk> Cc: herbert@gondor.apana.org.au, smueller@chronox.de, linux-api@vger.kernel.org, marcel@holtmann.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, dwmw2@infradead.org, davem@davemloft.net From: Tadeusz Struk Message-ID: <56FC0AAF.3000404@intel.com> Date: Wed, 30 Mar 2016 10:19:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <14284.1459355506@warthog.procyon.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 986 Lines: 26 Hi David, On 03/30/2016 09:31 AM, David Howells wrote: >> + keyring = request_key(&key_type_asymmetric, key_name, NULL); >> > + >> > + err = -ENOKEY; >> > + if (IS_ERR(keyring)) >> > + goto out; >> > + >> > + pkey = keyring->payload.data[asym_crypto]; > NAK. This is liable to crash in future. You may not assume that you know > what keyring->payload.data[asym_crypto] points to. > > You may not use struct public_key outside of crypto/asymmetric_key/. It's the > internal data of the software subtype. I'll move it out of the global header > to remove the temptation;-). > > You must use accessor functions such as verify_signature(). Feel free to add > further accessor functions such as query_asym_capabilities(), > create_signature(), encrypt_blob() and decrypt_blob() or something like that. Thanks for your response. I thought that the public_key_query_sw_key(pkey) check was enough for now. I'll remove public_key stuff from af_alg and add the accessors. Thanks, -- TS