[PATCH net-next v7 04/28] zinc: ChaCha20 generic C implementation and selftest

2018-10-05 Thread Jason A. Donenfeld
This implements the ChaCha20 permutation as a single C statement, by way of the comma operator, which the compiler is able to simplify terrifically. Information: https://cr.yp.to/chacha.html Signed-off-by: Jason A. Donenfeld Cc: Samuel Neves Cc: Jean-Philippe Aumasson Cc: Andy Lutomirski Cc:

[PATCH net-next v7 05/28] zinc: import Andy Polyakov's ChaCha20 x86_64 implementation

2018-10-05 Thread Jason A. Donenfeld
These x86_64 vectorized implementations come from Andy Polyakov's implementation, and are included here in raw form without modification, so that subsequent commits that fix these up for the kernel can see how it has changed. While this is CRYPTOGAMS code, the originating code for this happens to

[PATCH net-next v7 08/28] zinc: port Andy Polyakov's ChaCha20 ARM and ARM64 implementations

2018-10-05 Thread Jason A. Donenfeld
These port and prepare Andy Polyakov's implementations for the kernel, but don't actually wire up any of the code yet. The wiring will be done in a subsequent commit, since we'll need to merge these implementations with another one. We make a few small changes to the assembly: - Entries and exit

[PATCH net-next v7 07/28] zinc: import Andy Polyakov's ChaCha20 ARM and ARM64 implementations

2018-10-05 Thread Jason A. Donenfeld
These NEON and non-NEON implementations come from Andy Polyakov's implementation, and are included here in raw form without modification, so that subsequent commits that fix these up for the kernel can see how it has changed. While this is CRYPTOGAMS code, the originating code for this happens to

[PATCH net-next v7 10/28] zinc: ChaCha20 MIPS32r2 implementation

2018-10-05 Thread Jason A. Donenfeld
This MIPS32r2 implementation comes from René van Dorst and me and results in a nice speedup on the usual OpenWRT targets. Signed-off-by: Jason A. Donenfeld Signed-off-by: René van Dorst Co-developed-by: René van Dorst Cc: Ralf Baechle Cc: Paul Burton Cc: James Hogan Cc: linux-m...@linux-mips

[PATCH net-next v7 06/28] zinc: ChaCha20 x86_64 implementation

2018-10-05 Thread Jason A. Donenfeld
This ports SSSE3, AVX-2, AVX-512F, and AVX-512VL implementations for ChaCha20. The AVX-512F implementation is disabled on Skylake, due to throttling, and the VL ymm implementation is used instead. These come from Andy Polyakov's implementation, with the following modifications from Samuel Neves:

[PATCH net-next v7 09/28] zinc: ChaCha20 ARM and ARM64 implementations

2018-10-05 Thread Jason A. Donenfeld
These wire Andy Polyakov's implementations up to the kernel for ARMv7,8 NEON, and introduce Eric Biggers' ultra-fast scalar implementation for CPUs without NEON or for CPUs with slow NEON (Cortex-A5,7). This commit does the following: - Adds the glue code for the assembly implementations. - Re

[PATCH net-next v7 12/28] zinc: import Andy Polyakov's Poly1305 x86_64 implementation

2018-10-05 Thread Jason A. Donenfeld
These x86_64 vectorized implementations come from Andy Polyakov's implementation, and are included here in raw form without modification, so that subsequent commits that fix these up for the kernel can see how it has changed. While this is CRYPTOGAMS code, the originating code for this happens to

[PATCH net-next v7 13/28] zinc: Poly1305 x86_64 implementation

2018-10-05 Thread Jason A. Donenfeld
This ports AVX, AVX-2, and AVX-512F implementations for Poly1305. The AVX-512F implementation is disabled on Skylake, due to throttling. These come from Andy Polyakov's implementation, with the following modifications from Samuel Neves: - Some cosmetic changes, like renaming labels to .Lname, co

