[PATCH v2 2/2] crypto: af_alg - add async support to algif_aead

2016-02-01 Thread Tadeusz Struk
Following the async change for algif_skcipher this patch adds similar async read to algif_aead. changes in v2: - change internal data structures from fixed size arrays, limited to RSGL_MAX_ENTRIES, to linked list model with no artificial limitation. - use sock_kmalloc instead of kmalloc for

[PATCH v2 1/2] crypto: aead - move aead_request_cast helper to aead.h

2016-02-01 Thread Tadeusz Struk
Move the helper function to common header for everybody to use. changes in v2: - move the helper to crypto/internal/aead.h instead of crypto/aead.h Signed-off-by: Tadeusz Struk --- drivers/crypto/atmel-aes.c |6 -- include/crypto/internal/aead.h |6

Re: [v3 PATCH 1/3] crypto: algif_skcipher - Do not assume that req is unchanged

2016-02-01 Thread Tadeusz Struk
Hi Herbert, On 02/01/2016 05:08 AM, Herbert Xu wrote: > @@ -509,37 +498,42 @@ static int skcipher_recvmsg_async(struct socket *sock, > struct msghdr *msg, > { > struct sock *sk = sock->sk; > struct alg_sock *ask = alg_sk(sk); > + struct sock *psk = ask->parent; > + struct

Re: [PATCH v1] crypto: ccp - Limit the amount of information exported

2016-02-01 Thread Tom Lendacky
On 02/01/2016 08:35 AM, Herbert Xu wrote: > On Fri, Jan 29, 2016 at 12:45:14PM -0600, Tom Lendacky wrote: >> Since the exported information can be exposed to user-space, instead of >> exporting the entire request context only export the minimum information >> needed. >> >> Cc:

[PATCH 2/2] rng: pic32-rng: Add PIC32 RNG hardware driver

2016-02-01 Thread Joshua Henderson
Add support for the hardware pseudo and true random number generator peripheral found on PIC32. Signed-off-by: Joshua Henderson Signed-off-by: Purna Chandra Mandal --- drivers/char/hw_random/Kconfig | 13 +++

Re: [PATCH 4.3.y] crypto: fix test vector for rsa

2016-02-01 Thread Greg KH
On Wed, Jan 13, 2016 at 08:57:40PM -0800, Tadeusz Struk wrote: > Hi, > After the fix to the asn1_decoder in commit: 0d62e9dd > "ASN.1: Fix non-match detection failure on data overrun" > the rsa algorithm is failing to register in 4.3 stable kernels with > error: "alg: rsa: test failed on vector 4,

Re: [PATCH 0/3] Introduce the cypto engine framework

2016-02-01 Thread Baolin Wang
On 1 February 2016 at 22:33, Herbert Xu wrote: > On Tue, Jan 26, 2016 at 08:25:37PM +0800, Baolin Wang wrote: >> Now block cipher engines need to implement and maintain their own >> queue/thread >> for processing requests, moreover currently helpers provided for only

Re: [PATCH v2 1/4] crypto x86/sha1_mb: Fix load failure

2016-02-01 Thread Herbert Xu
On Wed, Jan 27, 2016 at 05:08:35PM +0800, Rui Wang wrote: > > +static int sha1_mb_async_import(struct ahash_request *req, const void *in) > +{ > + struct ahash_request *mcryptd_req = ahash_request_ctx(req); > + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); > + struct sha1_mb_ctx

Crypto Fixes for 4.5

2016-02-01 Thread Herbert Xu
Hi Linus: This push fixes the following issues: API: * algif_hash needs to wait for init operations to complete. * The has_key setting for shash was always true. Algorithms: * Add missing selections of CRYPTO_HASH. * Fix pkcs7 authentication. Drivers: * Fix stack alignment bug in

Re: [PATCH v2 3/4] crypto: algif_hash - wait for crypto_ahash_init() to complete

2016-02-01 Thread Herbert Xu
On Wed, Jan 27, 2016 at 05:08:37PM +0800, Rui Wang wrote: > hash_sendmsg/sendpage() need to wait for the completion > of crypto_ahash_init() otherwise it can cause panic. > > Signed-off-by: Rui Wang Applied to crypto. -- Email: Herbert Xu

Re: [PATCH v2 2/4] crypto: mcryptd - Fix load failure

2016-02-01 Thread Herbert Xu
On Wed, Jan 27, 2016 at 05:08:36PM +0800, Rui Wang wrote: > mcryptd_create_hash() fails by returning -EINVAL, causing any > driver using mcryptd to fail to load. It is because it needs > to set its statesize properly. > > Signed-off-by: Rui Wang Applied. -- Email: Herbert

Re: [PATCH v2] crypto: atmel-sha: fix algorihtm registration

2016-02-01 Thread Herbert Xu
On Fri, Jan 29, 2016 at 05:04:02PM +0100, Cyrille Pitchen wrote: > This patch implements the missing .import() and .export() mandatory > hooks for asynchronous hash algorithms. It also sets the relevant, non > zero, value for the .statesize field when declaring the supported SHA > algorithms.

Re: [PATCH] crypto: atmel-aes - remove calls of clk_prepare() from atomic contexts

2016-02-01 Thread Herbert Xu
On Fri, Jan 29, 2016 at 05:53:33PM +0100, Cyrille Pitchen wrote: > clk_prepare()/clk_unprepare() must not be called within atomic context. > > This patch calls clk_prepare() once for all from atmel_aes_probe() and > clk_unprepare() from atmel_aes_remove(). > > Then calls of

Re: [PATCH v2 4/4] crypto: testmgr - Add a test case for import()/export()

2016-02-01 Thread Herbert Xu
On Wed, Jan 27, 2016 at 05:08:38PM +0800, Rui Wang wrote: > > diff --git a/crypto/testmgr.h b/crypto/testmgr.h > index da0a8fd..451e7eb 100644 > --- a/crypto/testmgr.h > +++ b/crypto/testmgr.h > @@ -44,6 +44,7 @@ struct hash_testvec { > unsigned short psize; > unsigned char np; >

Re: [PATCH] crypto: aead - move aead_request_cast helper to aead.h

2016-02-01 Thread Herbert Xu
On Wed, Jan 27, 2016 at 02:09:16PM -0800, Tadeusz Struk wrote: > Move the helper function to common header for everybody to use. > > Signed-off-by: Tadeusz Struk This should go into internal/aead.h if at all. Longer term we should look for ways to do away with direct

[PATCH 3/6] crypto: skcipher - Fix driver name helper

2016-02-01 Thread Herbert Xu
The helper crypto_skcipher_driver_name was returning the alg name and not the driver name. Signed-off-by: Herbert Xu --- include/crypto/skcipher.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crypto/skcipher.h

[PATCH 2/6] crypto: doc - Use ahash

2016-02-01 Thread Herbert Xu
This patch replaces the crypto_hash example in api-intro.txt with crypto_ahash. Signed-off-by: Herbert Xu --- Documentation/crypto/api-intro.txt | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git

[PATCH 1/6] crypto: tcrypt - Use ahash

2016-02-01 Thread Herbert Xu
This patch removes the last user of the obsolete crypto_hash interface, tcrypt, by simply switching it over to ahash. In fact it already has all the code there so it's just a matter of calling the ahash speed test code with the right mask. Signed-off-by: Herbert Xu

[PATCH 6/6] crypto: hash - Remove crypto_hash interface

2016-02-01 Thread Herbert Xu
This patch removes all traces of the crypto_hash interface, now that everyone has switched over to shash or ahash. Signed-off-by: Herbert Xu --- Documentation/DocBook/crypto-API.tmpl | 13 - crypto/ahash.c| 18 -- crypto/shash.c

[PATCH 5/6] staging: lustre: Use ahash

2016-02-01 Thread Herbert Xu
This patch replaces uses of the long obsolete hash interface with ahash. Signed-off-by: Herbert Xu --- drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c | 92 +++--- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git

[PATCH 4/6] crypto: hash - Add helpers to return alg and driver names

2016-02-01 Thread Herbert Xu
This patch adds helpers to retrieve the alg name and driver name of crypto_shash and crypto_ahash objects. Signed-off-by: Herbert Xu --- include/crypto/hash.h | 20 1 file changed, 20 insertions(+) diff --git a/include/crypto/hash.h

[v3 PATCH 0/3] crypto: algif_skcipher - fixes after skcipher conversion

2016-02-01 Thread Herbert Xu
On Thu, Jan 28, 2016 at 07:23:54AM -0800, Tadeusz Struk wrote: > Hi Herbert, > While testing the algif_aead async patch, I have rerun the async > algif_skcipher tests and I have found some problems. > There are three different issues around algif_skcipher and skcipher. > Two are skcipher

[PATCH 0/6] crypto: hash - Remove crypto_hash interface

2016-02-01 Thread Herbert Xu
This series of patches removes the last references to crypto_hash and finally deletes the obsolete interface. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from

[v3 PATCH 2/3] crypto: algif_skcipher - Do not dereference ctx without socket lock

2016-02-01 Thread Herbert Xu
Any access to non-constant bits of the private context must be done under the socket lock, in particular, this includes ctx->req. This patch moves such accesses under the lock, and fetches the tfm from the parent socket which is guaranteed to be constant, rather than from ctx->req.

[v3 PATCH 1/3] crypto: algif_skcipher - Do not assume that req is unchanged

2016-02-01 Thread Herbert Xu
The async path in algif_skcipher assumes that the crypto completion function will be called with the original request. This is not necessarily the case. In fact there is no need for this anyway since we already embed information into the request with struct skcipher_async_req. This patch adds a

[v3 PATCH 3/3] crypto: algif_skcipher - Do not set MAY_BACKLOG on the async path

2016-02-01 Thread Herbert Xu
The async path cannot use MAY_BACKLOG because it is not meant to block, which is what MAY_BACKLOG does. On the other hand, both the sync and async paths can make use of MAY_SLEEP. Signed-off-by: Herbert Xu --- crypto/algif_skcipher.c |5 +++-- 1 file changed,

[PATCH] crypto: user - lock crypto_alg_list on alg dump

2016-02-01 Thread Mathias Krause
We miss to take the crypto_alg_sem semaphore when traversing the crypto_alg_list for CRYPTO_MSG_GETALG dumps. This allows a race with crypto_unregister_alg() removing algorithms from the list while we're still traversing it, thereby leading to a use-after-free as show below: [ 3482.071639]

Re: [PATCH] crypto: aead - move aead_request_cast helper to aead.h

2016-02-01 Thread Herbert Xu
On Mon, Feb 01, 2016 at 07:46:59AM -0800, Tadeusz Struk wrote: > > Yes, I though about it, but I followed skcipher. The skcipher_request_cast() > helper is in crypto/skcipher.h not in crypto/internal/skcipher.h > Shouldn't this be consistent? Yes it should be moved into internal as well. Cheers,

Re: [PATCH 4.3.y] crypto: fix test vector for rsa

2016-02-01 Thread Herbert Xu
On Mon, Feb 01, 2016 at 04:52:53PM -0800, Greg KH wrote: > On Wed, Jan 13, 2016 at 08:57:40PM -0800, Tadeusz Struk wrote: > > Hi, > > After the fix to the asn1_decoder in commit: 0d62e9dd > > "ASN.1: Fix non-match detection failure on data overrun" > > the rsa algorithm is failing to register in

Re: [PATCH v1] crypto: ccp - Limit the amount of information exported

2016-02-01 Thread Herbert Xu
On Fri, Jan 29, 2016 at 12:45:14PM -0600, Tom Lendacky wrote: > Since the exported information can be exposed to user-space, instead of > exporting the entire request context only export the minimum information > needed. > > Cc: # 3.14.x- > Signed-off-by: Tom Lendacky

Re: [RFC 1/2] crypto: tcrypt - Add acipher bandwidth tests support

2016-02-01 Thread Herbert Xu
Catalin Vasile wrote: > Signed-off-by: Catalin Vasile Please give a description of what your patch does here. > + case 600: > + band_acipher("ecb(aes)", ENCRYPT, sec, NULL, 0, > +

Re: [PATCH] fix out of bound read in __test_aead()

2016-02-01 Thread Herbert Xu
On Fri, Jan 29, 2016 at 02:10:09PM +0100, Jerome Marchand wrote: > __test_aead() reads MAX_IVLEN bytes from template[i].iv, but the > actual length of the initialisation vector can be shorter. > The length of the IV is already calculated earlier in the > function. Let's just reuses that. > This

Re: [PATCH 0/3] Introduce the cypto engine framework

2016-02-01 Thread Herbert Xu
On Tue, Jan 26, 2016 at 08:25:37PM +0800, Baolin Wang wrote: > Now block cipher engines need to implement and maintain their own queue/thread > for processing requests, moreover currently helpers provided for only the > queue > itself (in crypto_enqueue_request() and crypto_dequeue_request()) but

Re: [patch] crypto: keywrap - memzero the correct memory

2016-02-01 Thread Herbert Xu
On Sat, Jan 30, 2016 at 05:38:28PM +0300, Dan Carpenter wrote: > We're clearing the wrong memory. The memory corruption is likely > harmless because we weren't going to use that stack memory again but not > zeroing is a potential information leak. > > Fixes: e28facde3c39 ('crypto: keywrap - add

Re: [PATCH v1] crypto: ccp - Limit the amount of information exported

2016-02-01 Thread Herbert Xu
On Fri, Jan 29, 2016 at 12:45:14PM -0600, Tom Lendacky wrote: > Since the exported information can be exposed to user-space, instead of > exporting the entire request context only export the minimum information > needed. > > Cc: # 3.14.x- > Signed-off-by: Tom Lendacky

Re: [PATCH] fix out of bound read in __test_aead()

2016-02-01 Thread Jerome Marchand
On 02/01/2016 03:26 PM, Herbert Xu wrote: > On Fri, Jan 29, 2016 at 02:10:09PM +0100, Jerome Marchand wrote: >> __test_aead() reads MAX_IVLEN bytes from template[i].iv, but the >> actual length of the initialisation vector can be shorter. >> The length of the IV is already calculated earlier in

Re: [PATCH] crypto: aead - move aead_request_cast helper to aead.h

2016-02-01 Thread Tadeusz Struk
On 02/01/2016 01:46 AM, Herbert Xu wrote: >> Move the helper function to common header for everybody to use. >> > >> > Signed-off-by: Tadeusz Struk > This should go into internal/aead.h if at all. Yes, I though about it, but I followed skcipher. The

[PATCH 02/11] crypto: sunxi-ss: prevent compilation on 64-bit

2016-02-01 Thread Andre Przywara
The driver for the sunxi-ss crypto engine is not entirely 64-bit safe, compilation on arm64 spits some warnings. The proper fix was deemed to involved [1], so since 64-bit SoCs won't have this IP block we just disable this driver for 64-bit. [1]: