Skip to content

Support the ASPEED HACE crypto command

Jamin Lin qemu-arm qemu-devel 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest16 patches 1 replyIn review
  2. v316 patches 5 repliesSuperseded
  3. v217 patches 20 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v115 patches8 repliesSuperseded

Changes in v4 from the cover letter

1. Add GCM tag mask

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16hw/misc/aspeed_hace: Support the crypto command in direct access modehw/misc/aspeed_hace.c+268 -150 replies
2/16tests/qtest/aspeed-hace: Test the crypto command on the AST2500tests/qtest/aspeed-hace-utils.c tests/qtest/aspeed-hace-utils.h tests/qtest/aspeed_hace-test.c +1 more+351 -20 replies
3/16hw/misc/aspeed_hace: Support scatter-gather mode for the crypto commandhw/misc/aspeed_hace.c+64 -60 replies
4/16hw/misc/aspeed_hace: Support the CTR mode for the crypto commandhw/misc/aspeed_hace.c+45 -50 replies
5/16tests/qtest/aspeed-hace: Test the crypto command on the AST2600tests/qtest/aspeed-hace-utils.c tests/qtest/aspeed-hace-utils.h tests/qtest/aspeed_hace-test.c+224 -80 replies
6/16tests/qtest/aspeed-hace: Test the crypto command on the AST1030tests/qtest/aspeed_hace-test.c+6 -00 replies
7/16crypto/cipher: Add GCM to QCryptoCipherModecrypto/cipher.c qapi/crypto.json+4 -10 replies
8/16crypto/cipher: Add setaad/gettag for AEAD modescrypto/cipher.c crypto/cipherpriv.h include/crypto/cipher.h+75 -00 replies
9/16crypto/cipher-gcrypt: Implement AES-GCMcrypto/cipher-gcrypt.c.inc+101 -00 replies
10/16crypto/cipher-nettle: Implement AES-GCMcrypto/cipher-nettle.c.inc+128 -00 replies
11/16crypto/cipher-gnutls: Implement AES-GCMcrypto/cipher-gnutls.c.inc+154 -00 replies
12/16tests/unit/test-crypto-cipher: Test AES-GCM modetests/unit/test-crypto-cipher.c+240 -00 replies
13/16hw/misc/aspeed_hace: Support 64-bit DMA for the crypto commandhw/misc/aspeed_hace.c+30 -30 replies
14/16hw/misc/aspeed_hace: Support the AES-GCM mode for the crypto commandhw/misc/aspeed_hace.c+62 -80 replies
15/16hw/misc/aspeed_hace: Enable the crypto command on the AST2700hw/misc/aspeed_hace.c include/hw/misc/aspeed_hace.h+1 -150 replies
16/16tests/qtest/aspeed-hace: Test the crypto command on the AST2700tests/qtest/aspeed-hace-utils.c tests/qtest/aspeed-hace-utils.h tests/qtest/ast2700-hace-test.c+172 -10 replies

Reviews trailers per patch

All 16 patches have a Reviewed-by or Acked-by.

PatchKane ChenDaniel P. BerrangéMarkus Armbruster
1/16R-b
2/16R-b
3/16R-b
4/16R-b
5/16R-b
6/16R-b
7/16R-b A-b A-b
8/16R-b R-b
9/16R-b A-b
10/16R-b
11/16R-b
12/16R-b
13/16R-b
14/16R-b
15/16R-b
16/16R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/16] Support the ASPEED HACE crypto command

The ASPEED HACE model only emulated the hash command; the crypto (cipher) command was stubbed out. On the AST2700 the kernel runs the crypto driver self-tests at boot, so without crypto emulation booting floods the log with failures:

  root@ast2700-default:~# dmesg | grep "self"
