[PATCH net v5 2/3] esp: select CRYPTO_SEQIV

2020-06-15 Thread Eric Biggers
From: Eric Biggers Commit f23efcbcc523 ("crypto: ctr - no longer needs CRYPTO_SEQIV") made CRYPTO_CTR stop selecting CRYPTO_SEQIV. This breaks IPsec for most users since GCM and several other encryption algorithms require "seqiv" -- and RFC 8221 lists AES-GCM as "MU

[PATCH net v5 3/3] esp, ah: modernize the crypto algorithm selections

2020-06-15 Thread Eric Biggers
From: Eric Biggers The crypto algorithms selected by the ESP and AH kconfig options are out-of-date with the guidance of RFC 8221, which lists the legacy algorithms MD5 and DES as "MUST NOT" be implemented, and some more modern algorithms like AES-GCM and HMAC-SHA256 as "MUST&

[PATCH net v5 0/3] esp, ah: improve crypto algorithm selections

2020-06-15 Thread Eric Biggers
d commit messages (added Acked-by tags, fixed a bad Fixes tag, added some more explanation to patch 3). Eric Biggers (3): esp, ah: consolidate the crypto algorithm selections esp: select CRYPTO_SEQIV esp, ah: modernize the crypto algorithm selections net/ipv4/Kconfig | 34 ++

Re: [PATCH v4 1/3] mm/slab: Use memzero_explicit() in kzfree()

2020-06-15 Thread Eric Biggers
On Mon, Jun 15, 2020 at 09:57:16PM -0400, Waiman Long wrote: > The kzfree() function is normally used to clear some sensitive > information, like encryption keys, in the buffer before freeing it back > to the pool. Memset() is currently used for the buffer clearing. However, > it is entirely possib

Re: [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 08:02:58AM +0200, Steffen Klassert wrote: > On Mon, Jun 15, 2020 at 03:13:15PM -0700, Eric Biggers wrote: > > This series consolidates and modernizes the lists of crypto algorithms > > that are selected by the IPsec kconfig options, and adds CRYPTO_SEQIV

Re: [v2 PATCH 0/3] crypto: skcipher - Add support for no chaining and partial chaining

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 09:04:44PM +1000, Herbert Xu wrote: > On Mon, Jun 15, 2020 at 11:50:28AM -0700, Eric Biggers wrote: > > > > Wouldn't it make a lot more sense to make skcipher algorithms non-chainable > > by > > default, and only opt-in the ones where c

Re: [dm-devel] [PATCH 1/4] crypto: introduce CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 11:01:31AM -0400, Mikulas Patocka wrote: > Introduce a new flag CRYPTO_ALG_ALLOCATES_MEMORY and modify dm-crypt, so > that it uses only drivers without this flag. > > If the flag is set, then the crypto driver allocates memory in its request > routine. Such drivers are not

Re: [dm-devel] [PATCH 2/4] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 11:01:58AM -0400, Mikulas Patocka wrote: > Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. > > Signed-off-by: Mikulas Patocka > > --- > crypto/adiantum.c |3 ++- > crypto/authenc.c |5 +++-- > crypto/authencesn.c |

Re: [dm-devel] [PATCH 3/4] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 11:02:20AM -0400, Mikulas Patocka wrote: > Set the flag CRYPTO_ALG_ALLOCATES_MEMORY in the crypto drivers that > allocate memory. > > Signed-off-by: Mikulas Patocka > > --- > drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c |8 +- > drivers/crypto/allwinner/sun8i-ss

Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote: > Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If > CRYPTO_TFM_REQ_MAY_SLEEP is not set, the driver must not do allocation > that sleeps. > > Signed-off-by: Mikulas Patocka I think you need to split this up p

Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-16 Thread Eric Biggers
On Tue, Jun 16, 2020 at 02:18:17PM -0400, Mikulas Patocka wrote: > > > On Tue, 16 Jun 2020, Eric Biggers wrote: > > > On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote: > > > Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If &

Re: LTP: crypto: af_alg02 regression on linux-next 20200621 tag

2020-06-23 Thread Eric Biggers
On Tue, Jun 23, 2020 at 04:40:56PM +1000, Herbert Xu wrote: > On Tue, Jun 23, 2020 at 11:53:43AM +0530, Naresh Kamboju wrote: > > > > Thanks for the investigation. > > After reverting, two test cases got PASS out of four reported failure cases. > > ltp-crypto-tests: > > * af_alg02 - still fai

Re: [PATCH] net: phy: mscc: avoid skcipher API for single block AES encryption

2020-06-24 Thread Eric Biggers
ret = aes_expandkey(&ctx, key, key_len); > + if (ret) > + return ret; > > -out: > - skcipher_request_free(req); > - crypto_free_skcipher(tfm); > - return ret; > + aes_encrypt(&ctx, hkey, input); > + memzero_explicit(&ctx, sizeof(ctx)); > + return 0; > } > Otherwise this looks good. You can add: Reviewed-by: Eric Biggers - Eric

