[RFC PATCH 0/2] Check codeSigning extended key usage extension

2020-10-19 Thread Lee, Chun-Yi
NIAP PP_OS certification requests that the OS shall validate the CodeSigning extended key usage extension field for integrity verifiction of exectable code: https://www.niap-ccevs.org/MMO/PP/-442-/ FIA_X509_EXT.1.1 This patchset adds the logic for parsing the codeSigning EKU extension

[RFC PATCH 1/2] X.509: Add CodeSigning extended key usage parsing

2020-10-19 Thread Lee, Chun-Yi
This patch adds the logic for parsing the CodeSign extended key usage extension in X.509. The parsing result will be set to the eku flag which is carried by public key. It can be used in the PKCS#7 verification. Signed-off-by: "Lee, Chun-Yi" --- crypto/asymmetric_keys/x509_cert_parser.c | 24 +++

[RFC PATCH 2/2] PKCS#7: Check codeSigning EKU for kernel module and kexec pe verification

2020-10-19 Thread Lee, Chun-Yi
This patch adds the logic for checking the CodeSigning extended key usage extenstion when verifying signature of kernel module or kexec PE binary in PKCS#7. Signed-off-by: "Lee, Chun-Yi" --- certs/system_keyring.c | 2 +- crypto/asymmetric_keys/Kconfig | 10 ++ crypt

Re: [RFC] treewide: cleanup unreachable breaks

2020-10-19 Thread Jason Gunthorpe
On Mon, Oct 19, 2020 at 12:42:15PM -0700, Nick Desaulniers wrote: > On Sat, Oct 17, 2020 at 10:43 PM Greg KH wrote: > > > > On Sat, Oct 17, 2020 at 09:09:28AM -0700, t...@redhat.com wrote: > > > From: Tom Rix > > > > > > This is a upcoming change to clean up a new warning treewide. > > > I am won

[PATCH v36 05/13] LRNG - add common generic hash support

2020-10-19 Thread Stephan Müller
The LRNG switchable DRNG support also allows the replacement of the hash implementation used as conditioning component. The common generic hash support code provides the required callbacks using the synchronous hash implementations of the kernel crypto API. All synchronous hash implementations sup

[PATCH v36 12/13] LRNG - add interface for gathering of raw entropy

2020-10-19 Thread Stephan Müller
The test interface allows a privileged process to capture the raw unconditioned noise that is collected by the LRNG for statistical analysis. Such testing allows the analysis how much entropy the interrupt noise source provides on a given platform. Extracted noise data is not used to seed the LRNG.

[PATCH v36 01/13] Linux Random Number Generator

2020-10-19 Thread Stephan Müller
In an effort to provide a flexible implementation for a random number generator that also delivers entropy during early boot time, allows replacement of the deterministic random number generation mechanism, implement the various components in separate code for easier maintenance, and provide compli

[PATCH v36 03/13] LRNG - sysctls and /proc interface

2020-10-19 Thread Stephan Müller
The LRNG sysctl interface provides the same controls as the existing /dev/random implementation. These sysctls behave identically and are implemented identically. The goal is to allow a possible merge of the existing /dev/random implementation with this implementation which implies that this patch

[PATCH v36 07/13] LRNG - add SP800-90A DRBG extension

2020-10-19 Thread Stephan Müller
Using the LRNG switchable DRNG support, the SP800-90A DRBG extension is implemented. The DRBG uses the kernel crypto API DRBG implementation. In addition, it uses the kernel crypto API SHASH support to provide the hashing operation. The DRBG supports the choice of either a CTR DRBG using AES-256,

[PATCH v36 02/13] LRNG - allocate one DRNG instance per NUMA node

2020-10-19 Thread Stephan Müller
In order to improve NUMA-locality when serving getrandom(2) requests, allocate one DRNG instance per node. The DRNG instance that is present right from the start of the kernel is reused as the first per-NUMA-node DRNG. For all remaining online NUMA nodes a new DRNG instance is allocated. During b

[PATCH v36 04/13] LRNG - add switchable DRNG support

2020-10-19 Thread Stephan Müller
The DRNG switch support allows replacing the DRNG mechanism of the LRNG. The switching support rests on the interface definition of include/linux/lrng.h. A new DRNG is implemented by filling in the interface defined in this header file. In addition to the DRNG, the extension also has to provide a

