Proposing a small AEAD throughput probe for ipctool, so the per-SoC crypto picture
becomes data instead of an assumption.
@widgetii suggested this home in OpenIPC/firmware#2344 — worth reading that thread for
the full context, but the short version follows.
Why
Hardware crypto acceleration is currently enabled for two platforms because someone
measured those two platforms. Every other SoC OpenIPC ships is an inference. And the
measurements that exist show the answer is genuinely per-chip, not per-family:
-
On a gen-3 part, the crypto engine measured slower than software, so it is not
built there.
-
On gen-4 HiSilicon, the engine is a bit over 2x software (86.4 → 38.4 µs and
87.6 → 42.0 µs per 1100-byte packet).
-
On GK7202V300 (Goke, ARMv7 Cortex-A7, no ARMv8 crypto extensions, no engine
OpenIPC builds for), I measured in software with ring 0.17 — the same backend the
Rust TLS/QUIC stacks use — sealing 1200-byte packets:
| AEAD |
throughput |
per packet |
| AES-128-GCM |
72.8 Mbit/s |
131.9 µs |
| AES-256-GCM |
58.7 Mbit/s |
163.4 µs |
| ChaCha20-Poly1305 |
166.0 Mbit/s |
57.8 µs |
ChaCha20 is 2.3× AES-128-GCM here. NEON carries ChaCha20; AES has no hardware to
stand on. That inverts the usual server-side ordering where AES-NI makes AES-GCM the
obvious default.
That my software AES-128 figure (131.9 µs/1200 B) lands near the HiSilicon software
numbers on different silicon is a decent cross-check that software AES on this
generation is simply expensive — and that the interesting variable is what each chip
offers to accelerate it.
A table with a row per SoC turns "enable the engine here?" into a lookup.
What I am proposing
A probe that reports, for the chip it is running on:
- AES-128-GCM, AES-256-GCM and ChaCha20-Poly1305 seal throughput
- measured on packet-sized buffers (~1200 B), not bulk
The buffer size matters and is the one design point I would not compromise on. Bulk
throughput flatters AES on chips where per-call setup dominates, and every real consumer
here — TLS records, QUIC packets, SRTP — is packet-sized. Bulk numbers would produce a
table that looks authoritative and mispredicts the thing we care about.
Optionally, where a crypto engine exists, the same measurement through it, so the
engine-vs-software delta is directly comparable rather than inferred.
Practicalities I would want input on
-
Language/deps. My implementation is ~40 lines of Rust against ring, which is
not what ipctool is written in. If this belongs in-tree it presumably wants C. I am
happy to port it — but if the point is to characterise what our software stacks
actually achieve, then measuring the library those stacks use has some value that a
generic C implementation would lose. I do not have a strong view; you know the tree.
-
Where the numbers go. The wiki was suggested for the resulting table. Happy to
seed it with the GK7202V300 row and whatever else people run.
-
Scope. Is this the sort of thing ipctool should carry at all, or is it better
as a standalone one-shot binary people run once per board? It is a capability probe,
which felt like ipctool's remit, but I would rather ask than assume.
I am not an ipctool contributor and have been around OpenIPC about three weeks, so if
the answer is "interesting, wrong repo" or "we would rather not grow the tool this way",
that is a perfectly good outcome — say so and I will just publish the numbers on the
wiki instead.
Proposing a small AEAD throughput probe for
ipctool, so the per-SoC crypto picturebecomes data instead of an assumption.
@widgetii suggested this home in OpenIPC/firmware#2344 — worth reading that thread for
the full context, but the short version follows.
Why
Hardware crypto acceleration is currently enabled for two platforms because someone
measured those two platforms. Every other SoC OpenIPC ships is an inference. And the
measurements that exist show the answer is genuinely per-chip, not per-family:
On a gen-3 part, the crypto engine measured slower than software, so it is not
built there.
On gen-4 HiSilicon, the engine is a bit over 2x software (86.4 → 38.4 µs and
87.6 → 42.0 µs per 1100-byte packet).
On GK7202V300 (Goke, ARMv7 Cortex-A7, no ARMv8 crypto extensions, no engine
OpenIPC builds for), I measured in software with
ring0.17 — the same backend theRust TLS/QUIC stacks use — sealing 1200-byte packets:
ChaCha20 is 2.3× AES-128-GCM here. NEON carries ChaCha20; AES has no hardware to
stand on. That inverts the usual server-side ordering where AES-NI makes AES-GCM the
obvious default.
That my software AES-128 figure (131.9 µs/1200 B) lands near the HiSilicon software
numbers on different silicon is a decent cross-check that software AES on this
generation is simply expensive — and that the interesting variable is what each chip
offers to accelerate it.
A table with a row per SoC turns "enable the engine here?" into a lookup.
What I am proposing
A probe that reports, for the chip it is running on:
The buffer size matters and is the one design point I would not compromise on. Bulk
throughput flatters AES on chips where per-call setup dominates, and every real consumer
here — TLS records, QUIC packets, SRTP — is packet-sized. Bulk numbers would produce a
table that looks authoritative and mispredicts the thing we care about.
Optionally, where a crypto engine exists, the same measurement through it, so the
engine-vs-software delta is directly comparable rather than inferred.
Practicalities I would want input on
Language/deps. My implementation is ~40 lines of Rust against
ring, which isnot what
ipctoolis written in. If this belongs in-tree it presumably wants C. I amhappy to port it — but if the point is to characterise what our software stacks
actually achieve, then measuring the library those stacks use has some value that a
generic C implementation would lose. I do not have a strong view; you know the tree.
Where the numbers go. The wiki was suggested for the resulting table. Happy to
seed it with the GK7202V300 row and whatever else people run.
Scope. Is this the sort of thing
ipctoolshould carry at all, or is it betteras a standalone one-shot binary people run once per board? It is a capability probe,
which felt like
ipctool's remit, but I would rather ask than assume.I am not an
ipctoolcontributor and have been around OpenIPC about three weeks, so ifthe answer is "interesting, wrong repo" or "we would rather not grow the tool this way",
that is a perfectly good outcome — say so and I will just publish the numbers on the
wiki instead.