Commit 81e8c10d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull crypto updates from Herbert Xu:
 "API:
   - Introduce crypto_shash_tfm_digest() and use it wherever possible.
   - Fix use-after-free and race in crypto_spawn_alg.
   - Add support for parallel and batch requests to crypto_engine.

  Algorithms:
   - Update jitter RNG for SP800-90B compliance.
   - Always use jitter RNG as seed in drbg.

  Drivers:
   - Add Arm CryptoCell driver cctrng.
   - Add support for SEV-ES to the PSP driver in ccp"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (114 commits)
  crypto: hisilicon - fix driver compatibility issue with different versions of devices
  crypto: engine - do not requeue in case of fatal error
  crypto: cavium/nitrox - Fix a typo in a comment
  crypto: hisilicon/qm - change debugfs file name from qm_regs to regs
  crypto: hisilicon/qm - add DebugFS for xQC and xQE dump
  crypto: hisilicon/zip - add debugfs for Hisilicon ZIP
  crypto: hisilicon/hpre - add debugfs for Hisilicon HPRE
  crypto: hisilicon/sec2 - add debugfs for Hisilicon SEC
  crypto: hisilicon/qm - add debugfs to the QM state machine
  crypto: hisilicon/qm - add debugfs for QM
  crypto: stm32/crc32 - protect from concurrent accesses
  crypto: stm32/crc32 - don't sleep in runtime pm
  crypto: stm32/crc32 - fix multi-instance
  crypto: stm32/crc32 - fix run-time self test issue.
  crypto: stm32/crc32 - fix ext4 chksum BUG_ON()
  crypto: hisilicon/zip - Use temporary sqe when doing work
  crypto: hisilicon - add device error report through abnormal irq
  crypto: hisilicon - remove codes of directly report device errors through MSI
  crypto: hisilicon - QM memory management optimization
  crypto: hisilicon - unify initial value assignment into QM
  ...
parents 729ea4e0 58ca0060
Loading
Loading
Loading
Loading
+86 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ Contact: linux-crypto@vger.kernel.org
Description:    Dump debug registers from the HPRE.
		Only available for PF.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/qm_regs
What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/regs
Date:           Sep 2019
Contact:        linux-crypto@vger.kernel.org
Description:    Dump debug registers from the QM.
@@ -44,14 +44,97 @@ What: /sys/kernel/debug/hisi_hpre/<bdf>/qm/current_q
Date:           Sep 2019
Contact:        linux-crypto@vger.kernel.org
Description:    One QM may contain multiple queues. Select specific queue to
		show its debug registers in above qm_regs.
		show its debug registers in above regs.
		Only available for PF.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/clear_enable
Date:           Sep 2019
Contact:        linux-crypto@vger.kernel.org
Description:    QM debug registers(qm_regs) read clear control. 1 means enable
Description:    QM debug registers(regs) read clear control. 1 means enable
		register read clear, otherwise 0.
		Writing to this file has no functional effect, only enable or
		disable counters clear after reading of these registers.
		Only available for PF.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/err_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of invalid interrupts for
		QM task completion.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/aeq_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of QM async event queue interrupts.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/abnormal_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of interrupts for QM abnormal event.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/create_qp_err
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of queue allocation errors.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/mb_err
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of failed QM mailbox commands.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/qm/status
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the status of the QM.
		Four states: initiated, started, stopped and closed.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/send_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of sent requests.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/recv_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of received requests.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/send_busy_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of requests sent
		with returning busy.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/send_fail_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of completed but error requests.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/invalid_req_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of invalid requests being received.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/overtime_thrhld
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Set the threshold time for counting the request which is
		processed longer than the threshold.
		0: disable(default), 1: 1 microsecond.
		Available for both PF and VF, and take no other effect on HPRE.

What:           /sys/kernel/debug/hisi_hpre/<bdf>/hpre_dfx/over_thrhld_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of time out requests.
		Available for both PF and VF, and take no other effect on HPRE.
+82 −12
Original line number Diff line number Diff line
What:           /sys/kernel/debug/hisi_sec/<bdf>/sec_dfx
Date:           Oct 2019
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the debug registers of SEC cores.
		Only available for PF.

What:           /sys/kernel/debug/hisi_sec/<bdf>/clear_enable
What:           /sys/kernel/debug/hisi_sec2/<bdf>/clear_enable
Date:           Oct 2019
Contact:        linux-crypto@vger.kernel.org
Description:    Enabling/disabling of clear action after reading
@@ -12,7 +6,7 @@ Description: Enabling/disabling of clear action after reading
		0: disable, 1: enable.
		Only available for PF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec/<bdf>/current_qm
What:           /sys/kernel/debug/hisi_sec2/<bdf>/current_qm
Date:           Oct 2019
Contact:        linux-crypto@vger.kernel.org
Description:    One SEC controller has one PF and multiple VFs, each function
@@ -20,24 +14,100 @@ Description: One SEC controller has one PF and multiple VFs, each function
		qm refers to.
		Only available for PF.

What:           /sys/kernel/debug/hisi_sec/<bdf>/qm/qm_regs
What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/qm_regs
Date:           Oct 2019
Contact:        linux-crypto@vger.kernel.org
Description:    Dump of QM related debug registers.
		Available for PF and VF in host. VF in guest currently only
		has one debug register.