[PATCH net-next v7 16/28] zinc: import Andy Polyakov's Poly1305 MIPS64 implementation

2018-10-05 Thread Jason A. Donenfeld
This MIPS64 accelerated implementation comes from Andy Polyakov's implementation, and is included here in raw form without modification, so that subsequent commits that fix these up for the kernel can see how it has changed. While this is CRYPTOGAMS code, the originating code for this happens to b

[PATCH net-next v7 11/28] zinc: Poly1305 generic C implementations and selftest

2018-10-05 Thread Jason A. Donenfeld
These two C implementations -- a 32x32 one and a 64x64 one, depending on the platform -- come from Andrew Moon's public domain poly1305-donna portable code, modified for usage in the kernel and for usage with accelerated primitives. Information: https://cr.yp.to/mac.html Signed-off-by: Jason A. D

[PATCH net-next v7 19/28] zinc: BLAKE2s generic C implementation and selftest

2018-10-05 Thread Jason A. Donenfeld
The C implementation was originally based on Samuel Neves' public domain reference implementation but has since been heavily modified for the kernel. We're able to do compile-time optimizations by moving some scaffolding around the final function into the header file. Information: https://blake2.n

[PATCH net-next v7 21/28] zinc: Curve25519 generic C implementations and selftest

2018-10-05 Thread Jason A. Donenfeld
This contains two formally verified C implementations of the Curve25519 scalar multiplication function, one for 32-bit systems, and one for 64-bit systems whose compiler supports efficient 128-bit integer types. Not only are these implementations formally verified, but they are also the fastest ava

[PATCH net-next v7 20/28] zinc: BLAKE2s x86_64 implementation

2018-10-05 Thread Jason A. Donenfeld
These implementations from Samuel Neves support AVX and AVX-512VL. Originally this used AVX-512F, but Skylake thermal throttling made AVX-512VL more attractive and possible to do with negligable difference. Signed-off-by: Jason A. Donenfeld Signed-off-by: Samuel Neves Co-developed-by: Samuel Nev

[PATCH net-next v7 24/28] zinc: Curve25519 ARM implementation

2018-10-05 Thread Jason A. Donenfeld
This ports the SUPERCOP implementation for usage in kernel space. In addition to the usual header, macro, and style changes required for kernel space, it makes a few small changes to the code: - The stack alignment is relaxed to 16 bytes. - Superfluous mov statements have been removed. - ldr

[PATCH net-next v7 23/28] zinc: import Bernstein and Schwabe's Curve25519 ARM implementation

2018-10-05 Thread Jason A. Donenfeld
This comes from Dan Bernstein and Peter Schwabe's public domain NEON code, and is included here in raw form so that subsequent commits that fix these up for the kernel can see how it has changed. This code does have some entirely cosmetic formatting differences, adding indentation and so forth, so

[PATCH net-next v7 26/28] crypto: port ChaCha20 to Zinc

2018-10-05 Thread Jason A. Donenfeld
Now that ChaCha20 is in Zinc, we can have the crypto API code simply call into it. The crypto API expects to have a stored key per instance and independent nonces, so we follow suite and store the key and initialize the nonce independently. Signed-off-by: Jason A. Donenfeld Cc: Samuel Neves Cc:

[PATCH net-next v7 25/28] crypto: port Poly1305 to Zinc

2018-10-05 Thread Jason A. Donenfeld
Now that Poly1305 is in Zinc, we can have the crypto API code simply call into it. We have to do a little bit of book keeping here, because the crypto API receives the key in the first few calls to update. Signed-off-by: Jason A. Donenfeld Cc: Samuel Neves Cc: Andy Lutomirski Cc: Greg KH Cc: l

[PATCH net-next v7 22/28] zinc: Curve25519 x86_64 implementation

