Re: [PATCH] Re: Broken userspace crypto in linux-4.1.18

2016-02-26 Thread Milan Broz
On 02/24/2016 06:12 PM, Greg KH wrote: > On Wed, Feb 24, 2016 at 09:54:48AM +0100, Milan Broz wrote: >> On 02/24/2016 09:32 AM, Jiri Slaby wrote: + af_alg_release_parent(sk); >>> >>> and this occurs to me like a double release? >> >> yes, my copy&paste mistake. > > Which is why I want the re

Re: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer

2016-02-26 Thread David Howells
Andrew Zaborowski wrote: > Without overhauling akcipher you could modify pkcs1pad so that sign > takes the hash as input, adds the DER struct in front of it to build > the signature, and the verify operation could at most check that the > DER string matches the hash type and return the hash. But

[PATCH 1/4] crypto: algif_skcipher - Require setkey before accept(2)

2016-02-26 Thread Milan Broz
From: Herbert Xu commit dd504589577d8e8e70f51f997ad487a4cb6c026f upstream. Some cipher implementations will crash if you try to use them without calling setkey first. This patch adds a check so that the accept(2) call will fail with -ENOKEY if setkey hasn't been done on the

[PATCH 2/4] crypto: algif_skcipher - Add nokey compatibility path

2016-02-26 Thread Milan Broz
From: Herbert Xu commit a0fa2d037129a9849918a92d91b79ed6c7bd2818 upstream. This patch adds a compatibility path to support old applications that do acept(2) before setkey. Cc: sta...@vger.kernel.org Signed-off-by: Herbert Xu --- crypto/algif_skcipher.c | 149 ++

[PATCH 3/4] crypto: algif_skcipher - Remove custom release parent function

2016-02-26 Thread Milan Broz
From: Herbert Xu commit d7b65aee1e7b4c87922b0232eaba56a8a143a4a0 upstream. This patch removes the custom release parent function as the generic af_alg_release_parent now works for nokey sockets too. Cc: sta...@vger.kernel.org Signed-off-by: Herbert Xu --- crypto/algif_skci

[PATCH 4/4] crypto: algif_skcipher - Fix race condition in skcipher_check_key

2016-02-26 Thread Milan Broz
From: Herbert Xu commit 1822793a523e5d5730b19cc21160ff1717421bc8 upstream. We need to lock the child socket in skcipher_check_key as otherwise two simultaneous calls can cause the parent socket to be freed. Cc: sta...@vger.kernel.org Signed-off-by: Herbert Xu --- crypto/al

[PATCH 1/2] lib/mpi: avoid assembler warning

2016-02-26 Thread Arnd Bergmann
A wrapper around the umull assembly instruction might reuse the input register as an output, which is undefined on some ARM machines, as pointed out by this assembler warning: CC lib/mpi/generic_mpih-mul1.o /tmp/ccxJuxIy.s: Assembler messages: /tmp/ccxJuxIy.s:53: rdhi, rdlo and rm must all

[PATCH 2/2] lib/mpi: use "static inline" instead of "extern inline"

2016-02-26 Thread Arnd Bergmann
When we use CONFIG_PROFILE_ALL_BRANCHES, every 'if()' introduces a static variable, but that is not allowed in 'extern inline' functions: mpi-inline.h:116:204: warning: '__f' is static but declared in inline function 'mpihelp_sub' which is not static mpi-inline.h:113:184: warning: '__f' i

Re: [PATCH] X.509: Fix test for self-signed certificate

2016-02-26 Thread Michal Marek
On 2016-02-24 15:54, David Howells wrote: > Hi Michal, > > I have the attached patch already in my queue. > > David > --- > commit d19fcb825912c67e09e0575b95accaa42899e07f > Author: David Howells > Date: Wed Feb 24 14:37:54 2016 + > > X.509: Don't treat self-signed keys specially Hi

Re: [PATCH 2/2] crypto: remove padding logic from rsa.c

2016-02-26 Thread David Howells
Tadeusz Struk wrote: > + if (memcmp(sig->digest, output, sig->digest_size) || I've added " != 0" after the memcmp(). > + req->dst_len != sig->digest_size) > + ret = -EBADMSG; Btw, this has to be -EKEYREJECTED; -EBADMSG would indicate that the con

Re: [PATCH 2/2] crypto: remove padding logic from rsa.c

2016-02-26 Thread David Howells
Tadeusz Struk wrote: > + if (memcmp(sig->digest, output, sig->digest_size) || > + req->dst_len != sig->digest_size) You must always do the size check first! David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to m

[PATCH 1/3] crypto: Add hash param to pkcs1pad

2016-02-26 Thread David Howells
From: Tadeusz Struk This adds hash param to pkcs1pad. The pkcs1pad template can work with or without the hash. When hash param is provided then the verify operation will also verify the output against the known digest. Signed-off-by: Tadeusz Struk Signed-off-by: David Howells --- crypto/rsa-

[PATCH 0/3] KEYS: Use crypto rsa pkcs1pad module for software public keys

2016-02-26 Thread David Howells
Here's a set of patches that change the software public key asymmetric key subtype to use the RSA pkcs1pad module in the crypto layer. I've merged together mine and Tadeusz's patches. I have not included Tadeusz's original three patches that converted to using the raw rsa module in this set, but

[PATCH 1/3] crypto: Add hash param to pkcs1pad

2016-02-26 Thread David Howells
From: Tadeusz Struk This adds hash param to pkcs1pad. The pkcs1pad template can work with or without the hash. When hash param is provided then the verify operation will also verify the output against the known digest. Signed-off-by: Tadeusz Struk Signed-off-by: David Howells --- crypto/rsa-

[PATCH 3/3] X.509: Make algo identifiers text instead of enum

2016-02-26 Thread David Howells
Make the identifier public key and digest algorithm fields text instead of enum. Signed-off-by: David Howells --- crypto/asymmetric_keys/mscode_parser.c| 14 +++--- crypto/asymmetric_keys/pkcs7_parser.c | 18 - crypto/asymmetric_keys/pkcs7_verify.c |8

[PATCH 2/3] akcipher: Move the RSA DER encoding check to the crypto layer

2016-02-26 Thread David Howells
Move the RSA EMSA-PKCS1-v1_5 encoding from the asymmetric-key public_key subtype to the rsa crypto module's pkcs1pad template. This means that the public_key subtype no longer has any dependencies on public key type. To make this work, the following changes have been made: (1) The rsa pkcs1pad

Re: [PATCH] Re: Broken userspace crypto in linux-4.1.18

2016-02-26 Thread Sasha Levin
On 02/26/2016 06:25 AM, Milan Broz wrote: > On 02/24/2016 06:12 PM, Greg KH wrote: >> On Wed, Feb 24, 2016 at 09:54:48AM +0100, Milan Broz wrote: >>> On 02/24/2016 09:32 AM, Jiri Slaby wrote: > + af_alg_release_parent(sk); and this occurs to me like a double release? >>> >>> yes, my c

Re: Is a crypto_ahash_init required before invoking crypto_ahash_import?

2016-02-26 Thread Herbert Xu
On Thu, Feb 25, 2016 at 04:26:54PM -0600, Tom Lendacky wrote: > > Thanks for the clarification Herbert. I'll send in a patch to perform > the memset during the import. I know it's late in the cycle, but will > you be able to apply it to the current cryptodev-2.6 tree which contains > the ccp impo