Re: [PATCH 0/6] lib/crc32: treewide: Use existing define with polynomial

2018-07-17 Thread Eric Biggers
Hi Krzysztof, On Tue, Jul 17, 2018 at 06:05:35PM +0200, Krzysztof Kozlowski wrote: > Hi, > > Kernel defines same polynomial for CRC-32 in few places. > This is unnecessary duplication of the same value. Also this might > be error-prone for future code - every driver will define the > polynomial

Re: [PATCH] crypto: vmx - fix copy-paste error in CTR mode

2019-03-14 Thread Eric Biggers
Hi Daniel, On Fri, Mar 15, 2019 at 03:24:35PM +1100, Daniel Axtens wrote: > Hi Eric, > > >> The original assembly imported from OpenSSL has two copy-paste > >> errors in handling CTR mode. When dealing with a 2 or 3 block tail, > >> the code branches to the CBC decryption exit path, rather than

Re: [PATCH] crypto: vmx - fix copy-paste error in CTR mode

2019-03-14 Thread Eric Biggers
Hi Daniel, On Fri, Mar 15, 2019 at 01:09:01PM +1100, Daniel Axtens wrote: > The original assembly imported from OpenSSL has two copy-paste > errors in handling CTR mode. When dealing with a 2 or 3 block tail, > the code branches to the CBC decryption exit path, rather than to > the CTR exit path.

Re: [PATCH] crypto: vmx - fix copy-paste error in CTR mode

2019-04-10 Thread Eric Biggers
Hi Daniel, On Fri, Mar 15, 2019 at 04:23:02PM +1100, Daniel Axtens wrote: > Eric Biggers writes: > > > Hi Daniel, > > > > On Fri, Mar 15, 2019 at 03:24:35PM +1100, Daniel Axtens wrote: > >> Hi Eric, > >> > >> >> The original assembl

[RFC PATCH 2/3] crypto: nx - don't abuse shash MAY_SLEEP flag

2019-04-14 Thread Eric Biggers
From: Eric Biggers The nx driver uses the MAY_SLEEP flag in shash_desc::flags as an indicator to not retry sending the operation to the hardware as many times before returning -EBUSY. This is bogus because (1) that's not what the MAY_SLEEP flag is for, and (2) the shash API doesn't allow

[PATCH] crypto: powerpc - convert to use crypto_simd_usable()

2019-04-12 Thread Eric Biggers
From: Eric Biggers Replace all calls to in_interrupt() in the PowerPC crypto code with !crypto_simd_usable(). This causes the crypto self-tests to test the no-SIMD code paths when CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y. The p8_ghash algorithm is currently failing and needs to be fixed

Re: [PATCH] crypto: talitos - fix skcipher failure due to wrong output IV

2019-05-15 Thread Eric Biggers
On Wed, May 15, 2019 at 08:49:48PM +0200, Christophe Leroy wrote: > > > Le 15/05/2019 à 16:05, Horia Geanta a écrit : > > On 5/15/2019 3:29 PM, Christophe Leroy wrote: > > > Selftests report the following: > > > > > > [2.984845] alg: skcipher: cbc-aes-talitos encryption test failed > > >

Re: [PATCH] crypto: vmx - fix copy-paste error in CTR mode

2019-05-15 Thread Eric Biggers
On Thu, May 16, 2019 at 12:12:48PM +1000, Daniel Axtens wrote: > > I'm also seeing issues with ghash with the extended tests: > > [7.582926] alg: hash: p8_ghash test failed (wrong result) on test vector > 0, cfg="random: use_final src_divs=[9.72%@+39832, > 18.2%@+65504,

[PATCH] crypto: vmx - convert to SPDX license identifiers

2019-05-20 Thread Eric Biggers
From: Eric Biggers Remove the boilerplate license text and replace it with the equivalent SPDX license identifier. Signed-off-by: Eric Biggers --- drivers/crypto/vmx/aes.c | 14 +- drivers/crypto/vmx/aes_cbc.c | 14 +- drivers/crypto/vmx/aes_ctr.c | 14

Re: [PATCH] crypto: vmx - CTR: always increment IV as quadword

2019-05-20 Thread Eric Biggers
On Mon, May 20, 2019 at 11:59:05AM +1000, Daniel Axtens wrote: > Daniel Axtens writes: > > > The kernel self-tests picked up an issue with CTR mode: > > alg: skcipher: p8_aes_ctr encryption test failed (wrong result) on test > > vector 3, cfg="uneven misaligned splits, may sleep" > > > > Test

[PATCH] crypto: vmx - convert to skcipher API