2018-10-05 Thread Jason A. Donenfeld
This implementation is the fastest available x86_64 implementation, and unlike Sandy2x, it doesn't requie use of the floating point registers at all. Instead it makes use of BMI2 and ADX, available on recent microarchitectures. The implementation was written by Armando Faz-Hernández with contributi

[PATCH net-next v7 17/28] zinc: Poly1305 MIPS32r2 and MIPS64 implementations

2018-10-05 Thread Jason A. Donenfeld
This MIPS32r2 implementation comes from René van Dorst and me and results in a nice speedup on the usual OpenWRT targets. The MIPS64 implementation from Andy Polyakov ported here results in a nice speedup on commodity Octeon hardware, and has been modified slightly from the original: - The functi

[PATCH net-next v7 14/28] zinc: import Andy Polyakov's Poly1305 ARM and ARM64 implementations

2018-10-05 Thread Jason A. Donenfeld
These NEON and non-NEON implementations come from Andy Polyakov's implementation, and are included here in raw form without modification, so that subsequent commits that fix these up for the kernel can see how it has changed. While this is CRYPTOGAMS code, the originating code for this happens to

[PATCH net-next v7 15/28] zinc: Poly1305 ARM and ARM64 implementations

2018-10-05 Thread Jason A. Donenfeld
These wire Andy Polyakov's implementations up to the kernel. We make a few small changes to the assembly: - Entries and exits use the proper kernel convention macro. - CPU feature checking is done in C by the glue code, so that has been removed from the assembly. - The function names have been r

[PATCH net-next v7 03/28] zinc: introduce minimal cryptography library

2018-10-05 Thread Jason A. Donenfeld
Zinc stands for "Zinc Is Neat Crypto" or "Zinc as IN Crypto". It's also short, easy to type, and plays nicely with the recent trend of naming crypto libraries after elements. The guiding principle is "don't overdo it". It's less of a library and more of a directory tree for organizing well-curated

Re: KASAN: use-after-free Read in sha512_ctx_mgr_resubmit

2018-10-05 Thread Eric Biggers
On Wed, Aug 15, 2018 at 09:00:04AM -0700, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit:7796916146b8 Merge branch 'x86-cpu-for-linus' of git://git.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=164b192240 > kernel

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

2018-10-05 Thread Eric Biggers
On Wed, Sep 26, 2018 at 07:27:04AM -0700, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit:a38523185b40 erge tag 'libnvdimm-fixes-4.19-rc6' of git://.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1767b7fa40 > kernel

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
> On 5 Oct 2018, at 20:28, Jason A. Donenfeld wrote: > > Hey Andy, > >> On Fri, Oct 5, 2018 at 7:44 PM Andy Lutomirski wrote: >> I *think* the only change to Zinc per se would be that the calls like >> chacha20_simd() would be static calls or patchable functions or >> whatever we want to cal

Re: [PATCH net-next v6 19/23] zinc: Curve25519 ARM implementation

2018-10-05 Thread Jason A. Donenfeld
Hey Dan, On Fri, Oct 05, 2018 at 03:05:38PM -, D. J. Bernstein wrote: > Of course, there are other ARM microarchitectures, and there are many > cases where different microarchitectures prefer different optimizations. > The kernel already has boot-time benchmarks for different optimizations > f

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Jason A. Donenfeld
Hey Andy, On Fri, Oct 5, 2018 at 7:44 PM Andy Lutomirski wrote: > I *think* the only change to Zinc per se would be that the calls like > chacha20_simd() would be static calls or patchable functions or > whatever we want to call them. And there could be a debugfs to > override the default select

Re: [RFC PATCH 0/9] patchable function pointers for pluggable crypto routines

2018-10-05 Thread Andy Lutomirski
On Fri, Oct 5, 2018 at 10:28 AM Ard Biesheuvel wrote: > > On 5 October 2018 at 19:26, Andy Lutomirski wrote: > > On Fri, Oct 5, 2018 at 10:15 AM Ard Biesheuvel > > wrote: > >> > >> On 5 October 2018 at 15:37, Jason A. Donenfeld wrote: > >> ... > >> > Therefore, I think this patch goes in exactl

