From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756978AbbFPWLN (ORCPT ); Tue, 16 Jun 2015 18:11:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39354 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753132AbbFPWLH (ORCPT ); Tue, 16 Jun 2015 18:11:07 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20150616173101.1248.55033.stgit@tstruk-mobl1> References: <20150616173101.1248.55033.stgit@tstruk-mobl1> <20150616173050.1248.21847.stgit@tstruk-mobl1> To: Tadeusz Struk Cc: dhowells@redhat.com, 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18686.1434492657.1@warthog.procyon.org.uk> Date: Tue, 16 Jun 2015 23:10:57 +0100 Message-ID: <18687.1434492657@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tadeusz Struk 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? David