2019-05-20 Thread Eric Biggers
From: Eric Biggers Convert the VMX implementations of AES-CBC, AES-CTR, and AES-XTS from the deprecated "blkcipher" API to the "skcipher" API. As part of this, I moved the skcipher_request for the fallback algorithm off the stack and into the request context of the parent

[PATCH] crypto: testmgr - fix length truncation with large page size

2019-05-20 Thread Eric Biggers
From: Eric Biggers On PowerPC with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y, there is sometimes a crash in generate_random_aead_testvec(). The problem is that the generated test vectors use data lengths of up to about 2 * PAGE_SIZE, which is 128 KiB on PowerPC; however, the data length fields

[PATCH v2 1/3] crypto: powerpc - don't unnecessarily use atomic scatterwalk

2019-10-14 Thread Eric Biggers
From: Eric Biggers The PowerPC SPE implementations of AES modes only disable preemption during the actual encryption/decryption, not during the scatterwalk functions. It's therefore unnecessary to request an atomic scatterwalk. So don't do so. Signed-off-by: Eric Biggers --- arch/powerpc

[PATCH v2 0/3] crypto: powerpc - convert SPE AES algorithms to skcipher API

2019-10-14 Thread Eric Biggers
plit fixes into separate patches. - Made ppc_aes_setkey_skcipher() call ppc_aes_setkey(), rather than creating a separate expand_key() function. This keeps the code shorter. Eric Biggers (3): crypto: powerpc - don't unnecessarily use atomic scatterwalk crypto: powerpc - don't set ivsize for AES

[PATCH v2 3/3] crypto: powerpc - convert SPE AES algorithms to skcipher API

2019-10-14 Thread Eric Biggers
From: Eric Biggers Convert the glue code for the PowerPC SPE implementations of AES-ECB, AES-CBC, AES-CTR, and AES-XTS from the deprecated "blkcipher" API to the "skcipher" API. This is needed in order for the blkcipher API to be removed. Tested with: export ARCH=p

[PATCH v2 2/3] crypto: powerpc - don't set ivsize for AES-ECB

2019-10-14 Thread Eric Biggers
From: Eric Biggers Set the ivsize for the "ecb-ppc-spe" algorithm to 0, since ECB mode doesn't take an IV. This fixes a failure in the extra crypto self-tests: alg: skcipher: ivsize for ecb-ppc-spe (16) doesn't match generic impl (0) Signed-off-by: Eric Biggers --- ar

[PATCH] crypto: powerpc - convert SPE AES algorithms to skcipher API

2019-10-11 Thread Eric Biggers
From: Eric Biggers Convert the glue code for the PowerPC SPE implementations of AES-ECB, AES-CBC, AES-CTR, and AES-XTS from the deprecated "blkcipher" API to the "skcipher" API. Tested with: export ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- make mpc85xx_d

[PATCH 2/4] crypto: nx - convert AES-ECB to skcipher API

2019-10-12 Thread Eric Biggers
From: Eric Biggers Convert the PowerPC Nest (NX) implementation of AES-ECB from the deprecated "blkcipher" API to the "skcipher" API. This is needed in order for the blkcipher API to be removed. Signed-off-by: Eric Biggers --- drivers/crypto/

[PATCH 3/4] crypto: nx - convert AES-CBC to skcipher API

2019-10-12 Thread Eric Biggers
From: Eric Biggers Convert the PowerPC Nest (NX) implementation of AES-CBC from the deprecated "blkcipher" API to the "skcipher" API. This is needed in order for the blkcipher API to be removed. Signed-off-by: Eric Biggers --- drivers/crypto/

[PATCH 4/4] crypto: nx - convert AES-CTR to skcipher API

2019-10-12 Thread Eric Biggers
From: Eric Biggers Convert the PowerPC Nest (NX) implementation of AES-CTR from the deprecated "blkcipher" API to the "skcipher" API. This is needed in order for the blkcipher API to be removed. Signed-off-by: Eric Biggers --- drivers/crypto/

[PATCH 0/4] crypto: nx - convert to skcipher API

2019-10-12 Thread Eric Biggers
his hardware, please test this patchset with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y. Eric Biggers (4): crypto: nx - don't abuse blkcipher_desc to pass iv around crypto: nx - convert AES-ECB to skcipher API crypto: nx - convert AES-CBC to skcipher API crypto: nx - convert AES-CTR to skcipher

[PATCH 1/4] crypto: nx - don't abuse blkcipher_desc to pass iv around

2019-10-12 Thread Eric Biggers
From: Eric Biggers The NX crypto driver is using 'struct blkcipher_desc' to pass the IV around, even for AEADs (for which it creates the struct on the stack). This is not appropriate since this structure is part of the "blkcipher" API, which is deprecated and will be removed. Just p

Re: [PATCH 0/4] crypto: nx - convert to skcipher API

