Skip to content

crypto: atmel - refactor common i2c support and add SHA256 ahash support

Lothar Rubusch linux-arm-kernel linux-crypto lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12crypto: atmel - introduce shared I2C client managementdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+65 -510 replies
2/12crypto: atmel - move capability-based client allocation into i2c coredrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+51 -360 replies
3/12crypto: atmel - remove obsolete CONFIG_OF guarddrivers/crypto/atmel-ecc.c+3 -90 replies
4/12crypto: atmel - add per-device timing and match-data driven configurationdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+120 -460 replies
5/12crypto: atmel - move RNG support into common i2c coredrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+123 -1010 replies
6/12crypto: atmel - move EEPROM access support into common i2c coredrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+186 -980 replies
7/12crypto: atmel - expose CONFIG zone through sysfsdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-sha204a.c+14 -00 replies
8/12crypto: atmel - move device sanity check to core driverdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+32 -410 replies
9/12crypto: atmel - check client data in remove callbacksdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-sha204a.c+11 -160 replies
10/12crypto: atmel - update workqueue flags and add flush on exitdrivers/crypto/atmel-i2c.c+2 -12 replies
11/12crypto: atmel - refactor and localize driver constantsdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h+108 -870 replies
12/12crypto: atmel - add SHA256 ahash supportdrivers/crypto/atmel-ecc.c drivers/crypto/atmel-i2c.c drivers/crypto/atmel-i2c.h +1 more+407 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/12] crypto: atmel - refactor common i2c support and add SHA256 ahash support

This series restructures the Atmel secure element drivers around a shared atmel-i2c core and adds SHA256 ahash support for ATSHA204A and ECC based devices.

The existing drivers duplicated substantial parts of the transport, RNG, EEPROM and device management logic. This series consolidates the common functionality into the shared i2c core and converts the client drivers to capability based allocation.

The series also introduces per-device timing configuration through match data, moves sanity checks and RNG handling into the core driver, updates workqueue handling and cleans up internal constants and helper definitions.

The final patch adds SHA256 ahash support using the hardware SHA engine provided by the devices.

ATSHA204A devices require software-side SHA256 padding according to FIPS 180-4, while newer ECC devices provide a dedicated SHA final command and perform padding internally in hardware.

Supporting the SHA engine also requires changes to the command transport path. SHA operations must execute as a strict uninterrupted sequence consisting of SHA INIT, one or more SHA COMPUTE commands and, for ECC devices, a terminating SHA FINAL command. The device loses its internal SHA state if it enters sleep mode or if unrelated commands are interleaved during the transaction.

To satisfy these hardware requirements, the send/receive path is split into a low-level transfer helper and a higher-level wrapper managing wakeup, sleep and locking. SHA operations keep the device awake and hold the i2c lock for the full duration of the hashing transaction.

The series has been tested on ATSHA204A and ATECC508A devices. Tests are ongoing/pending on ATECC608A and ATECC608B.
---
Lothar Rubusch (12):
crypto: atmel - introduce shared I2C client management
crypto: atmel - move capability-based client allocation into i2c core
crypto: atmel - remove obsolete CONFIG_OF guard
crypto: atmel - add per-device timing and match-data driven
configuration
crypto: atmel - move RNG support into common i2c core
crypto: atmel - move EEPROM access support into common i2c core
crypto: atmel - expose CONFIG zone through sysfs
crypto: atmel - move device sanity check to core driver
crypto: atmel - check client data in remove callbacks
crypto: atmel - update workqueue flags and add flush on exit
crypto: atmel - refactor and localize driver constants
crypto: atmel - add SHA256 ahash support

 drivers/crypto/atmel-ecc.c     | 252 +++++++-----
 drivers/crypto/atmel-i2c.c     | 679 +++++++++++++++++++++++++++++----
 drivers/crypto/atmel-i2c.h     | 180 +++++----
 drivers/crypto/atmel-sha204a.c | 284 +++++++-------
 4 files changed, 1010 insertions(+), 385 deletions(-)

base-commit: f7dd32c5179d7755de18e21d5674b08f9e5cb180

Signature · 1 line
2.53.0