From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753560AbbFQCca (ORCPT ); Tue, 16 Jun 2015 22:32:30 -0400 Received: from mga02.intel.com ([134.134.136.20]:25311 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751039AbbFQCcX (ORCPT ); Tue, 16 Jun 2015 22:32:23 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,629,1427785200"; d="scan'208";a="744842990" Message-ID: <5580DC30.4030301@intel.com> Date: Tue, 16 Jun 2015 19:32:16 -0700 From: Tadeusz Struk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: David Howells CC: herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org, keescook@chromium.org, jwboyer@redhat.com, smueller@chronox.de, richard@nod.at, steved@redhat.com, qat-linux@intel.com, linux-crypto@vger.kernel.org, james.l.morris@oracle.com, jkosina@suse.cz, zohar@linux.vnet.ibm.com, davem@davemloft.net, vgoyal@redhat.com Subject: Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation References: <20150616173101.1248.55033.stgit@tstruk-mobl1> <20150616173050.1248.21847.stgit@tstruk-mobl1> <18687.1434492657@warthog.procyon.org.uk> In-Reply-To: <18687.1434492657@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 Hi David, On 06/16/2015 03:10 PM, David Howells wrote: >> +static int _rsa_sign(const struct rsa_key *key, MPI s, MPI m) >> > +{ >> > + /* (1) Validate 0 <= m < n */ >> > + if (mpi_cmp_ui(m, 0) < 0 || mpi_cmp(m, key->n) >= 0) >> > + return -EINVAL; > Why -EINVAL not -EBADMSG? I thought that -EBADMSG was mainly used for authenticated ciphers in case when verification of auth data fails. Since this are input params I thought that -EINVAL would be more appropriate. I can change it to -EBADMSG, no problem. Herbert, what do you think?