What:           /sys/kernel/debug/hisi_sec/<bdf>/qm/current_q
What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/current_q
Date:           Oct 2019
Contact:        linux-crypto@vger.kernel.org
Description:    One QM of SEC may contain multiple queues. Select specific
		queue to show its debug registers in above 'qm_regs'.
		queue to show its debug registers in above 'regs'.
		Only available for PF.

What:           /sys/kernel/debug/hisi_sec/<bdf>/qm/clear_enable
What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/clear_enable
Date:           Oct 2019
Contact:        linux-crypto@vger.kernel.org
Description:    Enabling/disabling of clear action after reading
		the SEC's QM debug registers.
		0: disable, 1: enable.
		Only available for PF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/err_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of invalid interrupts for
		QM task completion.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/aeq_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of QM async event queue interrupts.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/abnormal_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of interrupts for QM abnormal event.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/create_qp_err
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of queue allocation errors.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/mb_err
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of failed QM mailbox commands.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/qm/status
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the status of the QM.
		Four states: initiated, started, stopped and closed.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/sec_dfx/send_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of sent requests.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/sec_dfx/recv_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of received requests.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/sec_dfx/send_busy_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of requests sent with returning busy.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/sec_dfx/err_bd_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of BD type error requests
		to be received.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/sec_dfx/invalid_req_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of invalid requests being received.
		Available for both PF and VF, and take no other effect on SEC.

What:           /sys/kernel/debug/hisi_sec2/<bdf>/sec_dfx/done_flag_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of completed but marked error requests
		to be received.
		Available for both PF and VF, and take no other effect on SEC.
+67 −3
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ Description: One ZIP controller has one PF and multiple VFs, each function
		has a QM. Select the QM which below qm refers to.
		Only available for PF.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/qm_regs
What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/regs
Date:           Nov 2018
Contact:        linux-crypto@vger.kernel.org
Description:    Dump of QM related debug registers.
@@ -37,14 +37,78 @@ What: /sys/kernel/debug/hisi_zip/<bdf>/qm/current_q
Date:           Nov 2018
Contact:        linux-crypto@vger.kernel.org
Description:    One QM may contain multiple queues. Select specific queue to
		show its debug registers in above qm_regs.
		show its debug registers in above regs.
		Only available for PF.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/clear_enable
Date:           Nov 2018
Contact:        linux-crypto@vger.kernel.org
Description:    QM debug registers(qm_regs) read clear control. 1 means enable
Description:    QM debug registers(regs) read clear control. 1 means enable
		register read clear, otherwise 0.
		Writing to this file has no functional effect, only enable or
		disable counters clear after reading of these registers.
		Only available for PF.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/err_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of invalid interrupts for
		QM task completion.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/aeq_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of QM async event queue interrupts.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/abnormal_irq
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of interrupts for QM abnormal event.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/create_qp_err
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of queue allocation errors.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/mb_err
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the number of failed QM mailbox commands.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/qm/status
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the status of the QM.
		Four states: initiated, started, stopped and closed.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/zip_dfx/send_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of sent requests.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/zip_dfx/recv_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of received requests.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/zip_dfx/send_busy_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of requests received
		with returning busy.
		Available for both PF and VF, and take no other effect on ZIP.

What:           /sys/kernel/debug/hisi_zip/<bdf>/zip_dfx/err_bd_cnt
Date:           Apr 2020
Contact:        linux-crypto@vger.kernel.org
Description:    Dump the total number of BD type error requests
		to be received.
		Available for both PF and VF, and take no other effect on ZIP.
+54 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/rng/arm-cctrng.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Arm TrustZone CryptoCell TRNG engine

maintainers:
  - Hadar Gat <hadar.gat@arm.com>

description: |+
  Arm TrustZone CryptoCell TRNG (True Random Number Generator) engine.

properties:
  compatible:
    enum:
      - arm,cryptocell-713-trng
      - arm,cryptocell-703-trng

  interrupts:
    maxItems: 1

  reg:
    maxItems: 1

  arm,rosc-ratio:
    description:
      Arm TrustZone CryptoCell TRNG engine has 4 ring oscillators.
      Sampling ratio values for these 4 ring oscillators. (from calibration)
    allOf:
      - $ref: /schemas/types.yaml#/definitions/uint32-array
      - items:
          maxItems: 4

  clocks:
    maxItems: 1

required:
  - compatible
  - interrupts
  - reg
  - arm,rosc-ratio

additionalProperties: false

examples:
  - |
    arm_cctrng: rng@60000000 {
        compatible = "arm,cryptocell-713-trng";
        interrupts = <0 29 4>;
        reg = <0x60000000 0x10000>;
        arm,rosc-ratio = <5000 1000 500 0>;
    };
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ SipHash - a short input PRF
SipHash is a cryptographically secure PRF -- a keyed hash function -- that
performs very well for short inputs, hence the name. It was designed by
cryptographers Daniel J. Bernstein and Jean-Philippe Aumasson. It is intended
as a replacement for some uses of: `jhash`, `md5_transform`, `sha_transform`,
as a replacement for some uses of: `jhash`, `md5_transform`, `sha1_transform`,
and so forth.

SipHash takes a secret key filled with randomly generated numbers and either
Loading