2019-10-13 Thread Eric Biggers
On Sun, Oct 13, 2019 at 05:31:31PM +0200, Ard Biesheuvel wrote: > On Sun, 13 Oct 2019 at 08:29, Ard Biesheuvel > wrote: > > > > On Sun, 13 Oct 2019 at 06:40, Eric Biggers wrote: > > > > > > This series converts the PowerPC Nest (NX) implementations of

Re: [PATCH] crypto: powerpc - convert SPE AES algorithms to skcipher API

2019-10-14 Thread Eric Biggers
On Mon, Oct 14, 2019 at 10:45:22AM +0200, Ard Biesheuvel wrote: > Hi Eric, > > On Sat, 12 Oct 2019 at 04:32, Eric Biggers wrote: > > > > From: Eric Biggers > > > > Convert the glue code for the PowerPC SPE implementations of AES-ECB, > > AES-CBC, A

[PATCH 0/7] sha1 library cleanup

2020-05-02 Thread Eric Biggers
tch series applies to cryptodev/master. Eric Biggers (7): mptcp: use SHA256_BLOCK_SIZE, not SHA_MESSAGE_BYTES crypto: powerpc/sha1 - remove unused temporary workspace crypto: powerpc/sha1 - prefix the "sha1_" functions crypto: s390/sha1 - prefix the "sha1_" functions

[PATCH 3/7] crypto: powerpc/sha1 - prefix the "sha1_" functions

2020-05-02 Thread Eric Biggers
From: Eric Biggers Prefix the PowerPC SHA-1 functions with "powerpc_sha1_" rather than "sha1_". This allows us to rename the library function sha_init() to sha1_init() without causing a naming collision. Cc: linuxppc-dev@lists.ozlabs.org Cc: Benjamin Herrenschmidt Cc:

[PATCH 2/7] crypto: powerpc/sha1 - remove unused temporary workspace

2020-05-02 Thread Eric Biggers
From: Eric Biggers The PowerPC implementation of SHA-1 doesn't actually use the 16-word temporary array that's passed to the assembly code. This was probably meant to correspond to the 'W' array that lib/sha1.c uses. However, in sha1-powerpc-asm.S these values are actually stored in GPRs 16-31

Re: [PATCH 0/7] sha1 library cleanup

2020-05-03 Thread Eric Biggers
On Sat, May 02, 2020 at 03:05:46PM -0600, Jason A. Donenfeld wrote: > Thanks for this series. I like the general idea. I think it might make > sense, though, to separate things out into sha1.h and sha256.h. That > will be nice preparation work for when we eventually move obsolete > primitives into

Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread()

2020-10-12 Thread Eric Biggers
On Sun, Oct 11, 2020 at 11:56:35PM -0700, Ira Weiny wrote: > > > > And I still don't really understand. After this patchset, there is still > > code > > nearly identical to the above (doing a temporary mapping just for a memcpy) > > that > > would still be using kmap_atomic(). > > I don't

Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread()

2020-10-09 Thread Eric Biggers
On Sat, Oct 10, 2020 at 01:39:54AM +0100, Matthew Wilcox wrote: > On Fri, Oct 09, 2020 at 02:34:34PM -0700, Eric Biggers wrote: > > On Fri, Oct 09, 2020 at 12:49:57PM -0700, ira.we...@intel.com wrote: > > > The kmap() calls in this FS are localized to a single thread. To avoid &

Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread()

2020-10-09 Thread Eric Biggers
On Fri, Oct 09, 2020 at 12:49:57PM -0700, ira.we...@intel.com wrote: > From: Ira Weiny > > The kmap() calls in this FS are localized to a single thread. To avoid > the over head of global PKRS updates use the new kmap_thread() call. > > Cc: Jaegeuk Kim > Cc: Chao Yu > Signed-off-by: Ira

Re: [PATCH 05/14] fs: don't allow kernel reads and writes without iter ops

2020-10-09 Thread Eric Biggers
On Fri, Oct 09, 2020 at 06:03:31PM -0700, Linus Torvalds wrote: > On Fri, Oct 9, 2020 at 3:06 PM Eric Biggers wrote: > > > > It's a bit unintuitive that ppos=NULL means "use pos 0", not "use > > file->f_pos". > > That's not at all what it m

Re: [PATCH 05/14] fs: don't allow kernel reads and writes without iter ops

2020-10-09 Thread Eric Biggers
On Fri, Oct 02, 2020 at 09:27:09AM -0700, Linus Torvalds wrote: > On Thu, Oct 1, 2020 at 3:41 PM Al Viro wrote: > > > > Better > > loff_t dummy = 0; > > ... > > wr = __kernel_write(file, data, bytes, ); > > No, just fix __kernel_write() to work correctly. > > The fact

