feat: aliro-bench-profile CLI + per-APDU latency probes
New `aliro-bench-profile` entry point drives the applet's INS_DIAG_* commands over PC/SC at two iteration counts (N=4 / N=16 by default) and computes per-op cost as the slope, factoring out APDU round-trip + any one-time Signature.init setup. Reports HMAC, ECDH, ECDSA sign, and AES-GCM 137B costs side by side, then reconstructs an AUTH1 budget using the per-primitive counts from the applet's processAuth1 flow so we can compare the reconstructed estimate against bench-test wall-clock and see how much of AUTH1 is crypto vs TLV parsing / I/O. Also extends `aliro-bench-test` to time SELECT / AUTH0 / AUTH1 / total via time.perf_counter() bracketing each transmit() call. The TransactionResult now carries a latencies_ms dict, threaded through all return sites so both success and failure paths print the new "APDU latencies (ms):" block. Made the 1.78x AUTH1 wall-clock speedup from the 4-bit GHASH commit quantifiable on real hardware (5,795 -> 3,244 ms). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
8
harness/src/aliro_harness/profile/__init__.py
Normal file
8
harness/src/aliro_harness/profile/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
||||
"""Drives the AliroApplet's INS_DIAG_* profiling commands.
|
||||
|
||||
Each INS_DIAG_* operation runs a single primitive (HMAC-SHA-256, ECDH,
|
||||
ECDSA-SHA-256 sign, or full AES-256-GCM encrypt of 137B) N times against
|
||||
hardcoded test vectors on the card. We measure wall-clock latency for two
|
||||
different N values; the per-op cost is the slope of the line, isolating
|
||||
APDU framing overhead from the primitive's actual cost.
|
||||
"""
|
||||
Reference in New Issue
Block a user