Re: [PATCH v5] examples: add Wycheproof validation app
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2026-09-22 16:26:20
On Tue, 22 Sep 2026 16:05:57 +0000 Kai Ji [off-list ref] wrote:
Add a Wycheproof JSON vector validation example for cryptodev PMDs. Support these algorithms when advertised by the selected PMD: - AEAD: AES-GCM, AES-CCM, SM4-GCM, ChaCha20-Poly1305 - MAC: AES-CMAC, AES-GMAC, HMAC SHA-1/SHA-2/SHA-3/SM3 - Asymmetric: DSA (P1363 verify), ECDSA (P1363 verify), ECDH (ecpoint shared-secret compute) Validate valid vectors against generated ciphertexts, tags, plaintexts, digests, shared secrets, or signature verification, and require the expected rejection for invalid vectors. Digest inputs for DSA and ECDSA use the symmetric auth path, selecting a separate symmetric-capable device when the target device is asymmetric-only. Skip parameter combinations outside PMD capability ranges and identify recognized vector families without a compatible DPDK transform. A --debug option lists every failed or skipped vector. Add Meson and standalone build integration, with usage documentation. Signed-off-by: Kai Ji <redacted> ---
AI review had some useful suggestions on this.
Wycheproof validation example (v5) - review
v4 -> v5 delta: drop unused APP_NAME, close the device on the
app_init() error path, and treat asym session-create failure as
-ENOTSUP (skip) instead of -EIO/-ENOMEM (fail) in run_dsa_verify(),
run_ecdh_ecpoint() and run_ecdsa_verify().
Applied on 6bbb7b3, built with -Dwerror=true, docutils clean. Same
crypto_openssl runs as v4: directory run passed=1902 failed=0,
--mbuf-dataroom 160 and --cryptodev-id 256 behave as in v4.
No Errors or Warnings.
Info
----
main.c:1222, 1480, 1715
ret = -ENOTSUP;
Session-create failure is now indistinguishable from an unsupported
curve or key size: a PMD that advertises the xform but fails
session setup for a curve it claims to support, or a -ENOMEM from
an exhausted asym session pool, lands in skipped_capability and the
exit status stays zero. Understood that the asym capability struct
does not enumerate curves, so this is a documented trade-off; just
noting that valid asym vectors can no longer fail at session setup.
main.c:823-824, 837, 957, 1047 (open since v3)
memcmp(output, vector->ct, vector->ct_len) != 0
memcmp(NULL, NULL, 0) for empty-message vectors; glibc declares
memcmp nonnull. Guard with len != 0 &&.
main.c:182-183, 266 (open since v3)
Positional struct initializers; use designated members.
doc/guides/sample_app_ug/wycheproof_validation.rst (open since v3)
crypto_openssl advertises no ECDSA/ECDH xform capability, so the
documented command line skips every ECDSA/ECDH vector. One sentence
saying asymmetric coverage needs a PMD advertising those xforms.
Pre-existing, not introduced by this patch
lib/cryptodev/rte_cryptodev.c:2411 rte_cryptodev_asym_session_create()
ret = dev->dev_ops->asym_session_configure(dev, xforms, sess);
if (ret < 0) {
...
return ret;
}
On configure failure the object stays allocated from the pool and
*session still points at it, unlike the sym variant which does
rte_mempool_put() on its error_exit path. This app copes by freeing
a non-NULL session at out: even when create returned an error; if
the library is ever aligned with the sym behaviour that becomes a
double put. One for the cryptodev maintainers, not this patch.
Review-Result: CLEAN