[    6.078446] alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
[    6.079295] alg: self-tests for ctr(des) using aspeed-ctr-des failed (rc=-22)
[    6.089924] alg: self-tests for ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
[    6.090629] alg: self-tests for ctr(des3_ede) using aspeed-ctr-tdes failed (rc=-22)
[    6.100134] alg: self-tests for cbc(des3_ede) using aspeed-cbc-tdes failed (rc=-22)
[    6.100416] alg: self-tests for ecb(des3_ede) using aspeed-ecb-tdes failed (rc=-22)
[    6.100576] alg: self-tests for cbc(des3_ede) using aspeed-cbc-tdes failed (rc=-22)
[    6.101411] alg: self-tests for ecb(des3_ede) using aspeed-ecb-tdes failed (rc=-22)
[    6.152954] alg: self-tests for ecb(des) using aspeed-ecb-des failed (rc=-22)
[    6.153701] alg: self-tests for ecb(des) using aspeed-ecb-des failed (rc=-22)
[    6.180101] alg: self-tests for cbc(des) using aspeed-cbc-des failed (rc=-22)
[    6.180747] alg: self-tests for cbc(des) using aspeed-cbc-des failed (rc=-22)
[    6.206437] alg: self-tests for ctr(aes) using aspeed-ctr-aes failed (rc=-22)
[    6.206910] alg: self-tests for ctr(aes) using aspeed-ctr-aes failed (rc=-22)
[    6.215313] alg: self-tests for cbc(aes) using aspeed-cbc-aes failed (rc=-22)
[    6.215698] alg: self-tests for cbc(aes) using aspeed-cbc-aes failed (rc=-22)
[    6.227173] alg: self-tests for ecb(aes) using aspeed-ecb-aes failed (rc=-22)
[    6.228027] alg: self-tests for ecb(aes) using aspeed-ecb-aes failed (rc=-22)
[    6.276878] alg: self-tests for gcm(aes) using aspeed-gcm-aes failed (rc=-22)
[    6.277541] alg: self-tests for gcm(aes) using aspeed-gcm-aes failed (rc=-22)

This series implements the HACE crypto command: AES/DES/3DES in ECB/CBC/CTR over direct and scatter-gather DMA, and AES-GCM with 64-bit DMA on the AST2700. It also adds GCM to the qcrypto cipher API (gcrypt backend) that the AST2700 path needs, plus qtest and unit-test coverage.

With crypto emulated the self-tests pass, the warnings above disappear, and the temporary 'cryptomgr.notests=1' boot workaround in the AST2700 functional tests is dropped.

Note: the GNUTLS crypto backend does not support AES-CTR mode.

v1:
1. Support the crypto command in direct access mode
2. Support scatter-gather mode for the crypto command
3. Support the AES-GCM mode for the crypto command
4. Support 64-bit DMA for the crypto command
5. Test the crypto command
6. Drop the AST2700 crypto self-test/model workaround

v2:
1. Add AES-GCM to the nettle and gnutls crypto backends
2. Skip crypto tests for cipher modes the
compiled backend does not support, via qcrypto_cipher_supports()
3. Check qcrypto_cipher_supports() before running a
crypt command and report the mode as unimplemented when the backend lacks it

v3:
1. remove the duplicate CRYPT_IRQ_EN definition.
2. remove the unuse CRYPT_CMD_DST_SG_CTRL definition.
3. Drop "Drop the AST2700 crypto self-test workaround" patch because GNUTLS backend does not support AES-CTR mode.

v4:
1. Add GCM tag mask

Jamin Lin (16):
hw/misc/aspeed_hace: Support the crypto command in direct access mode tests/qtest/aspeed-hace: Test the crypto command on the AST2500 hw/misc/aspeed_hace: Support scatter-gather mode for the crypto
command
hw/misc/aspeed_hace: Support the CTR mode for the crypto command tests/qtest/aspeed-hace: Test the crypto command on the AST2600 tests/qtest/aspeed-hace: Test the crypto command on the AST1030 crypto/cipher: Add GCM to QCryptoCipherMode
crypto/cipher: Add setaad/gettag for AEAD modes crypto/cipher-gcrypt: Implement AES-GCM crypto/cipher-nettle: Implement AES-GCM crypto/cipher-gnutls: Implement AES-GCM tests/unit/test-crypto-cipher: Test AES-GCM mode hw/misc/aspeed_hace: Support 64-bit DMA for the crypto command hw/misc/aspeed_hace: Support the AES-GCM mode for the crypto command hw/misc/aspeed_hace: Enable the crypto command on the AST2700 tests/qtest/aspeed-hace: Test the crypto command on the AST2700

 qapi/crypto.json                |   4 +-
 crypto/cipherpriv.h             |   8 +
 include/crypto/cipher.h         |  36 ++
 include/hw/misc/aspeed_hace.h   |   1 -
 tests/qtest/aspeed-hace-utils.h |  20 +
 crypto/cipher.c                 |  32 ++
 hw/misc/aspeed_hace.c           | 461 ++++++++++++++++++++-
 tests/qtest/aspeed-hace-utils.c | 693 ++++++++++++++++++++++++++++++++
 tests/qtest/aspeed_hace-test.c  |  18 +
 tests/qtest/ast2700-hace-test.c |   9 +
 tests/unit/test-crypto-cipher.c | 240 +++++++++++
 crypto/cipher-gcrypt.c.inc      | 101 +++++
 crypto/cipher-gnutls.c.inc      | 154 +++++++
 crypto/cipher-nettle.c.inc      | 128 ++++++
 tests/qtest/meson.build         |   6 +-
 15 files changed, 1886 insertions(+), 25 deletions(-)
Signature · 1 line
2.43.0