[PATCH v36 13/13] LRNG - add power-on and runtime self-tests

2020-10-19 Thread Stephan Müller
Parts of the LRNG are already covered by self-tests, including: * Self-test of SP800-90A DRBG provided by the Linux kernel crypto API. * Self-test of the PRNG provided by the Linux kernel crypto API. * Raw noise source data testing including SP800-90B compliant tests when enabling CONFIG_LRNG_

[PATCH v36 06/13] crypto: DRBG - externalize DRBG functions for LRNG

2020-10-19 Thread Stephan Müller
This patch allows several DRBG functions to be called by the LRNG kernel code paths outside the drbg.c file. CC: Torsten Duwe CC: "Eric W. Biederman" CC: "Alexander E. Patrakov" CC: "Ahmed S. Darwish" CC: "Theodore Y. Ts'o" CC: Willy Tarreau CC: Matthew Garrett CC: Vito Caputo CC: Andreas

[PATCH v36 00/13] /dev/random - a new approach

2020-10-19 Thread Stephan Müller
Hi, The following patch set provides a different approach to /dev/random which is called Linux Random Number Generator (LRNG) to collect entropy within the Linux kernel. It provides the same API and ABI and can be used as a drop-in replacement. The LRNG implements at least all features of the exi

[PATCH v36 09/13] crypto: provide access to a static Jitter RNG state

2020-10-19 Thread Stephan Müller
To support the LRNG operation which uses the Jitter RNG separately from the kernel crypto API, at a time where potentially the regular memory management is not yet initialized, the Jitter RNG needs to provide a state whose memory is defined at compile time. As only once instance will ever be needed

[PATCH v36 11/13] LRNG - add SP800-90B compliant health tests

2020-10-19 Thread Stephan Müller
Implement health tests for LRNG's slow noise sources as mandated by SP-800-90B The file contains the following health tests: - stuck test: The stuck test calculates the first, second and third discrete derivative of the time stamp to be processed by the hash for the per-CPU entropy pool. Only

[PATCH v36 08/13] LRNG - add kernel crypto API PRNG extension

2020-10-19 Thread Stephan Müller
Add runtime-pluggable support for all PRNGs that are accessible via the kernel crypto API, including hardware PRNGs. The PRNG is selected with the module parameter drng_name where the name must be one that the kernel crypto API can resolve into an RNG. This allows using of the kernel crypto API PR

[PATCH v36 10/13] LRNG - add Jitter RNG fast noise source

2020-10-19 Thread Stephan Müller
The Jitter RNG fast noise source implemented as part of the kernel crypto API is queried for 256 bits of entropy at the time the seed buffer managed by the LRNG is about to be filled. CC: Torsten Duwe CC: "Eric W. Biederman" CC: "Alexander E. Patrakov" CC: "Ahmed S. Darwish" CC: "Theodore Y. T

[PATCH] crypto: atmel-sha: remove unneeded break

2020-10-19 Thread trix
From: Tom Rix A break is not needed if it is preceded by a return Signed-off-by: Tom Rix --- drivers/crypto/atmel-sha.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 75ccf41a7cb9..0eb6f54e3b66 100644 --- a/drivers/crypto/atmel-

Re: [PATCH v8,net-next,03/12] octeontx2-af: add debugfs entries for CPT block

2020-10-19 Thread kernel test robot
'--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Srujana-Challa/octeontx2-af-add-debugfs-entries-for-CPT-block/20201019-195132 base: https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master config: powerpc-al

Re: [PATCH v8,net-next,03/12] octeontx2-af: add debugfs entries for CPT block

