crypto: cmh - add AES skcipher/aead/cmac
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v7 1/5 dt-bindings: crypto: add Rambus CryptoManager Hub
Add device tree binding schema for the Rambus CryptoManager Hub (CMH) hardware crypto accelerator. The binding describes the parent SoC-level node with its SIC register region and one queue@N child node per mailbox the host owns, each carrying a reg (mailbox instance index), an optional interrupt, VCQ ring geometry (rambus,num-slots / rambus,slot-stride-bytes) and a rambus,cores affinity list. Which crypto cores are present is discovered from the SIC CORE_ENABLE register at probe, not described in the device tree.
Register the 'rambus' vendor prefix for Rambus Inc.
--- .../bindings/crypto/rambus,cmh-v1030.yaml | 144 ++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + 2 files changed, 146 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/rambus,cmh-v1030.yaml
Documentation/devicetree/bindings/crypto/rambus,cmh-v1030.yaml new file +144 -0
@@ -0,0 +1,144 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/rambus,cmh-v1030.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rambus CryptoManager Hub (CMH) Hardware Crypto Accelerator + +maintainers: + - Alex Ousherovitch <[email protected]> + - Saravanakrishnan Krishnamoorthy <[email protected]> + - Joel Wittenauer <[email protected]> + +description: | + The Rambus CryptoManager Hub (CMH) is a hardware cryptographic accelerator + accessed via a mailbox-based VCQ (Virtual Command Queue) interface. The + host writes VCQ command sequences into per-mailbox DMA queue buffers and + rings a doorbell; the CMH eSW processes them and signals completion via + interrupt. + + The management host statically partitions the hardware mailboxes across + the SoC's host interfaces at integration time; the set of mailboxes a + given host owns is therefore fixed and not runtime-discoverable (a + mailbox locked to a host reads as unavailable in the SIC availability + register). Each owned mailbox is described by a child node. Which + crypto cores are present is a fixed silicon-build property indicated by + the SIC CORE_ENABLE register, so cores are not described in the device + tree. Clock and reset are owned by the management host; a node + describing a non-management host has no clock or reset provider of its + own, so clocks and reset-gpios are optional. + + CMH gates access to a locked mailbox by a hardware HOST ID presented on + the bus with every access, permitting only the owning host's ID. An + integration must present a single, stable HOST ID for all accesses to a + given mailbox, independent of the issuing CPU (relevant on SMP hosts + whose interconnect encodes the issuing CPU in the HOST ID). + +properties: + compatible: + items: + - not: {} + description: SoC-specific compatible, e.g. vendor,soc-cmh + - const: rambus,cmh-v1030 + + reg: + maxItems: 1 + description: + SIC (System Interface Controller) MMIO region. The registers of + mailbox instance N are at offset N * 0x1000 within this region. + + clocks: + minItems: 1 + maxItems: 3 + description: + The "core" functional clock, and optionally the half-rate "core-div2" + clock (present only on configurations with side-channel-protected + cores) and/or the "rt" real-time tick clock. See clock-names for the + valid combinations. + + clock-names: + minItems: 1 + items: + - const: core + - enum: [core-div2, rt] + - const: rt + + reset-gpios: + maxItems: 1 + description: + Host-controlled reset for the CryptoManager Hub. The hub has two + external, active-low reset inputs -- a power-on reset and a hard + reset; where a board routes one of them to a host GPIO, that line is + described here. + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +patternProperties: + "^queue@[0-9a-f]+$": + type: object + description: + One node per hardware mailbox (VCQ command queue) this host owns. + The set of owned mailboxes is fixed by the management host at + integration time and enumerated here. + properties: + reg: + items: + - maximum: 63 + description: + 0-based mailbox instance index (0..63). The instance's + registers are at reg * 0x1000 within the SIC region. + + interrupts: + maxItems: 1 + description: Completion/error interrupt for this mailbox. + + rambus,num-slots: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, + 16384, 32768] + default: 64 + description: + Number of VCQ ring slots for this mailbox's command queue in + host DMA memory. This is a per-board, per-mailbox host-memory + ring geometry -- boards built around the same SoC (hence the + same compatible) may use different ring sizes, so it is + described per mailbox rather than derived from the compatible. + + rambus,slot-stride-bytes: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [128, 256, 512, 1024] + default: 512 + description: + Stride in bytes between consecutive VCQ ring slots for this + mailbox's command queue. Like rambus,num-slots this is a + per-board host-memory ring geometry, not derived from the + compatible. + + rambus,cores: + $ref: /schemas/types.yaml#/definitions/string-array + items: + enum: [hc, aes, sm4, sm3, hcq, qse, pke, ccp] + description: | + Core-affinity list: the crypto cores whose work is dispatched to + this mailbox. A core may appear on at most one mailbox. Cores + not listed on any mailbox are load-balanced across all mailboxes. + Optional (default: none -- the mailbox only serves the + load-balanced pool). + + required: + - reg + + additionalProperties: false + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + +additionalProperties: false
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1397,6 +1397,8 @@ patternProperties: description: RaidSonic Technology GmbH "^ralink,.*": description: Mediatek/Ralink Technology Corp. + "^rambus,.*": + description: Rambus Inc. "^ramtron,.*": description: Ramtron International "^raspberrypi,.*":
Signature · 1 line
2.43.7
PATCH v7 2/5 crypto: cmh - add core platform driver
In reply to a message not in the archiveAdd the Rambus CryptoManager Hub (CMH) hardware crypto accelerator core platform driver. This patch provides:
- Platform driver registration and probe/remove lifecycle
- Hardware configuration and core discovery
- Mailbox Queue Interface (MQI) for VCQ command submission
- Transaction manager with async completion and backlog support
- Result handler with threaded-IRQ completion
- DMA buffer management
- Debugfs instrumentation (when CONFIG_CRYPTO_DEV_CMH_DEBUG=y)
- Sysfs attributes (fw_version, hw_version, boot_status, mbx_available, mbx_count)
- Kconfig and Makefile integration
No crypto algorithms are registered yet -- those follow in subsequent patches.
The driver communicates with the hardware via a mailbox-based VCQ (Virtual Command Queue) interface. Each crypto operation is packed into VCQ command entries, submitted to a mailbox, and completed asynchronously via interrupt.
MODULE_IMPORT_NS(CRYPTO_INTERNAL) imports two symbols:
- crypto_cipher_setkey() [crypto/cipher.c, EXPORT_SYMBOL_NS_GPL]
- crypto_cipher_encrypt_one() [crypto/cipher.c, EXPORT_SYMBOL_NS_GPL]
These are the single-block cipher API used for the CCM empty-input tag computation software fallback (2 ECB encryptions + XOR). No public wrapper exists; this is the same pattern used by in-tree crypto/ccm.c.
--- Documentation/ABI/testing/debugfs-driver-cmh | 171 ++ Documentation/ABI/testing/sysfs-driver-cmh | 67 + Documentation/crypto/device_drivers/cmh.rst | 340 +++ Documentation/crypto/device_drivers/index.rst | 1 + drivers/crypto/Kconfig | 1 + drivers/crypto/Makefile | 1 + drivers/crypto/cmh/Kconfig | 62 + drivers/crypto/cmh/Makefile | 25 + drivers/crypto/cmh/cmh_config.c | 619 +++++ drivers/crypto/cmh/cmh_debugfs.c | 307 +++ drivers/crypto/cmh/cmh_dma.c | 482 ++++ drivers/crypto/cmh/cmh_main.c | 369 +++ drivers/crypto/cmh/cmh_mqi.c | 344 +++ drivers/crypto/cmh/cmh_rh.c | 1224 ++++++++++ drivers/crypto/cmh/cmh_sysfs.c | 108 + drivers/crypto/cmh/cmh_txn.c | 2118 +++++++++++++++++ drivers/crypto/cmh/include/cmh.h | 24 + drivers/crypto/cmh/include/cmh_aes_abi.h | 98 + drivers/crypto/cmh/include/cmh_ccp_abi.h | 108 + drivers/crypto/cmh/include/cmh_config.h | 105 + drivers/crypto/cmh/include/cmh_debugfs.h | 93 + drivers/crypto/cmh/include/cmh_dma.h | 249 ++ drivers/crypto/cmh/include/cmh_drbg_abi.h | 67 + drivers/crypto/cmh/include/cmh_eac_abi.h | 44 + drivers/crypto/cmh/include/cmh_hc_abi.h | 162 ++ drivers/crypto/cmh/include/cmh_hcq_abi.h | 222 ++ drivers/crypto/cmh/include/cmh_kic_abi.h | 77 + drivers/crypto/cmh/include/cmh_mqi.h | 35 + drivers/crypto/cmh/include/cmh_pke_abi.h | 272 +++ drivers/crypto/cmh/include/cmh_qse_abi.h | 201 ++ drivers/crypto/cmh/include/cmh_registers.h | 161 ++ drivers/crypto/cmh/include/cmh_rh.h | 93 + drivers/crypto/cmh/include/cmh_sm3_abi.h | 79 + drivers/crypto/cmh/include/cmh_sm4_abi.h | 101 + drivers/crypto/cmh/include/cmh_sys_abi.h | 148 ++ drivers/crypto/cmh/include/cmh_sysfs.h | 14 + drivers/crypto/cmh/include/cmh_txn.h | 481 ++++ drivers/crypto/cmh/include/cmh_vcq.h | 288 +++ 38 files changed, 9361 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-driver-cmh create mode 100644 Documentation/ABI/testing/sysfs-driver-cmh create mode 100644 Documentation/crypto/device_drivers/cmh.rst create mode 100644 drivers/crypto/cmh/Kconfig create mode 100644 drivers/crypto/cmh/Makefile create mode 100644 drivers/crypto/cmh/cmh_config.c create mode 100644 drivers/crypto/cmh/cmh_debugfs.c create mode 100644 drivers/crypto/cmh/cmh_dma.c create mode 100644 drivers/crypto/cmh/cmh_main.c create mode 100644 drivers/crypto/cmh/cmh_mqi.c create mode 100644 drivers/crypto/cmh/cmh_rh.c create mode 100644 drivers/crypto/cmh/cmh_sysfs.c create mode 100644 drivers/crypto/cmh/cmh_txn.c create mode 100644 drivers/crypto/cmh/include/cmh.h create mode 100644 drivers/crypto/cmh/include/cmh_aes_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_ccp_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_config.h create mode 100644 drivers/crypto/cmh/include/cmh_debugfs.h create mode 100644 drivers/crypto/cmh/include/cmh_dma.h create mode 100644 drivers/crypto/cmh/include/cmh_drbg_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_eac_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_hc_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_hcq_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_kic_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_mqi.h create mode 100644 drivers/crypto/cmh/include/cmh_pke_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_qse_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_registers.h create mode 100644 drivers/crypto/cmh/include/cmh_rh.h create mode 100644 drivers/crypto/cmh/include/cmh_sm3_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_sm4_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_sys_abi.h create mode 100644 drivers/crypto/cmh/include/cmh_sysfs.h create mode 100644 drivers/crypto/cmh/include/cmh_txn.h create mode 100644 drivers/crypto/cmh/include/cmh_vcq.h
Documentation/ABI/testing/debugfs-driver-cmh new file +171 -0
@@ -0,0 +1,171 @@ +What: /sys/kernel/debug/cmh/mbx<N>/vcqs_submitted +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Total number of VCQ command entries submitted to + mailbox N since the driver was loaded. + +What: /sys/kernel/debug/cmh/mbx<N>/vcqs_completed +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Total number of VCQ command completions received + from mailbox N. + +What: /sys/kernel/debug/cmh/mbx<N>/vcqs_errors +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Total number of error completions received from + mailbox N. + +What: /sys/kernel/debug/cmh/mbx<N>/queue_full_count +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Number of times the transaction manager skipped + mailbox N because its in-flight queue was full. + +What: /sys/kernel/debug/cmh/mbx<N>/max_queue_depth +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) High-water mark of in-flight transactions on + mailbox N. + +What: /sys/kernel/debug/cmh/mbx<N>/inject_abort +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (WO) Write any value to inject an MBX_COMMAND_ABORT on + mailbox N. The abort triggers error-IRQ handling that + completes all in-flight transactions with -EIO and then + issues MBX_COMMAND_RESTART to resume the mailbox. + Only available when CONFIG_CRYPTO_DEV_CMH_DEBUG is enabled. + +What: /sys/kernel/debug/cmh/mbx<N>/force_drain +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (WO) Write any value to unconditionally FLUSH and drain + all pending transactions on mailbox N, completing each + with -ECANCELED, and reset all recovery bookkeeping + (including the wedged flag). The mailbox is re-enabled + for new work immediately; no hardware health verification + is performed. Use as a last-resort recovery when the eSW + is unresponsive and normal ABORT/RESTART escalation has + not recovered the mailbox. + Only available when CONFIG_CRYPTO_DEV_CMH_DEBUG is enabled. + +What: /sys/kernel/debug/cmh/tm/cmq_posts +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Total number of cmh_tm_post_command() calls (one + per crypto request submitted to the transaction manager). + +What: /sys/kernel/debug/cmh/tm/cmq_depth_max +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) High-water mark of the command queue length. + +What: /sys/kernel/debug/cmh/tm/cmq_eagain_count +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Number of times the command queue was full and + returned -EAGAIN to the caller. + +What: /sys/kernel/debug/cmh/tm/backoff_count +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Number of times the transaction manager backed off + because all mailbox queues were full. + +What: /sys/kernel/debug/cmh/tm/async_timeout_count +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RO) Number of async crypto requests that timed out + waiting for hardware completion. + +What: /sys/kernel/debug/cmh/config/async_timeout_ms +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RW) Async request timeout in milliseconds. On timeout + the driver issues MBX_COMMAND_ABORT; if the eSW is + unresponsive, the watchdog escalates through RESTART, + FLUSH, and force-drain to bound D-state duration. + +What: /sys/kernel/debug/cmh/config/vcq_timeout_ms +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RW) VCQ command timeout in milliseconds. + +What: /sys/kernel/debug/cmh/config/slow_op_timeout_ms +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RW) Slow-operation timeout in milliseconds. Used for + operations known to take longer (e.g. RSA key generation, + PQC key generation). + +What: /sys/kernel/debug/cmh/config/drain_timeout_ms +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RW) Drain timeout in milliseconds. Maximum time to wait + for all in-flight transactions to complete during driver + removal or suspend. + +What: /sys/kernel/debug/cmh/config/watchdog_ms +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RW) Result-handler watchdog interval in milliseconds. + Detects missed IRQs, stuck mailboxes, and abort-stall + conditions. Clamped to a 10 ms minimum. + +What: /sys/kernel/debug/cmh/config/drbg_timeout_ms +Date: June 2026 +KernelVersion: 7.1 +Contact: [email protected] +Description: + (RW) DRBG self-seed timeout in milliseconds. + +What: /sys/kernel/debug/cmh/config/cmq_max_depth +Date: August 2026 +KernelVersion: 7.2 +Contact: [email protected] +Description: + (RW) Maximum number of pending commands in the central + Command Message Queue. + +What: /sys/kernel/debug/cmh/config/backlog_max_depth +Date: August 2026 +KernelVersion: 7.2 +Contact: [email protected] +Description: + (RW) Maximum depth of the backlog queue for + CRYPTO_TFM_REQ_MAY_BACKLOG requests (0 disables backlog).
Documentation/ABI/testing/sysfs-driver-cmh new file +67 -0
67 lines not on this page · raw message
Documentation/crypto/device_drivers/cmh.rst new file +340 -0
340 lines not on this page · raw message
Documentation/crypto/device_drivers/index.rst +1 -0
@@ -6,4 +6,5 @@ Hardware Device Driver Specific Documentation .. toctree:: :maxdepth: 1 + cmh octeontx2
drivers/crypto/Kconfig +1 -0
@@ -831,4 +831,5 @@ source "drivers/crypto/starfive/Kconfig" source "drivers/crypto/inside-secure/eip93/Kconfig" source "drivers/crypto/ti/Kconfig" +source "drivers/crypto/cmh/Kconfig" endif # CRYPTO_HW
drivers/crypto/Makefile +1 -0
@@ -46,3 +46,4 @@ obj-y += intel/ obj-y += starfive/ obj-y += cavium/ obj-y += ti/ +obj-$(CONFIG_CRYPTO_DEV_CMH) += cmh/
drivers/crypto/cmh/Kconfig new file +62 -0
62 lines not on this page · raw message
drivers/crypto/cmh/Makefile new file +25 -0
@@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the Rambus CryptoManager Hub (CMH) hardware crypto accelerator driver. +# + +obj-$(CONFIG_CRYPTO_DEV_CMH) += cmh.o + +cmh-y := \ + cmh_main.o \ + cmh_config.o \ + cmh_mqi.o \ + cmh_txn.o \ + cmh_rh.o \ + cmh_dma.o \ + cmh_sysfs.o + +ccflags-y += -I$(src)/include + +# Suppress -Woverride-init for the [0 ... N] = -1 range-initializer pattern +# (standard kernel idiom for sparse lookup tables with a default value). +CFLAGS_cmh_config.o += -Wno-override-init + +# Debug instrumentation: per-mailbox debugfs counters. +# cmh_debugfs.o is linked into the composite cmh.o (same tristate). +cmh-$(CONFIG_CRYPTO_DEV_CMH_DEBUG) += cmh_debugfs.o
drivers/crypto/cmh/cmh_config.c new file +619 -0
619 lines not on this page · raw message
drivers/crypto/cmh/cmh_debugfs.c new file +307 -0
307 lines not on this page · raw message
drivers/crypto/cmh/cmh_dma.c new file +482 -0
482 lines not on this page · raw message
drivers/crypto/cmh/cmh_main.c new file +369 -0
369 lines not on this page · raw message
drivers/crypto/cmh/cmh_mqi.c new file +344 -0
344 lines not on this page · raw message
drivers/crypto/cmh/cmh_rh.c new file +1224 -0
200 lines not on this page · raw message
drivers/crypto/cmh/cmh_sysfs.c new file +108 -0
108 lines not on this page · raw message
drivers/crypto/cmh/cmh_txn.c new file +2118 -0
2,118 lines not on this page · raw message
drivers/crypto/cmh/include/cmh.h new file +24 -0
Lines of this file are not shown. View the raw message.
drivers/crypto/cmh/include/cmh_aes_abi.h new file +98 -0
98 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_ccp_abi.h new file +108 -0
108 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_config.h new file +105 -0
105 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_debugfs.h new file +93 -0
93 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_dma.h new file +249 -0
249 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_drbg_abi.h new file +67 -0
67 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_eac_abi.h new file +44 -0
44 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_hc_abi.h new file +162 -0
162 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_hcq_abi.h new file +222 -0
222 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_kic_abi.h new file +77 -0
77 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_mqi.h new file +35 -0
Lines of this file are not shown. View the raw message.
drivers/crypto/cmh/include/cmh_pke_abi.h new file +272 -0
272 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_qse_abi.h new file +201 -0
201 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_registers.h new file +161 -0
161 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_rh.h new file +93 -0
93 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_sm3_abi.h new file +79 -0
79 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_sm4_abi.h new file +101 -0
101 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_sys_abi.h new file +148 -0
148 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_sysfs.h new file +14 -0
Lines of this file are not shown. View the raw message.
drivers/crypto/cmh/include/cmh_txn.h new file +481 -0
481 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_vcq.h new file +288 -0
288 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.7
Part of the diff is not shown here. View the raw message.
PATCH v7 3/5 crypto: cmh - add key/datastore infrastructure
In reply to a message not in the archiveAdd the CMH key and datastore (system object) layer shared by the algorithm drivers. cmh_sys.c manages CMH system objects (allocate and free datastore slots); cmh_key.c stages a raw key into a per-transform context and DMA-maps it for the lifetime of the transform.
These are used by the symmetric, hash/MAC and asymmetric algorithm drivers that follow, and by the /dev/cmh_mgmt ioctl device. No crypto API algorithm is registered by this patch.
--- drivers/crypto/cmh/Makefile | 4 +- drivers/crypto/cmh/cmh_key.c | 130 +++++++++ drivers/crypto/cmh/cmh_sys.c | 376 +++++++++++++++++++++++++++ drivers/crypto/cmh/include/cmh_key.h | 73 ++++++ drivers/crypto/cmh/include/cmh_sys.h | 111 ++++++++ 5 files changed, 693 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/cmh/cmh_key.c create mode 100644 drivers/crypto/cmh/cmh_sys.c create mode 100644 drivers/crypto/cmh/include/cmh_key.h create mode 100644 drivers/crypto/cmh/include/cmh_sys.h
drivers/crypto/cmh/Makefile +3 -1
@@ -12,7 +12,9 @@ cmh-y := \ cmh_txn.o \ cmh_rh.o \ cmh_dma.o \ - cmh_sysfs.o + cmh_sysfs.o \ + cmh_sys.o \ + cmh_key.o ccflags-y += -I$(src)/include
drivers/crypto/cmh/cmh_key.c new file +130 -0
130 lines not on this page · raw message
drivers/crypto/cmh/cmh_sys.c new file +376 -0
376 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_key.h new file +73 -0
73 lines not on this page · raw message
drivers/crypto/cmh/include/cmh_sys.h new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.43.7
PATCH v7 4/5 crypto: cmh - add AES skcipher/aead/cmac
In reply to a message not in the archiveRegister AES algorithms using the CMH AES core (core ID 0x03):
- skcipher: AES-ECB, AES-CBC, AES-CTR, AES-XTS, AES-CFB
- aead: AES-GCM, AES-CCM
- ahash: AES-CMAC
Supports 128, 192, and 256-bit keys. AEAD algorithms handle associated data, payload, and authentication tag with correct encrypt/decrypt separation.
AES-CMAC hardware-accelerates the one-shot .digest() only; the incremental and virtual-address (CRYPTO_AHASH_REQ_VIRT) paths are forwarded to a generic cmac(aes) transform the driver allocates in .init_tfm(). This is the one algorithm here that setsCRYPTO_ALG_NO_FALLBACK: crypto/cmac.c implements only descsize (no export_core/import_core), so the core marks it NO_EXPORT_CORE and crypto_ahash_init_tfm() cannot install it as the automatic crypto_ahash_fb() fallback. ahash_prepare_alg() then forces NEED_FALLBACK unless NO_FALLBACK is set, so the flag is required to instantiate an async digest-only CMAC at all; the driver allocates the generic transform itself to serve the non-digest paths. This is the same narrow use of NO_FALLBACK as s390; the hashes and HMAC in a later series use the core's crypto_ahash_fb() and do not set it.
--- drivers/crypto/cmh/Makefile | 5 +- drivers/crypto/cmh/cmh_aes.c | 755 +++++++++++++++++++ drivers/crypto/cmh/cmh_aes_aead.c | 1013 ++++++++++++++++++++++++++ drivers/crypto/cmh/cmh_aes_cmac.c | 476 ++++++++++++ drivers/crypto/cmh/cmh_main.c | 25 + drivers/crypto/cmh/include/cmh_aes.h | 24 + 6 files changed, 2297 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/cmh/cmh_aes.c create mode 100644 drivers/crypto/cmh/cmh_aes_aead.c create mode 100644 drivers/crypto/cmh/cmh_aes_cmac.c create mode 100644 drivers/crypto/cmh/include/cmh_aes.h
drivers/crypto/cmh/Makefile +4 -1
@@ -14,7 +14,10 @@ cmh-y := \ cmh_dma.o \ cmh_sysfs.o \ cmh_sys.o \ - cmh_key.o + cmh_key.o \ + cmh_aes.o \ + cmh_aes_aead.o \ + cmh_aes_cmac.o ccflags-y += -I$(src)/include
drivers/crypto/cmh/cmh_aes.c new file +755 -0
755 lines not on this page · raw message
drivers/crypto/cmh/cmh_aes_aead.c new file +1013 -0
1,013 lines not on this page · raw message
drivers/crypto/cmh/cmh_aes_cmac.c new file +476 -0
476 lines not on this page · raw message
drivers/crypto/cmh/cmh_main.c +25 -0
@@ -32,6 +32,7 @@#include "cmh_mqi.h" #include "cmh_txn.h" #include "cmh_rh.h" +#include "cmh_aes.h" #include "cmh_registers.h" #include "cmh_debugfs.h" #include "cmh_sysfs.h"
@@ -227,10 +228,31 @@ static int cmh_probe(struct platform_device *pdev)if (ret) goto err_rh_init; +/* Register AES skcipher algorithms */ + ret =cmh_aes_register (); +if (ret) + goto err_aes_register; + +/* Register AES AEAD algorithms (GCM, CCM) */ + ret =cmh_aes_aead_register (); +if (ret) + goto err_aes_aead_register; + +/* Register AES CMAC algorithm */ + ret =cmh_aes_cmac_register (); +if (ret) + goto err_aes_cmac_register; +platform_set_drvdata (pdev, dev);return 0 ; +err_aes_cmac_register: +cmh_aes_aead_unregister (); +err_aes_aead_register: +cmh_aes_unregister (); +err_aes_register: +cmh_rh_cleanup (cfg); err_rh_init:cmh_tm_cleanup (); err_tm_init:
@@ -255,6 +277,9 @@ static void cmh_remove(struct platform_device *pdev) cfg = &dev->config; +cmh_aes_cmac_unregister (); +cmh_aes_aead_unregister (); +cmh_aes_unregister ();cmh_rh_cleanup (cfg);cmh_tm_cleanup ();cmh_mqi_cleanup (cfg);
drivers/crypto/cmh/include/cmh_aes.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2026 Cryptography Research, Inc. (CRI). +* CMH LKM -- AES Crypto API Drivers +* +* Registers AES algorithms with the Linux crypto subsystem: +* skcipher: ecb/cbc/ctr/cfb/xts(aes) +* aead: gcm/ccm(aes) +* shash: cmac(aes) +*/ + +#ifndef CMH_AES_H +#define CMH_AES_H + +int cmh_aes_register (void ); +void cmh_aes_unregister (void ); + +int cmh_aes_aead_register (void ); +void cmh_aes_aead_unregister (void ); + +int cmh_aes_cmac_register (void ); +void cmh_aes_cmac_unregister (void ); + +#endif /* CMH_AES_H */
Signature · 1 line
2.43.7