Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
On 06/16/2015 07:36 PM, Herbert Xu wrote: > The existing crypto/asymmetric_key errno scheme doesn't really > mesh in with the rest of crypto. So you'll just have to pick one > scheme and stick with it. > > I don't really mind either way as long as the error codes are > unique and meaningful. So

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Herbert Xu
On Tue, Jun 16, 2015 at 07:32:16PM -0700, Tadeusz Struk wrote: > > 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

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
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

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread David Howells
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 -- To unsubscribe from this list: send

[PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
Add a new rsa generic SW implementation. This implements only cryptographic primitives. Signed-off-by: Tadeusz Struk --- crypto/Kconfig|7 + crypto/Makefile |8 + crypto/rsa.c | 315 +

[PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
Add a new rsa generic SW implementation. This implements only cryptographic primitives. Signed-off-by: Tadeusz Struk tadeusz.st...@intel.com --- crypto/Kconfig|7 + crypto/Makefile |8 + crypto/rsa.c | 315

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread David Howells
Tadeusz Struk tadeusz.st...@intel.com 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 -- To unsubscribe from this

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
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

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Herbert Xu
On Tue, Jun 16, 2015 at 07:32:16PM -0700, Tadeusz Struk wrote: 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

Re: [PATCH RFC v7 2/3] crypto: rsa: add a new rsa generic implementation

2015-06-16 Thread Tadeusz Struk
On 06/16/2015 07:36 PM, Herbert Xu wrote: The existing crypto/asymmetric_key errno scheme doesn't really mesh in with the rest of crypto. So you'll just have to pick one scheme and stick with it. I don't really mind either way as long as the error codes are unique and meaningful. So I