From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932748AbcGHPWN (ORCPT ); Fri, 8 Jul 2016 11:22:13 -0400 Received: from mga03.intel.com ([134.134.136.65]:65192 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932703AbcGHPWA (ORCPT ); Fri, 8 Jul 2016 11:22:00 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,330,1464678000"; d="scan'208";a="731463403" Subject: Re: [PATCH v8 6/6] crypto: AF_ALG - add support for key_id To: Mat Martineau References: <146672252642.23101.15972023870303797249.stgit@tstruk-mobl1.ra.intel.com> <146672255872.23101.10938182451423661314.stgit@tstruk-mobl1.ra.intel.com> Cc: dhowells@redhat.com, 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: <783d7868-6aae-40da-5df6-6e41ca2284fc@intel.com> Date: Fri, 8 Jul 2016 08:21:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mat, On 07/06/2016 12:38 PM, Mat Martineau wrote: >> So it looks like the only thing that we need to return to the user in >> this case is the return code. Do you agree? > > The way verify_signature is implemented today, the only output is the > return code. For verify, maybe no read is required (just sendmsg() and > check the return code). > > But this isn't the extent of the problem: verify_signature needs both > the signature to be verified and the expected hash as inputs. How is the > expected hash provided? Would you include it as a cmsg header? > ALG_OP_VERIFY should have consistent inputs and outputs whether the key > was set with ALG_SET_KEY_ID or ALG_SET_KEY. The signature of verify_signature() is quite different from the other new public key handlers, i.e. create_signature(), encrypt_blob(), and decrypt_blob(). For verify_signature() we need the following parameters: encrypted src, hash function to use, expected digest. The expected digest could be optional if we would modify the verify_signature() to return the decrypted buffer. I think the best solution for now would be to just return -ENOPROTOOPT for verify_signature in SET_KEY_ID mode. All the four operations will be supported in the SET_KEY mode and all but verify_signature() will be supported in the SET_KEY_ID mode. This can added later if we will find a way to pass all parameters in a consistent way. What do you think? If you are ok with that I will send a new version soon. Thanks, -- TS