Re: [PATCH 05/14] fs: don't allow kernel reads and writes without iter ops

2020-10-01 Thread Eric Biggers
Christoph, Al, and Linus: On Thu, Sep 03, 2020 at 04:22:33PM +0200, Christoph Hellwig wrote: > @@ -510,28 +524,31 @@ static ssize_t new_sync_write(struct file *filp, const > char __user *buf, size_t > /* caller is responsible for file_start_write/file_end_write */ > ssize_t

Re: [PATCH 19/22] crypto: inside-secure - add check for xts input length equal to zero

2020-08-10 Thread Eric Biggers
On Mon, Aug 10, 2020 at 05:33:39PM +0300, Horia Geantă wrote: > On 8/10/2020 4:45 PM, Herbert Xu wrote: > > On Mon, Aug 10, 2020 at 10:20:20AM +, Van Leeuwen, Pascal wrote: > >> > >> With all due respect, but this makes no sense. > > > > I agree. This is a lot of churn for no gain. > > > I

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

Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c"

2020-10-22 Thread Eric Biggers
On Thu, Oct 22, 2020 at 10:00:44AM -0700, Nick Desaulniers wrote: > On Thu, Oct 22, 2020 at 9:40 AM Matthew Wilcox wrote: > > > > On Thu, Oct 22, 2020 at 04:35:17PM +, David Laight wrote: > > > Wait... > > > readv(2) defines: > > > ssize_t readv(int fd, const struct iovec *iov, int

Re: [PATCH 0/4] crypto: nintendo-aes - add a new AES driver

2021-09-21 Thread Eric Biggers
On Tue, Sep 21, 2021 at 11:39:26PM +0200, Emmanuel Gil Peyrot wrote: > This engine implements AES in CBC mode, using 128-bit keys only. It is > present on both the Wii and the Wii U, and is apparently identical in > both consoles. > > The hardware is capable of firing an interrupt when the

Re: [PATCH v12 0/6] implement getrandom() in vDSO

2022-12-20 Thread Eric Biggers
On Tue, Dec 20, 2022 at 05:17:52PM +, Christophe Leroy wrote: > Hi Jason, > > Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit : > > Changes v11->v12: > > > > - In order to avoid mlock()ing pages, and the related rlimit and fork > >inheritance issues there, Introduce

Re: [PATCH v12 0/6] implement getrandom() in vDSO

2022-12-21 Thread Eric Biggers
On Wed, Dec 21, 2022 at 03:25:49PM +0100, Jason A. Donenfeld wrote: > On Tue, Dec 20, 2022 at 08:13:14PM +0000, Eric Biggers wrote: > > On Tue, Dec 20, 2022 at 05:17:52PM +, Christophe Leroy wrote: > > > Hi Jason, > > > > > > Le 12/12/2022 à 19:53, Jason A.

Re: [RFC PATCH 01/21] crypto: scomp - Revert "add support for deflate rfc1950 (zlib)"

2023-07-18 Thread Eric Biggers
On Tue, Jul 18, 2023 at 02:58:27PM +0200, Ard Biesheuvel wrote: > This reverts commit a368f43d6e3a001e684e9191a27df384fbff12f5. > > "zlib-deflate" was introduced 6 years ago, but it does not have any > users. So let's remove the generic implementation and the test vectors, > but retain the

Re: [RFC PATCH 01/21] crypto: scomp - Revert "add support for deflate rfc1950 (zlib)"

2023-07-18 Thread Eric Biggers
On Tue, Jul 18, 2023 at 03:32:39PM -0700, Eric Biggers wrote: > On Tue, Jul 18, 2023 at 02:58:27PM +0200, Ard Biesheuvel wrote: > > This reverts commit a368f43d6e3a001e684e9191a27df384fbff12f5. > > > > "zlib-deflate" was introduced 6 years ago, but it does not have

Re: [RFC PATCH 05/21] ubifs: Pass worst-case buffer size to compression routines

2023-07-18 Thread Eric Biggers
On Tue, Jul 18, 2023 at 02:58:31PM +0200, Ard Biesheuvel wrote: > Currently, the ubifs code allocates a worst case buffer size to > recompress a data node, but does not pass the size of that buffer to the > compression code. This means that the compression code will never use > the additional

Re: Add fchmodat2() - or add a more general syscall?

2023-07-26 Thread Eric Biggers
On Tue, Jul 25, 2023 at 04:58:34PM +0100, David Howells wrote: > Rather than adding a fchmodat2() syscall, should we add a "set_file_attrs()" > syscall that takes a mask and allows you to set a bunch of stuff all in one > go? Basically, an interface to notify_change() in the kernel that would