On Fri, Aug 21, 2026 at 03:20:49AM +0000, Jamin Lin wrote:
> Add a qtest for the ASPEED secure boot controller ECDSA engine. It stages
> the public key, signature and SHA-384 digest of a secp384r1 known-answer
> vector (from the Linux kernel crypto self-test manager,
> ecdsa_nist_p384_tv_template) into the SEC SRAM, triggers the engine's
> verify command and checks the status register: a valid signature reports
> done + pass, and a tampered signature reports done without pass.
>
> The test is skipped when the crypto backend does not support ECDSA, via
> qcrypto_akcipher_supports().
>
> Signed-off-by: Jamin Lin <[email protected]>
> ---
> tests/qtest/aspeed-sbc-test.c | 193 ++++++++++++++++++++++++++++++++++
> tests/qtest/meson.build | 2 +
> 2 files changed, 195 insertions(+)
> create mode 100644 tests/qtest/aspeed-sbc-test.c
>
> +static void aspeed_add_sbc_ecdsa_tests(const char *prefix, const char
> *machine,
> + uint32_t sec_addr, uint64_t sram_addr)
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(sbc_ecdsa_tests); i++) {
> + QCryptoAkCipherOptions opts = {
> + .alg = QCRYPTO_AK_CIPHER_ALGO_ECDSA,
> + .u.ecdsa.curve_id = sbc_ecdsa_tests[i].curve_id,
> + };
> + g_autofree char *path = NULL;
> + AspeedSBCTest *t;
> +
> + if (!qcrypto_akcipher_supports(&opts)) {
> + g_printerr("# skip SBC ECDSA %s test: not supported by the
> crypto "
> + "backend\n", sbc_ecdsa_tests[i].name);
We ought to use g_test_skip(...) instead of g_printerr("# skip....)
so we don't assume use of TAP format.
> + continue;
> + }
> +
> + path = g_strdup_printf("%s/sbc/ecdsa/%s", prefix,
> + sbc_ecdsa_tests[i].name);
> + t = g_new0(AspeedSBCTest, 1);
> + t->machine = machine;
> + t->sec_addr = sec_addr;
> + t->sram_addr = sram_addr;
> + t->index = i;
> + qtest_add_data_func_full(path, t, test_ecdsa_verify, g_free);
> + }
> +}
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 :|