Re: [PATCH net-next v6 00/23] WireGuard: Secure Network Tunnel

2018-10-05 Thread David Miller
From: Richard Weinberger Date: Fri, 5 Oct 2018 15:37:57 +0200 > And I strongly vote that Herbert Xu shall remain the maintainer of > the whole crypto system (including zinc!) in the kernel. I 100% agree with this.

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Andy Lutomirski
On Fri, Oct 5, 2018 at 10:38 AM Jason A. Donenfeld wrote: > > On Fri, Oct 5, 2018 at 7:29 PM Andy Lutomirski wrote: > > (None of this is to say that I disagree with Jason, though -- I'm not > > entirely convinced that this makes sense for Zinc. But maybe it can > > be done in a way that makes ev

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Jason A. Donenfeld
On Fri, Oct 5, 2018 at 7:29 PM Andy Lutomirski wrote: > (None of this is to say that I disagree with Jason, though -- I'm not > entirely convinced that this makes sense for Zinc. But maybe it can > be done in a way that makes everyone happy.) Zinc indeed will continue to push in the simpler and

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Andy Lutomirski
On Fri, Oct 5, 2018 at 10:23 AM Ard Biesheuvel wrote: > > On 5 October 2018 at 19:20, Andy Lutomirski wrote: > > On Fri, Oct 5, 2018 at 10:11 AM Ard Biesheuvel > > wrote: > >> > >> On 5 October 2018 at 18:58, Andy Lutomirski wrote: > >> > On Fri, Oct 5, 2018 at 8:24 AM Ard Biesheuvel > >> > w

Re: [RFC PATCH 0/9] patchable function pointers for pluggable crypto routines

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 19:26, Andy Lutomirski wrote: > On Fri, Oct 5, 2018 at 10:15 AM Ard Biesheuvel > wrote: >> >> On 5 October 2018 at 15:37, Jason A. Donenfeld wrote: >> ... >> > Therefore, I think this patch goes in exactly the wrong direction. I >> > mean, if you want to introduce dynamic pa

Re: [RFC PATCH 0/9] patchable function pointers for pluggable crypto routines

2018-10-05 Thread Andy Lutomirski
On Fri, Oct 5, 2018 at 10:15 AM Ard Biesheuvel wrote: > > On 5 October 2018 at 15:37, Jason A. Donenfeld wrote: > ... > > Therefore, I think this patch goes in exactly the wrong direction. I > > mean, if you want to introduce dynamic patching as a means for making > > the crypto API's dynamic dis

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 19:20, Andy Lutomirski wrote: > On Fri, Oct 5, 2018 at 10:11 AM Ard Biesheuvel > wrote: >> >> On 5 October 2018 at 18:58, Andy Lutomirski wrote: >> > On Fri, Oct 5, 2018 at 8:24 AM Ard Biesheuvel >> > wrote: >> >> >> >> On 5 October 2018 at 17:08, Andy Lutomirski wrote: >

Re: [PATCH] crypto: x86/aes-ni - fix build error following fpu template removal

2018-10-05 Thread Eric Biggers
On Fri, Oct 05, 2018 at 07:16:13PM +0200, Ard Biesheuvel wrote: > On 5 October 2018 at 19:13, Eric Biggers wrote: > > From: Eric Biggers > > > > aesni-intel_glue.c still calls crypto_fpu_init() and crypto_fpu_exit() > > to register/unregister the "fpu" template. But these functions don't > > exi

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Andy Lutomirski
On Fri, Oct 5, 2018 at 10:11 AM Ard Biesheuvel wrote: > > On 5 October 2018 at 18:58, Andy Lutomirski wrote: > > On Fri, Oct 5, 2018 at 8:24 AM Ard Biesheuvel > > wrote: > >> > >> On 5 October 2018 at 17:08, Andy Lutomirski wrote: > >> > > >> > > >> >> On Oct 5, 2018, at 7:14 AM, Peter Zijlstr

Re: [PATCH] crypto: x86/aes-ni - fix build error following fpu template removal

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 19:13, Eric Biggers wrote: > From: Eric Biggers > > aesni-intel_glue.c still calls crypto_fpu_init() and crypto_fpu_exit() > to register/unregister the "fpu" template. But these functions don't > exist anymore, causing a build error. Remove the calls to them. > > Fixes: 944

Re: [RFC PATCH 0/9] patchable function pointers for pluggable crypto routines

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 15:37, Jason A. Donenfeld wrote: ... > Therefore, I think this patch goes in exactly the wrong direction. I > mean, if you want to introduce dynamic patching as a means for making > the crypto API's dynamic dispatch stuff not as slow in a post-spectre > world, sure, go for it;

[PATCH] crypto: x86/aes-ni - fix build error following fpu template removal

2018-10-05 Thread Eric Biggers
From: Eric Biggers aesni-intel_glue.c still calls crypto_fpu_init() and crypto_fpu_exit() to register/unregister the "fpu" template. But these functions don't exist anymore, causing a build error. Remove the calls to them. Fixes: 944585a64f5e ("crypto: x86/aes-ni - remove special handling of A

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 18:58, Andy Lutomirski wrote: > On Fri, Oct 5, 2018 at 8:24 AM Ard Biesheuvel > wrote: >> >> On 5 October 2018 at 17:08, Andy Lutomirski wrote: >> > >> > >> >> On Oct 5, 2018, at 7:14 AM, Peter Zijlstra wrote: >> >> >> >>> On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Bies

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Andy Lutomirski
On Fri, Oct 5, 2018 at 8:24 AM Ard Biesheuvel wrote: > > On 5 October 2018 at 17:08, Andy Lutomirski wrote: > > > > > >> On Oct 5, 2018, at 7:14 AM, Peter Zijlstra wrote: > >> > >>> On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: > >>> diff --git a/include/linux/ffp.h b/include/l

Re: Crypto Fixes for 4.19

2018-10-05 Thread Greg KH
On Fri, Oct 05, 2018 at 10:08:30AM +0800, Herbert Xu wrote: > Hi Greg: > > This push fixes the following issues: > > - Out-of-bound stack access in qat. > - Illegal schedule in mxs-dcp. > - Memory corruption in chelsio. > - Incorrect pointer computation in caam. > > > Please pull from > > git

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 17:08, Andy Lutomirski wrote: > > >> On Oct 5, 2018, at 7:14 AM, Peter Zijlstra wrote: >> >>> On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: >>> diff --git a/include/linux/ffp.h b/include/linux/ffp.h >>> new file mode 100644 >>> index ..8fc3b4c9b3

Re: [PATCH net-next v6 19/23] zinc: Curve25519 ARM implementation

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 17:05, D. J. Bernstein wrote: > For the in-order ARM Cortex-A8 (the target for this code), adjacent > multiply-add instructions forward summands quickly. A simple in-order > dot-product computation has no latency problems, while interleaving > computations, as suggested in thi

Re: [PATCH net-next v6 19/23] zinc: Curve25519 ARM implementation

2018-10-05 Thread D. J. Bernstein
For the in-order ARM Cortex-A8 (the target for this code), adjacent multiply-add instructions forward summands quickly. A simple in-order dot-product computation has no latency problems, while interleaving computations, as suggested in this thread, creates problems. Also, on this microarchitecture,

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Andy Lutomirski
> On Oct 5, 2018, at 7:14 AM, Peter Zijlstra wrote: > >> On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: >> diff --git a/include/linux/ffp.h b/include/linux/ffp.h >> new file mode 100644 >> index ..8fc3b4c9b38f >> --- /dev/null >> +++ b/include/linux/ffp.h >> @@ -0,

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 16:14, Peter Zijlstra wrote: > On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: >> diff --git a/include/linux/ffp.h b/include/linux/ffp.h >> new file mode 100644 >> index ..8fc3b4c9b38f >> --- /dev/null >> +++ b/include/linux/ffp.h >> @@ -0,0 +1,43 @

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Peter Zijlstra
On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: > diff --git a/include/linux/ffp.h b/include/linux/ffp.h > new file mode 100644 > index ..8fc3b4c9b38f > --- /dev/null > +++ b/include/linux/ffp.h > @@ -0,0 +1,43 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#ifndef

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
On 5 October 2018 at 15:57, Peter Zijlstra wrote: > On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: >> Add a function pointer abstraction that can be implemented by the arch >> in a manner that avoids the downsides of function pointers, i.e., the >> fact that they are typically loc

Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Peter Zijlstra
On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: > Add a function pointer abstraction that can be implemented by the arch > in a manner that avoids the downsides of function pointers, i.e., the > fact that they are typically located in a writable data section, and > their vulnerabili

Re: [PATCH net-next v6 00/23] WireGuard: Secure Network Tunnel

2018-10-05 Thread Richard Weinberger
Am Freitag, 5. Oktober 2018, 15:46:29 CEST schrieb Jason A. Donenfeld: > On Fri, Oct 5, 2018 at 3:38 PM Richard Weinberger > wrote: > > So we will have two competing crypo stacks in the kernel? > > Having a lightweight crypto API is a good thing but I really don't like the > > idea > > of having

Re: [PATCH net-next v6 00/23] WireGuard: Secure Network Tunnel

2018-10-05 Thread Jason A. Donenfeld
On Fri, Oct 5, 2018 at 3:38 PM Richard Weinberger wrote: > So we will have two competing crypo stacks in the kernel? > Having a lightweight crypto API is a good thing but I really don't like the > idea > of having zinc parallel to the existing crypto stack. No, as you've seen in this patchset, t

Re: [RFC PATCH 0/9] patchable function pointers for pluggable crypto routines

2018-10-05 Thread Jason A. Donenfeld
Hi Ard, On Fri, Oct 5, 2018 at 10:13 AM Ard Biesheuvel wrote: > At the moment, the Zinc library [1] is being proposed as a solution for that, > and while it does address the usability problems, it does a lot more than > that, and what we end up with is a lot less flexible than what we have now.

Re: [PATCH net-next v6 00/23] WireGuard: Secure Network Tunnel

2018-10-05 Thread Richard Weinberger
On Fri, Oct 5, 2018 at 3:14 PM Jason A. Donenfeld wrote: > On Wed, Oct 3, 2018 at 8:49 AM Eric Biggers wrote: > > It's not really about the name, though. It's actually about the whole way > > of > > thinking about the submission. Is it a new special library with its own > > things > > going o

Re: [PATCH net-next v6 00/23] WireGuard: Secure Network Tunnel

2018-10-05 Thread Jason A. Donenfeld
Hi Eric, On Wed, Oct 3, 2018 at 8:49 AM Eric Biggers wrote: > It's not really about the name, though. It's actually about the whole way of > thinking about the submission. Is it a new special library with its own > things > going on, or is it just some crypto helper functions? It's really jus

set_cpus_allowed_ptr() usage in FREESCALE CAAM

2018-10-05 Thread Sebastian Andrzej Siewior
Hi, this block: |int caam_qi_shutdown(struct device *qidev) | { | struct cpumask old_cpumask = current->cpus_allowed; … | /* | * QMan driver requires CGRs to be deleted from same CPU from where they | * were instantiated. Hence we get the module removal execute f

[RFC PATCH 1/9] kernel: add support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
Add a function pointer abstraction that can be implemented by the arch in a manner that avoids the downsides of function pointers, i.e., the fact that they are typically located in a writable data section, and their vulnerability to Spectre like defects. The FFP (or fast function pointer) is calla

[RFC PATCH 5/9] crypto: crc-t10dif/arm64 - move PMULL based code into core library

2018-10-05 Thread Ard Biesheuvel
Move the PMULL based routines out of the crypto API into the core CRC-T10DIF library. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/crct10dif-ce-glue.c | 61 +--- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/arch/arm64/crypto/crct10dif-ce-glue.c b/arch/a

[RFC PATCH 3/9] crypto: crc-t10dif - make crc_t10dif a static inline

2018-10-05 Thread Ard Biesheuvel
crc_t10dif() is a trivial wrapper around crc_t10dif_update() so move it into the header file as a static inline function. Signed-off-by: Ard Biesheuvel --- include/linux/crc-t10dif.h | 6 +- lib/crc-t10dif.c | 6 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a

[RFC PATCH 9/9] crypto: crc-t10dif/x86 - move PMULL based code into core library

2018-10-05 Thread Ard Biesheuvel
Move the PMULL based routines out of the crypto API into the core CRC-T10DIF library. Signed-off-by: Ard Biesheuvel --- arch/x86/crypto/crct10dif-pclmul_glue.c | 98 +++- 1 file changed, 13 insertions(+), 85 deletions(-) diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/ar

[RFC PATCH 6/9] crypto: crc-t10dif/arm - move PMULL based code into core library

2018-10-05 Thread Ard Biesheuvel
Move the PMULL based routines out of the crypto API into the core CRC-T10DIF library. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/crct10dif-ce-glue.c | 78 ++-- 1 file changed, 22 insertions(+), 56 deletions(-) diff --git a/arch/arm/crypto/crct10dif-ce-glue.c b/arch/arm/c

[RFC PATCH 4/9] crypto: crc-t10dif - use patchable function pointer for core update routine

2018-10-05 Thread Ard Biesheuvel
Use a patchable function pointer for the core CRC-T10DIF transform so that we can allow modules to supersede this transform based on platform capabilities. Signed-off-by: Ard Biesheuvel --- crypto/Kconfig | 1 + crypto/Makefile| 2 +- crypto/crct10dif_common.c | 82

[RFC PATCH 2/9] arm64: kernel: add arch support for patchable function pointers

2018-10-05 Thread Ard Biesheuvel
Implement arm64 support for patchable function pointers by emitting them as branch instructions (and a couple of NOPs in case the new target is out of range of a normal branch instruction.) Signed-off-by: Ard Biesheuvel --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/ffp.h | 35 +

[RFC PATCH 8/9] crypto: crc-t10dif/powerpc - move PMULL based code into core library

2018-10-05 Thread Ard Biesheuvel
Move the PMULL based routines out of the crypto API into the core CRC-T10DIF library. Signed-off-by: Ard Biesheuvel --- arch/powerpc/crypto/crct10dif-vpmsum_glue.c | 55 +++- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/arch/powerpc/crypto/crct10dif-vpmsum_glue.

[RFC PATCH 7/9] crypto: crct10dif/generic - switch crypto API driver to core library

2018-10-05 Thread Ard Biesheuvel
Signed-off-by: Ard Biesheuvel --- crypto/crct10dif_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/crct10dif_generic.c b/crypto/crct10dif_generic.c index 8e94e29dc6fc..9ea4242c4921 100644 --- a/crypto/crct10dif_generic.c +++ b/crypto/crct10dif_generic.c @@

[RFC PATCH 0/9] patchable function pointers for pluggable crypto routines

2018-10-05 Thread Ard Biesheuvel
Linux's crypto API is widely regarded as being difficult to use for cases where support for asynchronous accelerators or runtime dispatch of algorithms (i.e., passed in as a string) are not needed. This leads to kludgy code and also to actual security issues [0], although arguably, using AES in the