Re: [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-26 Thread Eric Biggers
On Fri, Jun 26, 2020 at 12:16:33PM -0400, Mikulas Patocka wrote: > +/* > + * Pass these flags down through the crypto API. > + */ > +#define CRYPTO_ALG_INHERITED_FLAGS (CRYPTO_ALG_ASYNC | > CRYPTO_ALG_ALLOCATES_MEMORY) This comment is useless. How about: /* * When an algorithm uses another a

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-26 Thread Eric Biggers
On Fri, Jun 26, 2020 at 09:46:17AM -0700, Eric Biggers wrote: > On Fri, Jun 26, 2020 at 12:16:33PM -0400, Mikulas Patocka wrote: > > +/* > > + * Pass these flags down through the crypto API. > > + */ > > +#define CRYPTO_ALG_INHERITED_FLAGS (CRYPTO_ALG_ASYNC | >

Re: [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Eric Biggers
On Sun, Jun 28, 2020 at 03:04:22PM -0400, Mikulas Patocka wrote: > > > Index: linux-2.6/crypto/authenc.c > > > === > > > --- linux-2.6.orig/crypto/authenc.c 2020-06-26 17:24:03.566417000 > > > +0200 > > > +++ linux-2.6/crypto/au

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Eric Biggers
On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > Also, "seqiv" instances can be created without CRYPTO_ALG_ALLOCATES_MEMORY > > set, > > despite seqiv_aead_encrypt() allocating memory. > > This comment wasn't addressed. - Eric

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Eric Biggers
On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > cryptd_create_skcipher(), cryptd_create_hash(), cryptd_create_aead(), and > > crypto_rfc4309_create() are also missing setting the mask. > > > > pcrypt_create_aead() is missing both setting the mask and inheriting the > > f

Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Eric Biggers
On Tue, Jun 30, 2020 at 09:56:22AM -0400, Mikulas Patocka wrote: > Index: linux-2.6/crypto/cryptd.c > === > --- linux-2.6.orig/crypto/cryptd.c2020-06-29 16:03:07.346417000 +0200 > +++ linux-2.6/crypto/cryptd.c 2020-06-30 15:49:04.2

Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Eric Biggers
On Tue, Jun 30, 2020 at 01:01:16PM -0400, Mikulas Patocka wrote: > > diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c > > index 7240e8bbdebb..643f7f1cc91c 100644 > > --- a/crypto/pcrypt.c > > +++ b/crypto/pcrypt.c > > @@ -232,12 +232,15 @@ static int pcrypt_create_aead(struct crypto_template > > *tm

[PATCH 6/6] dm-crypt: don't use drivers that have CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Eric Biggers
From: Mikulas Patocka Don't use crypto drivers that have the flag CRYPTO_ALG_ALLOCATES_MEMORY set. These drivers allocate memory and thus they are unsuitable for block I/O processing. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c | 17 +++-- 1 file changed, 11 insertions

[PATCH 0/6] crypto: add CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Eric Biggers
ew template instance. - Inherit the flags in various places that were missed. - Other cleanups. Note: Mikulas's patch "crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY" still needs to be checked for cases where the flag no longer needs to be set due to the usage constraints I docu

[PATCH 3/6] crypto: algapi - introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Eric Biggers
From: Eric Biggers Introduce a new algorithm flag CRYPTO_ALG_ALLOCATES_MEMORY. If this flag is set, then the driver allocates memory in its request routine. Such drivers are not suitable for disk encryption because GFP_ATOMIC allocation can fail anytime (causing random I/O errors) and

[PATCH 2/6] crypto: algapi - use common mechanism for inheriting flags

2020-06-30 Thread Eric Biggers
From: Eric Biggers The flag CRYPTO_ALG_ASYNC is "inherited" in the sense that when a template is instantiated, the template will have CRYPTO_ALG_ASYNC set if any of the algorithms it uses has CRYPTO_ALG_ASYNC set. We'd like to add a second flag (CRYPTO_ALG_ALLOCATES_MEMORY) that

[PATCH 5/6] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Eric Biggers
: __virtio_crypto_skcipher_do_req drivers/crypto/xilinx/zynqmp-aes-gcm.c: zynqmp_aes_aead_cipher Signed-off-by: Mikulas Patocka [EB: avoid overly-long lines] Signed-off-by: Eric Biggers --- .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 12 +- .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 12 +- drivers

[PATCH 1/6] crypto: geniv - remove unneeded arguments from aead_geniv_alloc()

2020-06-30 Thread Eric Biggers
From: Eric Biggers The type and mask arguments to aead_geniv_alloc() are always 0, so remove them. Signed-off-by: Eric Biggers --- crypto/echainiv.c | 2 +- crypto/geniv.c | 7 --- crypto/seqiv.c | 2 +- include/crypto/internal/geniv.h | 2

[PATCH 4/6] crypto: algapi - remove crypto_check_attr_type()

2020-06-30 Thread Eric Biggers
From: Eric Biggers Remove crypto_check_attr_type(), since it's no longer used. Signed-off-by: Eric Biggers --- crypto/algapi.c | 15 --- include/crypto/algapi.h | 1 - 2 files changed, 16 deletions(-) diff --git a/crypto/algapi.c b/crypto/algapi.c index 24a5627

[RFC PATCH 0/9] crypto: prevent unkeyed use of keyed algorithms

2018-01-03 Thread Eric Biggers
From: Eric Biggers This series updates the crypto API to consistently prevent using keyed algorithms without setting the key. Currently this is prevented for AF_ALG but not for other crypto API users, which is very problematic for other places in the kernel where userspace can specify a hash

[RFC PATCH 1/9] crypto: hash - introduce crypto_hash_alg_has_setkey()

2018-01-03 Thread Eric Biggers
From: Eric Biggers Templates that use an shash spawn can use crypto_shash_alg_has_setkey() to determine whether the underlying algorithm requires a key or not. But there was no corresponding function for ahash spawns. Add it. Note that the new function actually has to support both shash and

[RFC PATCH 2/9] crypto: cryptd - pass through absence of ->setkey()

2018-01-03 Thread Eric Biggers
From: Eric Biggers When the cryptd template is used to wrap an unkeyed hash algorithm, don't install a ->setkey() method to the cryptd instance. This change is necessary for cryptd to keep working with unkeyed hash algorithms once we start enforcing that ->setkey() is called when p

[RFC PATCH 6/9] crypto: hash - prevent using keyed hashes without setting key

2018-01-03 Thread Eric Biggers
From: Eric Biggers Currently, almost none of the keyed hash algorithms check whether a key has been set before proceeding. Some algorithms are okay with this and will effectively just use a key of all 0's or some other bogus default. However, others will severely break, as demonstrated

[RFC PATCH 5/9] crypto: hash - annotate algorithms taking optional key

2018-01-03 Thread Eric Biggers
From: Eric Biggers We need to consistently enforce that keyed hashes cannot be used without setting the key. To do this we need a reliable way to determine whether a given hash algorithm is keyed or not. AF_ALG currently does this by checking for the presence of a ->setkey() method. Howe

[RFC PATCH 4/9] crypto: poly1305 - remove ->setkey() method

2018-01-03 Thread Eric Biggers
From: Eric Biggers Since Poly1305 requires a nonce per invocation, the Linux kernel implementations of Poly1305 don't use the crypto API's keying mechanism and instead expect the key and nonce as the first 32 bytes of the data. But ->setkey() is still defined as a stub returning

[RFC PATCH 9/9] crypto: aead - prevent using AEADs without setting key

2018-01-03 Thread Eric Biggers
From: Eric Biggers Similar to what was done for the hash API, update the AEAD API to track whether each transform has been keyed, and reject encryption/decryption if a key is needed but one hasn't been set. This isn't quite as important as the equivalent fix for the hash API bec

[RFC PATCH 3/9] crypto: mcryptd - pass through absence of ->setkey()

2018-01-03 Thread Eric Biggers
From: Eric Biggers When the mcryptd template is used to wrap an unkeyed hash algorithm, don't install a ->setkey() method to the mcryptd instance. This change is necessary for mcryptd to keep working with unkeyed hash algorithms once we start enforcing that ->setkey() is called w

[RFC PATCH 8/9] crypto: skcipher - prevent using skciphers without setting key

2018-01-03 Thread Eric Biggers
From: Eric Biggers Similar to what was done for the hash API, update the skcipher API to track whether each transform has been keyed, and reject encryption/decryption if a key is needed but one hasn't been set. This isn't as important as the equivalent fix for the hash API because

[RFC PATCH 7/9] crypto: ghash - remove checks for key being set

2018-01-03 Thread Eric Biggers
From: Eric Biggers Now that the crypto API prevents a keyed hash from being used without setting the key, there's no need for GHASH to do this check itself. Signed-off-by: Eric Biggers --- crypto/ghash-generic.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/crypto/ghash-generi

Re: general protection fault in blkcipher_walk_done (2)

2018-01-03 Thread Eric Biggers
On Wed, Jan 03, 2018 at 12:58:02AM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 72bca2084a21edda74b802bc076083d5951f67b4 > git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console ou

[PATCH v2 1/3] crypto: salsa20-generic - cleanup and convert to skcipher API

2018-01-05 Thread Eric Biggers
From: Eric Biggers Convert salsa20-generic from the deprecated "blkcipher" API to the "skcipher" API, in the process fixing it up to be thread-safe (as the crypto API expects) by maintaining each request's state separately from the transform context. Also remove the

[PATCH v2 3/3] crypto: x86/salsa20 - cleanup and convert to skcipher API

2018-01-05 Thread Eric Biggers
From: Eric Biggers Convert salsa20-asm from the deprecated "blkcipher" API to the "skcipher" API, in the process fixing it up to use the generic helpers. This allows removing the salsa20_keysetup() and salsa20_ivsetup() assembly functions, which aren't performance cr

[PATCH v2 2/3] crypto: salsa20 - export generic helpers

2018-01-05 Thread Eric Biggers
From: Eric Biggers Export the Salsa20 constants, transform context, and initialization functions so that they can be reused by the x86 implementation. Signed-off-by: Eric Biggers --- crypto/salsa20_generic.c | 20 +++- include/crypto/salsa20.h | 27

[PATCH v2 0/3] crypto: salsa20 - cleanup and convert to skcipher API

2018-01-05 Thread Eric Biggers
From: Eric Biggers This series converts the Salsa20 implementations over to the skcipher API, in the process fixing a couple bugs and making them be more similar to the ChaCha20 implementations, rather than doing things slightly differently for no good reason. (Note, however, that Salsa20 still

Re: INFO: task hung in aead_recvmsg

2018-01-05 Thread Eric Biggers
On Sat, Dec 30, 2017 at 09:37:44AM +0100, Steffen Klassert wrote: > On Sat, Dec 23, 2017 at 02:29:42PM -0600, Eric Biggers wrote: > > [+Cc Steffen Klassert ] > > > > > > I was able to reproduce this by trying to use 'pcrypt' recursively. I am > > not

Re: kernel failure while loading X.509 certificate

2018-01-16 Thread Eric Biggers
install" > >> procedure. No error reported while building. But at boot the > >> kernel immediately fails as follows, apparently while loading/parsing > >> an X.509 certificate: > > > > The BUG_ON() you hit is this one in public_key_verify_signature():

Re: kernel failure while loading X.509 certificate

2018-01-16 Thread Eric Biggers
On Wed, Jan 17, 2018 at 06:36:16AM +0100, Paolo Valente wrote: > > > > Il giorno 17 gen 2018, alle ore 06:16, Eric Biggers > > ha scritto: > > > > Hi Paolo, > > > > On Fri, Jan 12, 2018 at 07:06:12AM +0100, Paolo Valente wrote: > >> >

Re: KASAN: slab-out-of-bounds Write in sha3_update (2)

2018-01-16 Thread Eric Biggers
On Fri, Dec 22, 2017 at 11:22:38AM -0600, Eric Biggers wrote: > [+Cc keyri...@vger.kernel.org] > > On Fri, Dec 22, 2017 at 07:55:01AM -0800, syzbot wrote: > > Hello, > > > > syzkaller hit the following crash on > > 9035a8961b504d0997369509ab8c6b1f0a4ee33d >

Re: general protection fault in crypto_remove_spawns

2018-01-16 Thread Eric Biggers
On Mon, Nov 27, 2017 at 10:56:46AM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 1ea8d039f9edcfefb20d8ddfe136930f6e551529 > git://git.cmpxchg.org/linux-mmots.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console output is attached. > C repro

Re: BUG: unable to handle kernel NULL pointer dereference in crypto_alg_tested

2018-01-16 Thread Eric Biggers
On Fri, Dec 22, 2017 at 11:33:02PM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 6084b576dca2e898f5c101baef151f7bfdbb606d > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

Re: general protection fault in __crypto_alg_lookup

2018-01-16 Thread Eric Biggers
On Tue, Dec 19, 2017 at 11:49:02PM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 6084b576dca2e898f5c101baef151f7bfdbb606d > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

Re: kernel failure while loading X.509 certificate

2018-01-18 Thread Eric Biggers
On Thu, Jan 18, 2018 at 11:07:50AM +0100, Paolo Valente wrote: > > > > Il giorno 17 gen 2018, alle ore 12:08, David Howells > > ha scritto: > > > > If this happened during boot, it could be that you have an X.509 cert for > > which the digest algorithm isn't built into the kernel. > > > > Ye

[PATCH] crypto: sha512-mb - initialize pending lengths correctly

2018-01-24 Thread Eric Biggers
From: Eric Biggers The SHA-512 multibuffer code keeps track of the number of blocks pending in each lane. The minimum of these values is used to identify the next lane that will be completed. Unused lanes are set to a large number (0x) so that they don't affect this calcul

[PATCH] crypto: sha1-mb - remove HASH_FIRST flag

2018-01-24 Thread Eric Biggers
From: Eric Biggers The HASH_FIRST flag is never set. Remove it. Signed-off-by: Eric Biggers --- arch/x86/crypto/sha1-mb/sha1_mb.c | 28 +++- arch/x86/crypto/sha1-mb/sha1_mb_ctx.h | 8 +++- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/arch

[PATCH] crypto: mcryptd - remove pointless wrapper functions

2018-01-24 Thread Eric Biggers
From: Eric Biggers There is no need for ahash_mcryptd_{update,final,finup,digest}(); we should just call crypto_ahash_*() directly. Signed-off-by: Eric Biggers --- crypto/mcryptd.c | 34 -- include/crypto/internal/hash.h | 5 - 2 files

[PATCH] crypto: sha512-mb - remove HASH_FIRST flag

2018-01-24 Thread Eric Biggers
From: Eric Biggers The HASH_FIRST flag is never set. Remove it. Signed-off-by: Eric Biggers --- arch/x86/crypto/sha512-mb/sha512_mb.c | 30 +++--- arch/x86/crypto/sha512-mb/sha512_mb_ctx.h | 8 +++- 2 files changed, 6 insertions(+), 32 deletions(-) diff

[PATCH] crypto: sha256-mb - remove HASH_FIRST flag

2018-01-24 Thread Eric Biggers
From: Eric Biggers The HASH_FIRST flag is never set. Remove it. Signed-off-by: Eric Biggers --- arch/x86/crypto/sha256-mb/sha256_mb.c | 27 +++ arch/x86/crypto/sha256-mb/sha256_mb_ctx.h | 8 +++- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a

Re: [PATCH] crypto: sha1-mb - remove HASH_FIRST flag

2018-01-25 Thread Eric Biggers
On Thu, Jan 25, 2018 at 01:58:38PM -0800, Tim Chen wrote: > On 01/24/2018 07:10 PM, Eric Biggers wrote: > > From: Eric Biggers > > > > The HASH_FIRST flag is never set. Remove it. > > > > Signed-off-by: Eric Biggers > > --- > >

Re: Subject: [PATCH] crypto: add zbewalgo compression algorithm for zram

2018-01-30 Thread Eric Biggers
Hi Benjamin, On Tue, Jan 30, 2018 at 04:08:57PM +0100, Benjamin Warnke wrote: > Currently ZRAM uses the compression-algorithms from the crypto-api. > None of the current compression-algorithms in the crypto-api is designed > to compress 4KiB chunks of data efficiently. > This patch adds a new comp

Re: BUG: unable to handle kernel paging request in hmac_init_tfm

2018-01-30 Thread Eric Biggers
On Mon, Dec 18, 2017 at 11:36:01AM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 6084b576dca2e898f5c101baef151f7bfdbb606d > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

Re: BUG: unable to handle kernel NULL pointer dereference in af_alg_alloc_tsgl

2018-01-30 Thread Eric Biggers
On Tue, Dec 19, 2017 at 01:03:00PM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 6084b576dca2e898f5c101baef151f7bfdbb606d > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

Re: BUG: unable to handle kernel paging request in aead_accept_parent_nokey

2018-01-30 Thread Eric Biggers
On Sun, Dec 17, 2017 at 09:51:01PM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 41d8c16909ebda40f7b4982a7f5e2ad102705ade > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

Re: BUG: unable to handle kernel NULL pointer dereference in crypto_destroy_tfm

2018-01-30 Thread Eric Biggers
On Sat, Dec 23, 2017 at 01:58:01AM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 6084b576dca2e898f5c101baef151f7bfdbb606d > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

Re: WARNING: kernel stack regs has bad 'bp' value (3)

2018-02-02 Thread Eric Biggers
On Fri, Feb 02, 2018 at 02:57:32PM +0100, Dmitry Vyukov wrote: > On Fri, Feb 2, 2018 at 2:48 PM, syzbot > wrote: > > Hello, > > > > syzbot hit the following crash on upstream commit > > 7109a04eae81c41ed529da9f3c48c3655ccea741 (Thu Feb 1 17:37:30 2018 +) > > Merge git://git.kernel.org/pub/scm/

Re: BUG: unable to handle kernel NULL pointer dereference in __crypto_register_alg

2018-02-02 Thread Eric Biggers
On Sat, Dec 23, 2017 at 11:54:01PM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > 6084b576dca2e898f5c101baef151f7bfdbb606d > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console o

[PATCH 2/9] PKCS#7: fix certificate blacklisting

2018-02-06 Thread Eric Biggers
From: Eric Biggers If there is a blacklisted certificate in a SignerInfo's certificate chain, then pkcs7_verify_sig_chain() sets sinfo->blacklisted and returns 0. But, pkcs7_verify() fails to handle this case appropriately, as it actually continues on to the line 'actual_ret = 0;

[PATCH 6/9] PKCS#7: remove unnecessary check for NULL sinfo->sig->hash_algo

2018-02-06 Thread Eric Biggers
From: Eric Biggers The PKCS#7 parser is guaranteed to set ->sig->hash_algo for every SignerInfo, since pkcs7_sig_note_digest_algo() is a mandatory action in the PKCS#7 ASN.1 grammar, and it returns an error code if an unrecognized DigestAlgorithmIdentifier is given rather than leavi

[PATCH 0/9] PKCS#7 / X.509 fixes and cleanups

2018-02-06 Thread Eric Biggers
From: Eric Biggers Hi David, here is another set of fixes and cleanups for the PKCS#7 and X.509 code: Patches 1-5 fix the BUG_ON() in public_key_verify_signature() reported by Paolo Valente as well as several other bugs I found. Notably both the PKCS#7 certificate chain verification and

[PATCH 8/9] X.509: remove dead code that set ->unsupported_sig

2018-02-06 Thread Eric Biggers
From: Eric Biggers The X.509 parser is guaranteed to set cert->sig->pkey_algo and cert->sig->hash_algo, since x509_note_pkey_algo() is a mandatory action in the X.509 ASN.1 grammar, and it returns an error code if an unrecognized AlgorithmIdentifier is given rather than leaving the a

[PATCH 7/9] X.509: remove never-set ->unsupported_key flag

2018-02-06 Thread Eric Biggers
From: Eric Biggers The X.509 parser is guaranteed to set cert->pub->pkey_algo, since x509_extract_key_data() is a mandatory action in the X.509 ASN.1 grammar, and it returns an error code if an unrecognized AlgorithmIdentifier is given rather than leaving the algorithm as NULL. The

[PATCH 9/9] X.509: self_signed implies !unsupported_sig

2018-02-06 Thread Eric Biggers
From: Eric Biggers The self_signed flag on a certificate implies we verified its signature. Hence, the signature cannot have been unsupported. Remove the dead code that resulted from this oversight. Signed-off-by: Eric Biggers --- crypto/asymmetric_keys/pkcs7_verify.c | 18

[PATCH 1/9] PKCS#7: fix certificate chain verification

2018-02-06 Thread Eric Biggers
From: Eric Biggers When pkcs7_verify_sig_chain() is building the certificate chain for a SignerInfo using the certificates in the PKCS#7 message, it is passing the wrong arguments to public_key_verify_signature(). Consequently, when the next certificate is supposed to be used to verify the

[PATCH 3/9] PKCS#7: fix direct verification of SignerInfo signature

2018-02-06 Thread Eric Biggers
From: Eric Biggers If none of the certificates in a SignerInfo's certificate chain match a trusted key, nor is the last certificate signed by a trusted key, then pkcs7_validate_trust_one() tries to check whether the SignerInfo's signature was made directly by a trusted key. But, i

[PATCH 4/9] X.509: fix BUG_ON() when hash algorithm is unsupported

2018-02-06 Thread Eric Biggers
From: Eric Biggers The X.509 parser mishandles the case where the certificate's signature's hash algorithm is not available in the crypto API. In this case, x509_get_sig_params() doesn't allocate the cert->sig->digest buffer; this part seems to be

[PATCH 5/9] X.509: fix NULL dereference when restricting key with unsupported_sig

2018-02-06 Thread Eric Biggers
From: Eric Biggers The asymmetric key type allows an X.509 certificate to be added even if its signature's hash algorithm is not available in the crypto API. In that case 'payload.data[asym_auth]' will be NULL. But the key restriction code failed to check for this case before tr

[PATCH 0/5] crypto: Speck support

2018-02-07 Thread Eric Biggers
lerated implementation is much faster than the generic implementation and therefore is the implementation that would primarily be used in practice on the devices we are targeting. There is no AArch64 implementation added, since such CPUs are likely to have the Cryptography Extensions, allowing th

[PATCH 1/5] crypto: add support for the Speck block cipher

2018-02-07 Thread Eric Biggers
de would be a brand new crypto construction and would be more complicated and difficult to implement efficiently in comparison to Speck-XTS. Signed-off-by: Eric Biggers --- crypto/Kconfig | 14 +++ crypto/Makefile | 1 + crypto/speck.c | 294 +

[PATCH 2/5] crypto: speck - export common helpers

2018-02-07 Thread Eric Biggers
le, while the generic encryption and decryption functions are needed as fallbacks and for the XTS tweak encryption. Signed-off-by: Eric Biggers --- crypto/speck.c | 90 +++--- include/crypto/speck.h | 62 ++ 2 file

[PATCH 4/5] crypto: speck - add test vectors for Speck128-XTS

2018-02-07 Thread Eric Biggers
Add test vectors for Speck128-XTS, generated in userspace using C code. The inputs were borrowed from the AES-XTS test vectors. Both xts(speck128-generic) and xts-speck128-neon pass these tests. Signed-off-by: Eric Biggers --- crypto/testmgr.c | 9 + crypto/testmgr.h | 687

[PATCH 5/5] crypto: speck - add test vectors for Speck64-XTS

2018-02-07 Thread Eric Biggers
8-bit block size. Signed-off-by: Eric Biggers --- crypto/testmgr.c | 9 + crypto/testmgr.h | 671 +++ 2 files changed, 680 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 6583c11f0f0b..4b5fce3910f8 100644 --- a/crypto/test

[PATCH 3/5] crypto: arm/speck: add NEON-accelerated implementation of Speck-XTS

2018-02-07 Thread Eric Biggers
urse, when possible users should use Speck128-XTS, but even that may be too slow on some processors; Speck64-XTS can be faster. Signed-off-by: Eric Biggers --- arch/arm/crypto/Kconfig | 6 + arch/arm/crypto/Makefile | 2 + arch/arm/crypto/speck-neon-co

Re: [PATCH 0/5] crypto: Speck support

2018-02-08 Thread Eric Biggers
On Wed, Feb 07, 2018 at 08:47:05PM -0500, Jeffrey Walton wrote: > On Wed, Feb 7, 2018 at 7:09 PM, Eric Biggers wrote: > > Hello, > > > > This series adds Speck support to the crypto API, including the Speck128 > > and Speck64 variants. Speck is a lightweight block

Re: BUG: unable to handle kernel NULL pointer dereference in sha512_mb_mgr_get_comp_job_avx2

2018-02-12 Thread Eric Biggers
On Sun, Dec 03, 2017 at 12:31:01PM -0800, syzbot wrote: > syzkaller has found reproducer for the following crash on > 4131d5166185d0d75b5f1d4bf362a9e0bac05598 > git://git.cmpxchg.org/linux-mmots.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console output is attached.

Re: [PATCH 0/5] crypto: Speck support

2018-02-12 Thread Eric Biggers
Hi all, On Fri, Feb 09, 2018 at 07:07:01PM -0500, Jeffrey Walton wrote: > > Hi Jeffrey, > > > > I see you wrote the SPECK implementation in Crypto++, and you are treating > > the > > words as big endian. > > > > Do you have a reference for this being the "correct" order? Unfortunately > > the >

Re: [PATCH 0/5] crypto: Speck support

2018-02-12 Thread Eric Biggers
Hi Jeff, On Mon, Feb 12, 2018 at 02:57:06PM -0500, Jeffrey Walton wrote: > On Mon, Feb 12, 2018 at 2:19 PM, Eric Biggers wrote: > > Hi all, > > > > On Fri, Feb 09, 2018 at 07:07:01PM -0500, Jeffrey Walton wrote: > >> > Hi Jeffrey, > >> > > >>

[PATCH v2 1/5] crypto: add support for the Speck block cipher

2018-02-12 Thread Eric Biggers
orders the authors recommended in a correspondence with them. The test vectors are taken from the original paper but were mapped to byte arrays using the recommended byte and word orders. Signed-off-by: Eric Biggers --- crypto/Kconfig | 14 +++ crypto/Makefi

[PATCH v2 3/5] crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS

2018-02-12 Thread Eric Biggers
urse, when possible users should use Speck128-XTS, but even that may be too slow on some processors; Speck64-XTS can be faster. Signed-off-by: Eric Biggers --- arch/arm/crypto/Kconfig | 6 + arch/arm/crypto/Makefile | 2 + arch/arm/crypto/speck-neon-co

[PATCH v2 4/5] crypto: speck - add test vectors for Speck128-XTS

2018-02-12 Thread Eric Biggers
Add test vectors for Speck128-XTS, generated in userspace using C code. The inputs were borrowed from the AES-XTS test vectors. Both xts(speck128-generic) and xts-speck128-neon pass these tests. Signed-off-by: Eric Biggers --- crypto/testmgr.c | 9 + crypto/testmgr.h | 687

[PATCH v2 5/5] crypto: speck - add test vectors for Speck64-XTS

2018-02-12 Thread Eric Biggers
8-bit block size. Signed-off-by: Eric Biggers --- crypto/testmgr.c | 9 + crypto/testmgr.h | 671 +++ 2 files changed, 680 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index e011a347d51b..9f82e7bc9c56 100644 --- a/crypto/test

[PATCH v2 0/5] crypto: Speck support

2018-02-12 Thread Eric Biggers
use of AES. Changed since v1: - Use the word order recommended by the Speck authors. All test vectors were updated. Eric Biggers (5): crypto: add support for the Speck block cipher crypto: speck - export common helpers crypto: arm/speck - add NEON-accelerated implementation of Speck-

[PATCH v2 2/5] crypto: speck - export common helpers

2018-02-12 Thread Eric Biggers
le, while the generic encryption and decryption functions are needed as fallbacks and for the XTS tweak encryption. Signed-off-by: Eric Biggers --- crypto/speck.c | 90 +++--- include/crypto/speck.h | 62 ++ 2 file

Re: [PATCH v2 3/5] crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS

2018-02-13 Thread Eric Biggers
Hi Ard, On Tue, Feb 13, 2018 at 11:34:36AM +, Ard Biesheuvel wrote: > Hi Eric, > > On 12 February 2018 at 23:52, Eric Biggers wrote: > > Add an ARM NEON-accelerated implementation of Speck-XTS. It operates on > > 128-byte chunks at a time, i.e. 8 blocks for Spec

[PATCH v3 0/5] crypto: Speck support

2018-02-14 Thread Eric Biggers
ng the use of AES. An AArch64 implementation can be added later if there is interest though. Changed since v2: - Fix __speck64_xts_crypt() to work on big endian CPUs. Changed since v1: - Use the word order recommended by the Speck authors. All test vectors were updated. Eric Biggers (5): cry

[PATCH v3 1/5] crypto: add support for the Speck block cipher

2018-02-14 Thread Eric Biggers
orders the authors recommended in a correspondence with them. The test vectors are taken from the original paper but were mapped to byte arrays using the recommended byte and word orders. Signed-off-by: Eric Biggers --- crypto/Kconfig | 14 +++ crypto/Makefi

[PATCH v3 2/5] crypto: speck - export common helpers

2018-02-14 Thread Eric Biggers
le, while the generic encryption and decryption functions are needed as fallbacks and for the XTS tweak encryption. Signed-off-by: Eric Biggers --- crypto/speck.c | 90 +++--- include/crypto/speck.h | 62 + 2 files cha

[PATCH v3 4/5] crypto: speck - add test vectors for Speck128-XTS

2018-02-14 Thread Eric Biggers
Add test vectors for Speck128-XTS, generated in userspace using C code. The inputs were borrowed from the AES-XTS test vectors. Both xts(speck128-generic) and xts-speck128-neon pass these tests. Signed-off-by: Eric Biggers --- crypto/testmgr.c | 9 + crypto/testmgr.h | 687

[PATCH v3 5/5] crypto: speck - add test vectors for Speck64-XTS

2018-02-14 Thread Eric Biggers
8-bit block size. Signed-off-by: Eric Biggers --- crypto/testmgr.c | 9 + crypto/testmgr.h | 671 +++ 2 files changed, 680 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index e011a347d51b..9f82e7bc9c56 100644 --- a/crypto/testmgr.c

[PATCH v3 3/5] crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS

2018-02-14 Thread Eric Biggers
urse, when possible users should use Speck128-XTS, but even that may be too slow on some processors; Speck64-XTS can be faster. Signed-off-by: Eric Biggers --- arch/arm/crypto/Kconfig | 6 + arch/arm/crypto/Makefile | 2 + arch/arm/crypto/speck-neon-co

Re: [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers

2018-02-15 Thread Eric Biggers
Hi David, On Thu, Feb 15, 2018 at 03:54:26PM +, David Howells wrote: > kmalloc() can't always allocate large enough buffers for big_key to use for > crypto (1MB + some metadata) so we cannot use that to allocate the buffer. > Further, vmalloc'd pages can't be passed to sg_init_one() and the ae

Re: [PATCH v3 2/3] MIPS: crypto: Add crc32 and crc32c hw accelerated module

2018-02-15 Thread Eric Biggers
On Fri, Feb 09, 2018 at 10:11:06PM +, James Hogan wrote: > +static struct shash_alg crc32_alg = { > + .digestsize = CHKSUM_DIGEST_SIZE, > + .setkey = chksum_setkey, > + .init = chksum_init, > + .update

Re: [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2]

2018-02-15 Thread Eric Biggers
Hi David, On Thu, Feb 15, 2018 at 10:53:49PM +, David Howells wrote: > /* > + * Free up the buffer. > + */ > +static void big_key_free_buffer(struct big_key_buf *buf) > +{ > + unsigned int i; > + > + vunmap(buf->virt); > + for (i = 0; i < buf->nr_pages; i++) > + if (bu

[PATCH 00/30] crypto: x86 glue code cleanup/conversion

2018-02-19 Thread Eric Biggers
g with random sglist divisions, during which I found a bug in ecb-cast5-avx which this series fixes as well. The overall diff is about 3100 lines of code removed, mainly due to the ablk_helper => crypto_simd conversions and removing the unnecessary LRW and XTS implementations. Eric Biggers (30):

<    1   2   3   4   5   6   7   8   9   10   >