Commit 39a5101f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull crypto updates from Herbert Xu:
 "API:
   - Allow DRBG testing through user-space af_alg
   - Add tcrypt speed testing support for keyed hashes
   - Add type-safe init/exit hooks for ahash

  Algorithms:
   - Mark arc4 as obsolete and pending for future removal
   - Mark anubis, khazad, sead and tea as obsolete
   - Improve boot-time xor benchmark
   - Add OSCCA SM2 asymmetric cipher algorithm and use it for integrity

  Drivers:
   - Fixes and enhancement for XTS in caam
   - Add support for XIP8001B hwrng in xiphera-trng
   - Add RNG and hash support in sun8i-ce/sun8i-ss
   - Allow imx-rngc to be used by kernel entropy pool
   - Use crypto engine in omap-sham
   - Add support for Ingenic X1830 with ingenic"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (205 commits)
  X.509: Fix modular build of public_key_sm2
  crypto: xor - Remove unused variable count in do_xor_speed
  X.509: fix error return value on the failed path
  crypto: bcm - Verify GCM/CCM key length in setkey
  crypto: qat - drop input parameter from adf_enable_aer()
  crypto: qat - fix function parameters descriptions
  crypto: atmel-tdes - use semicolons rather than commas to separate statements
  crypto: drivers - use semicolons rather than commas to separate statements
  hwrng: mxc-rnga - use semicolons rather than commas to separate statements
  hwrng: iproc-rng200 - use semicolons rather than commas to separate statements
  hwrng: stm32 - use semicolons rather than commas to separate statements
  crypto: xor - use ktime for template benchmarking
  crypto: xor - defer load time benchmark to a later time
  crypto: hisilicon/zip - fix the uninitalized 'curr_qm_qp_num'
  crypto: hisilicon/zip - fix the return value when device is busy
  crypto: hisilicon/zip - fix zero length input in GZIP decompress
  crypto: hisilicon/zip - fix the uncleared debug registers
  lib/mpi: Fix unused variable warnings
  crypto: x86/poly1305 - Remove assignments with no effect
  hwrng: npcm - modify readl to readb
  ...
parents 865c50e1 3093e7c1
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -296,15 +296,16 @@ follows:

    struct sockaddr_alg sa = {
        .salg_family = AF_ALG,
        .salg_type = "rng", /* this selects the symmetric cipher */
        .salg_name = "drbg_nopr_sha256" /* this is the cipher name */
        .salg_type = "rng", /* this selects the random number generator */
        .salg_name = "drbg_nopr_sha256" /* this is the RNG name */
    };


Depending on the RNG type, the RNG must be seeded. The seed is provided
using the setsockopt interface to set the key. For example, the
ansi_cprng requires a seed. The DRBGs do not require a seed, but may be
seeded.
seeded. The seed is also known as a *Personalization String* in NIST SP 800-90A
standard.

Using the read()/recvmsg() system calls, random numbers can be obtained.
The kernel generates at most 128 bytes in one call. If user space
@@ -314,6 +315,16 @@ WARNING: The user space caller may invoke the initially mentioned accept
system call multiple times. In this case, the returned file descriptors
have the same state.

Following CAVP testing interfaces are enabled when kernel is built with
CRYPTO_USER_API_RNG_CAVP option:

-  the concatenation of *Entropy* and *Nonce* can be provided to the RNG via
   ALG_SET_DRBG_ENTROPY setsockopt interface. Setting the entropy requires
   CAP_SYS_ADMIN permission.

-  *Additional Data* can be provided using the send()/sendmsg() system calls,
   but only after the entropy has been set.

Zero-Copy Interface
-------------------

@@ -377,6 +388,9 @@ mentioned optname:
   provided ciphertext is assumed to contain an authentication tag of
   the given size (see section about AEAD memory layout below).

-  ALG_SET_DRBG_ENTROPY -- Setting the entropy of the random number generator.
   This option is applicable to RNG cipher type only.

User space API example
----------------------

+43 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/rng/ingenic,trng.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Bindings for DTRNG in Ingenic SoCs

maintainers:
  - 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>

description:
  The True Random Number Generator in Ingenic SoCs.

properties:
  compatible:
    enum:
      - ingenic,x1830-dtrng

  reg:
    maxItems: 1

  clocks:
    maxItems: 1

required:
  - compatible
  - reg
  - clocks

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/x1830-cgu.h>

    dtrng: trng@10072000 {
        compatible = "ingenic,x1830-dtrng";
        reg = <0x10072000 0xc>;

        clocks = <&cgu X1830_CLK_DTRNG>;
    };
...
+33 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/rng/xiphera,xip8001b-trng.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Xiphera XIP8001B-trng bindings

maintainers:
  - Atte Tommiska <atte.tommiska@xiphera.com>

description: |
  Xiphera FPGA-based true random number generator intellectual property core.

properties:
  compatible:
    const: xiphera,xip8001b-trng

  reg:
    maxItems: 1

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |
    rng@43c00000 {
        compatible = "xiphera,xip8001b-trng";
        reg = <0x43c00000 0x10000>;
    };
+2 −0
Original line number Diff line number Diff line
@@ -1174,6 +1174,8 @@ patternProperties:
    description: Shenzhen Xingbangda Display Technology Co., Ltd
  "^xinpeng,.*":
    description: Shenzhen Xinpeng Technology Co., Ltd
  "^xiphera,.*":
    description: Xiphera Ltd.
  "^xlnx,.*":
    description: Xilinx
  "^xnano,.*":
+2 −0
Original line number Diff line number Diff line
@@ -13068,7 +13068,9 @@ F: lib/packing.c
PADATA PARALLEL EXECUTION MECHANISM
M:	Steffen Klassert <steffen.klassert@secunet.com>
M:	Daniel Jordan <daniel.m.jordan@oracle.com>
L:	linux-crypto@vger.kernel.org
L:	linux-kernel@vger.kernel.org
S:	Maintained
F:	Documentation/core-api/padata.rst
F:	include/linux/padata.h
Loading