[PATCH 4/5] hwrng: core - Drop current rng in set_current_rng

2014-12-22 Thread Herbert Xu
Rather than having callers of set_current_rng call drop_current_rng, we can do it directly in set_current_rng. Signed-off-by: Herbert Xu --- drivers/char/hw_random/core.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_ran

[PATCH 5/5] hwrng: core - Move hwrng_init call into set_current_rng

2014-12-22 Thread Herbert Xu
We always do hwrng_init in set_current_rng. In fact, our current reference count system relies on this. So make this explicit by moving hwrng_init into set_current_rng. Signed-off-by: Herbert Xu --- drivers/char/hw_random/core.c | 30 -- 1 file changed, 16 insert

[PATCH 3/5] hwrng: core - Do not register device opportunistically

2014-12-22 Thread Herbert Xu
Currently we only register the device when a valid RNG is added. However the way it's done is buggy because we test whether there is a current RNG to determine whether we need to register. As the current RNG may be missing due to a reinitialisation error this can lead to a reregistration of the de

[PATCH 2/5] hwrng: core - Fix current_rng init/cleanup race yet again

2014-12-22 Thread Herbert Xu
The kref solution is still buggy because we were only focusing on the register/unregister race. The same race affects the setting of current_rng through sysfs. This patch fixes it by using kref_get_unless_zero. Signed-off-by: Herbert Xu --- drivers/char/hw_random/core.c | 14 +++---

[PATCH 1/5] hwrng: core - Use struct completion for cleanup_done

2014-12-22 Thread Herbert Xu
There is no point in doing a manual completion for cleanup_done when struct completion fits in perfectly. Signed-off-by: Herbert Xu --- drivers/char/hw_random/core.c | 12 +++- include/linux/hw_random.h |3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dr

[0/5] hwrng: Fix kref warning and underlying bugs

2014-12-22 Thread Herbert Xu
On Mon, Dec 22, 2014 at 07:09:56PM -0800, Fengguang Wu wrote: > Greetings, > > 0day kernel testing robot got the below dmesg and the first bad commit is Sigh, looks like more work is needed on this. Here is a series of patches that should fix this along with the underlying issue exposed by it an

Using separate initcall level for crypto subsystem

2014-12-22 Thread Marcel Holtmann
Hi, we wanted to add some crypto selftests to the Bluetooth subsystem that checks our usage of the crypto handling we use for Bluetooth Low Energy Legacy Pairing and Secure Connections. Since the Crypto subsystem and Bluetooth subsystem both use subsys_initcall that goes horrible wrong when ru

Re: [PATCH v5 REPOST 0/6] fix hw_random stuck

2014-12-22 Thread Herbert Xu
On Mon, Dec 08, 2014 at 04:50:34PM +0800, Amos Kong wrote: > When I hotunplug a busy virtio-rng device or try to access > hwrng attributes in non-smp guest, it gets stuck. > > My hotplug tests: > > | test 0: > | hotunplug rng device from qemu monitor > | > | test 1: > | guest) # dd if=/dev/hw

Re: [PATCH] crypto: qat - add support for cbc(aes) ablkcipher

2014-12-22 Thread Herbert Xu
On Mon, Dec 08, 2014 at 12:08:49PM -0800, Tadeusz Struk wrote: > Add support for cbc(aes) ablkcipher. > > Signed-off-by: Tadeusz Struk > Acked-by: Bruce W. Allan Both qat patches applied. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/

Re: [PATCH v3] crypto: algif - Mark sgl end at the end of data

2014-12-22 Thread Herbert Xu
On Mon, Dec 08, 2014 at 12:03:42PM -0800, Tadeusz Struk wrote: > Hi, > algif_skcipher sends 127 sgl buffers for encryption regardless of how > many buffers acctually have data to process, where the few first with > valid len and the rest with zero len. This is not very eficient. > This patch marks

Re: [PATCH v5 2/8] crypto: AF_ALG: add setsockopt for auth tag size

2014-12-22 Thread Herbert Xu
On Sun, Dec 07, 2014 at 11:21:42PM +0100, Stephan Mueller wrote: > Use setsockopt on the tfm FD to provide the authentication tag size for > an AEAD cipher. This is achieved by adding a callback function which is > intended to be used by the AEAD AF_ALG implementation. > > The optlen argument of t

Re: crypto: ablkcipher - fixed style errors in ablkcipher.c

2014-12-22 Thread Herbert Xu
On Fri, Dec 05, 2014 at 02:06:16PM +0900, Joshua I. James wrote: > From: "Joshua I. James" > > Fixed style errors reported by checkpatch. > > WARNING: Missing a blank line after declarations > + u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK); > + return max(sta

Re: [RESEND][PATCH] crypto: drbg - panic on continuous self test error

2014-12-22 Thread Herbert Xu
On Fri, Dec 05, 2014 at 10:40:21PM +0100, Stephan Mueller wrote: > This patch adds a panic if the FIPS 140-2 self test error failed. > Note, that entire code is only executed with fips_enabled (i.e. when the > kernel is booted with fips=1. It is therefore not executed for 99.9% of > all user base.

Re: Resend: [PATCH] CRYPTO: atmel_sha: remove unused shash fallback instance

2014-12-22 Thread Herbert Xu
On Fri, Dec 05, 2014 at 01:18:57AM +0100, Svenning Sørensen wrote: > [Sorry about the messed up tabs and line wraps in first post; > I hope I managed to tame TB this time around] > > CRYPTO: atmel_sha: remove unused shash fallback instance. > > The fallback is never used, so there is no point in

Re: [PATCH] crypto: af_alg: fix backlog handling

2014-12-22 Thread Herbert Xu
On Fri, Dec 19, 2014 at 01:36:08PM +0100, Rabin Vincent wrote: > If a request is backlogged, it's complete() handler will get called > twice: once with -EINPROGRESS, and once with the final error code. > > af_alg's complete handler, unlike other users, does not handle the > -EINPROGRESS but instea

Re: [PATCH v5 5/8] crypto: AF_ALG: add user space interface for RNG

2014-12-22 Thread Herbert Xu
On Sun, Dec 07, 2014 at 11:23:48PM +0100, Stephan Mueller wrote: > Allow user space to seed / reset the RNG via a setsockopt. > > This patch reuses alg_setkey to copy data into the kernel. The > alg_setkey is now used for two mechanisms: setkey and seeding. > The function is extended by the provid

Re: [PATCH v5 3/8] crypto: AF_ALG: add AEAD support

2014-12-22 Thread Herbert Xu
On Sun, Dec 07, 2014 at 11:22:30PM +0100, Stephan Mueller wrote: > > +static inline bool aead_sufficient_data(struct aead_ctx *ctx) > +{ > + unsigned as = crypto_aead_authsize(crypto_aead_reqtfm(&ctx->aead_req)); > + > + return (ctx->used >= (ctx->aead_assoclen + ctx->enc ? : as )); Is thi