[PATCH v1 00/15] Support the ASPEED HACE crypto command

Jamin Lin posted 15 patches 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260714072900.3023742-1-jamin._5Flin@aspeedtech.com
Maintainers: "Daniel P. Berrangé" <berrange@redhat.com>, "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
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                         | 454 +++++++++++-
tests/qtest/aspeed-hace-utils.c               | 662 ++++++++++++++++++
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 +++
.../aarch64/test_aspeed_ast2700a1.py          |   5 -
.../aarch64/test_aspeed_ast2700a2.py          |   5 -
.../aarch64/test_aspeed_ast2700fc.py          |   5 -
15 files changed, 1563 insertions(+), 37 deletions(-)
[PATCH v1 00/15] Support the ASPEED HACE crypto command
Posted by Jamin Lin 1 week, 4 days ago
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.

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
  
Jamin Lin (15):
  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
  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
  tests/functional/aarch64/test_aspeed_ast2700: Drop the AST2700 crypto
    self-test workaround

 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                         | 454 +++++++++++-
 tests/qtest/aspeed-hace-utils.c               | 662 ++++++++++++++++++
 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 +++
 .../aarch64/test_aspeed_ast2700a1.py          |   5 -
 .../aarch64/test_aspeed_ast2700a2.py          |   5 -
 .../aarch64/test_aspeed_ast2700fc.py          |   5 -
 15 files changed, 1563 insertions(+), 37 deletions(-)

-- 
2.43.0
Re: [PATCH v1 00/15] Support the ASPEED HACE crypto command
Posted by Daniel P. Berrangé 1 week, 4 days ago
On Tue, Jul 14, 2026 at 07:29:01AM +0000, Jamin Lin wrote:
>  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                         | 454 +++++++++++-
>  tests/qtest/aspeed-hace-utils.c               | 662 ++++++++++++++++++
>  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 +++

Both nettle and gnutls also support GCM mode, so can you impl those
too.

>  .../aarch64/test_aspeed_ast2700a1.py          |   5 -
>  .../aarch64/test_aspeed_ast2700a2.py          |   5 -
>  .../aarch64/test_aspeed_ast2700fc.py          |   5 -
>  15 files changed, 1563 insertions(+), 37 deletions(-)
> 
> -- 
> 2.43.0
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
RE: [PATCH v1 00/15] Support the ASPEED HACE crypto command
Posted by Jamin Lin 1 week, 4 days ago
Hi Daniel

> Subject: Re: [PATCH v1 00/15] Support the ASPEED HACE crypto command
> 
> On Tue, Jul 14, 2026 at 07:29:01AM +0000, Jamin Lin wrote:
> >  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                         | 454 +++++++++++-
> >  tests/qtest/aspeed-hace-utils.c               | 662
> ++++++++++++++++++
> >  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 +++
> 
> Both nettle and gnutls also support GCM mode, so can you impl those too.
> 
Thanks for the review and suggestion.
Will do.

Jamin
> >  .../aarch64/test_aspeed_ast2700a1.py          |   5 -
> >  .../aarch64/test_aspeed_ast2700a2.py          |   5 -
> >  .../aarch64/test_aspeed_ast2700fc.py          |   5 -
> >  15 files changed, 1563 insertions(+), 37 deletions(-)
> >
> > --
> > 2.43.0
> >
> >
> 
> With regards,
> Daniel
> --
> |: https://berrange.com       ~~
> https://hachyderm.io/@berrange :|
> |: https://libvirt.org          ~~          https://entangle-photo.org :|
> |: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|