2020-10-19 Thread kernel test robot
documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Srujana-Challa/octeontx2-af-add-debugfs-entries-for-CPT-block/20201019-195132 base: https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master config: ia64-allmodconfig (attached

Re: gssapi, crypto and afs/rxrpc

2020-10-19 Thread J. Bruce Fields
On Fri, Oct 16, 2020 at 05:18:26PM +0100, David Howells wrote: > Hi Herbert, Dave, Trond, > > I've written basic gssapi-derived security support for AF_RXRPC: > > > https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-rxgk > > I've borrowed some bits from net

Re: [PATCH v8,net-next,00/12] Add Support for Marvell OcteonTX2

2020-10-19 Thread Jakub Kicinski
On Mon, 19 Oct 2020 17:11:45 +0530 Srujana Challa wrote: > This series introduces crypto(CPT) drivers(PF & VF) for Marvell OcteonTX2 > CN96XX Soc. e have already sent a pull request for 5.10 and therefore net-next is closed for new drivers, features, and code refactoring. Please repost when net-

[PATCH 2/5] crypto: lib/sha256 - Don't clear temporary variables

2020-10-19 Thread Arvind Sankar
The assignments to clear a through h and t1/t2 are optimized out by the compiler because they are unused after the assignments. These variables shouldn't be very sensitive: t1/t2 can be calculated from a through h, so they don't reveal any additional information. Knowing a through h is equivalent

[PATCH 0/5] crypto: lib/sha256 - cleanup/optimization

2020-10-19 Thread Arvind Sankar
Patch 1 -- Use memzero_explicit() instead of structure assignment/plain memset() to clear sensitive state. Patch 2 -- I am not sure about this one: currently the temporary variables used in the generic sha256 implementation are cleared, but the clearing is optimized away due to lack of compiler ba

[PATCH 1/5] crypto: Use memzero_explicit() for clearing state

2020-10-19 Thread Arvind Sankar
Without the barrier_data() inside memzero_explicit(), the compiler may optimize away the state-clearing if it can tell that the state is not used afterwards. At least in lib/crypto/sha256.c:__sha256_final(), the function can get inlined into sha256(), in which case the memset is optimized away. Si

[PATCH 5/5] crypto: lib/sha256 - Unroll LOAD and BLEND loops

2020-10-19 Thread Arvind Sankar
Unrolling the LOAD and BLEND loops improves performance by ~8% on x86 while not increasing code size too much. Signed-off-by: Arvind Sankar --- lib/crypto/sha256.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/crypto/sha256.c b/lib/crypto/sha25

[PATCH 3/5] crypto: lib/sha256 - Clear W[] in sha256_update() instead of sha256_transform()

2020-10-19 Thread Arvind Sankar
The temporary W[] array is currently zeroed out once every call to sha256_transform(), i.e. once every 64 bytes of input data. Moving it to sha256_update() instead so that it is cleared only once per update can save about 2-3% of the total time taken to compute the digest, with a reasonable memset(

[PATCH 4/5] crypto: lib/sha256 - Unroll SHA256 loop 8 times intead of 64

2020-10-19 Thread Arvind Sankar
This reduces code size substantially (on x86_64 with gcc-10 the size of sha256_update() goes from 7593 bytes to 1952 bytes including the new SHA256_K array), and on x86 is slightly faster than the full unroll. Signed-off-by: Arvind Sankar --- lib/crypto/sha256.c | 164 ---

[PATCH v8,net-next,12/12] crypto: octeontx2: register with linux crypto framework

2020-10-19 Thread Srujana Challa
CPT offload module utilises the linux crypto framework to offload crypto processing. This patch registers supported algorithms by calling registration functions provided by the kernel crypto API. The module currently supports: - AES block cipher in CBC,ECB,XTS and CFB mode. - 3DES block cipher in

[PATCH v8,net-next,06/12] crypto: octeontx2: enable SR-IOV and mailbox communication with VF

2020-10-19 Thread Srujana Challa
Adds 'sriov_configure' to enable/disable virtual functions (VFs). Also Initializes VF<=>PF mailbox IRQs, register handlers for processing these mailbox messages. Admin function (AF) handles resource allocation and configuration for PFs and their VFs. PFs request the AF directly, via mailboxes. Unl

[PATCH v8,net-next,09/12] crypto: octeontx2: add support to get engine capabilities

2020-10-19 Thread Srujana Challa
Adds support to get engine capabilities and adds a new mailbox to share capabilities with VF driver. Signed-off-by: Suheil Chandran Signed-off-by: Srujana Challa --- .../marvell/octeontx2/otx2_cpt_common.h | 36 .../marvell/octeontx2/otx2_cpt_reqmgr.h | 51 ++ drivers/cry

[PATCH v8,net-next,10/12] crypto: octeontx2: add virtual function driver support

2020-10-19 Thread Srujana Challa
Add support for the Marvell OcteonTX2 CPT virtual function driver. This patch includes probe, PCI specific initialization and interrupt handling. Signed-off-by: Suheil Chandran Signed-off-by: Srujana Challa --- drivers/crypto/marvell/octeontx2/Makefile | 4 +- .../marvell/octeontx2/otx2_c

[PATCH v8,net-next,11/12] crypto: octeontx2: add support to process the crypto request

2020-10-19 Thread Srujana Challa
Attach LFs to CPT VF to process the crypto requests and register LF interrupts. Signed-off-by: Suheil Chandran Signed-off-by: Srujana Challa --- drivers/crypto/marvell/octeontx2/Makefile | 2 +- .../marvell/octeontx2/otx2_cpt_common.h | 3 + .../marvell/octeontx2/otx2_cpt_reqmgr.h

[PATCH v8,net-next,08/12] crypto: octeontx2: add LF framework

2020-10-19 Thread Srujana Challa
CPT RVU Local Functions(LFs) needs to be attached to the PF/VF to submit the instructions to CPT. This patch adds the interface to initialize and attach the LFs. It also adds interface to register the LF's interrupts. Signed-off-by: Suheil Chandran Signed-off-by: Srujana Challa --- drivers/cryp

[PATCH v8,net-next,07/12] crypto: octeontx2: load microcode and create engine groups

2020-10-19 Thread Srujana Challa
CPT includes microcoded GigaCypher symmetric engines(SEs), IPsec symmetric engines(IEs), and asymmetric engines (AEs). Each engine receives CPT instructions from the engine groups it has subscribed to. This patch loads microcode, configures three engine groups(one for SEs, one for IEs and one for A

[PATCH v8,net-next,01/12] octeontx2-pf: move lmt flush to include/linux/soc

2020-10-19 Thread Srujana Challa
On OcteonTX2 platform CPT instruction enqueue and NIX packet send are only possible via LMTST operations which uses LDEOR instruction. This patch moves lmt flush function from OcteonTX2 nic driver to include/linux/soc since it will be used by OcteonTX2 CPT and NIC driver for LMTST. Signed-off-by:

[PATCH v8,net-next,04/12] drivers: crypto: add Marvell OcteonTX2 CPT PF driver

2020-10-19 Thread Srujana Challa
Adds skeleton for the Marvell OcteonTX2 CPT physical function driver which includes probe, PCI specific initialization and hardware register defines. RVU defines are present in AF driver (drivers/net/ethernet/marvell/octeontx2/af), header files from AF driver are included here to avoid duplication.

[PATCH v8,net-next,05/12] crypto: octeontx2: add mailbox communication with AF

2020-10-19 Thread Srujana Challa
In the resource virtualization unit (RVU) each of the PF and AF (admin function) share a 64KB of reserved memory region for communication. This patch initializes PF <=> AF mailbox IRQs, registers handlers for processing these communication messages. Signed-off-by: Suheil Chandran Signed-off-by: S

[PATCH v8,net-next,00/12] Add Support for Marvell OcteonTX2

2020-10-19 Thread Srujana Challa
This series introduces crypto(CPT) drivers(PF & VF) for Marvell OcteonTX2 CN96XX Soc. OcteonTX2 SOC's resource virtualization unit (RVU) supports multiple physical and virtual functions. Each of the PF/VF's functionality is determined by what kind of resources are attached to it. When the CPT bloc

[PATCH v8,net-next,03/12] octeontx2-af: add debugfs entries for CPT block

2020-10-19 Thread Srujana Challa
Add entries to debugfs at /sys/kernel/debug/octeontx2/cpt. cpt_pc: dump cpt performance HW registers. Usage: cat /sys/kernel/debug/octeontx2/cpt/cpt_pc cpt_ae_sts: show cpt asymmetric engines current state Usage: cat /sys/kernel/debug/octeontx2/cpt/cpt_ae_sts cpt_se_sts: show cpt symmetric engin

[PATCH v8,net-next,02/12] octeontx2-af: add mailbox interface for CPT

2020-10-19 Thread Srujana Challa
On OcteonTX2 SoC, the admin function (AF) is the only one with all priviliges to configure HW and alloc resources, PFs and it's VFs have to request AF via mailbox for all their needs. This patch adds a mailbox interface for CPT PFs and VFs to allocate resources for cryptography. Signed-off-by: Suh