Rejecting faulty output does not prove that a cryptographic implementation leaks no information. DFA uses differences between correct and faulty outputs. SIFA conditions on ineffective faulted computations—the fault was induced, but the output stayed correct—and analyzes statistical bias in an intermediate value. Both require an explicit attacker and observation model.
Learning objectives and classroom plan
By the end of this lesson, you should be able to:
- Eliminate key candidates with an invertible S-box differential equation.
- Calculate ineffective-fault selection bias using Bayes and entropy.
- Compute training means and held-out classifications; interpret control safety and leakage separately.
Suggested 50-minute teaching plan: Attacker assumptions 10 minutes; DFA calculation 15; conditioning 10; noisy calculations and lab 15. This includes student calculations, lab work, and discussion. It is a teaching plan, not measured student completion time.
Two different security questions
A food factory’s metal detector may stop a contaminant, yet production logs can still reveal which recipe line was active. The first is control safety; the second is information leakage. A crypto block may suppress faulty output and still leak through an error/valid flag, completion time, retries, or power differences. The analogy separates the questions; it does not model cryptanalytic statistics.
DFA often compares correct and faulty ciphertexts to derive key candidates from differences in selected rounds or bytes. Fault location, timing, round, and observable output determine feasibility. SIFA conditions on ineffective faulted computations: a fault was induced, but the output remained correct. The attacker analyzes the conditional bias in intermediate values from those samples to distinguish key candidates; a faulty ciphertext is not required. Here, effective and ineffective describe whether an induced fault changes the computation or output under the stated oracle. They do not refer to the DUT’s out_valid signal. Original SIFA paper.
Define the oracle first: can the attacker choose plaintexts, repeat injections, distinguish valid/timeout/alert/retry, or measure power/EM? Is the fault transient, permanent, skipped-cycle, or data corruption? Then test each observable’s relation to secrets. Constant-time alone is not a proof; sample size, noise, and multiple comparisons affect conclusions.
At RTL, assert that error state cannot create an unauthorized branch in valid/ready, retry, or key-release control. SVA cannot establish secret-independent power. Use gate-level/netlist and physical measurements for side-channel evaluation, and keep control properties separate from leakage evidence.
Interpret outcomes without conflating metrics
In a measured experiment, record the fault class, whether the computation changed, the error flag, latency, and whether the observation distinguishes outcome classes. A classifier that only performs well on its training samples has not shown generalization; hold out samples and report confidence. Failure to observe a distinction only means none was detected under these conditions.
Worked case: ciphertext is blocked, but what can still be observed?
Open this lesson’s interactive lab
After the same teaching chip boots, its cryptographic engine starts computing. The design suppresses ciphertext when it detects an error. An engineer wants to describe this as a fault-attack defense; a reviewer asks whether an attacker can still observe completion time, rejection labels, or retry count. Until that is answered, one output gate cannot support a conclusion about every information channel.
The interactive model uses A and B as teaching classes, without assigning them AES keys. In the separated setting, the four constant codes are A = [0, 1, 2, 3] and B = [3, 2, 1, 0]. The interface selects only the first three channels: ciphertext code, generic outcome label, and latency code. In the overlapping setting, both classes use [0, 0, 1, 1]. These arbitrary teaching codes are neither ciphertext contents nor measured time units.
| Channel | Separated A / B | With faulty-output suppression enabled |
|---|---|---|
| Ciphertext code (channel 0) | 0 / 3 | The model masks this channel |
| Generic outcome label (channel 1) | 1 / 2 | The difference remains observable |
| Latency code (channel 2) | 2 / 1 | The difference remains observable |
Ciphertext suppression changes observation on channel 0, without automatically changing channels 1 and 2. Switch channels to examine the distinction. Labels 1 and 2 show a generic outcome-class difference. Latency codes 2 and 1 show a teaching timing difference. Neither is SIFA by itself, and neither establishes key recovery.
What additional question does SIFA’s conditioning introduce?
The original SIFA research shows that samples producing correct ciphertext despite an induced fault can contain exploitable bias. Analysis conditions on ineffective-fault samples, rather than merely grouping valid and invalid outputs. Original paper. This lesson does not implement that attack. The example below explains only how conditioning changes a distribution.
Suppose an artificial intermediate bit X has 100 samples, with 50 at X = 0 and 50 at X = 1. Further suppose that after a fault is applied, every X = 0 sample remains correct, but only 10 X = 1 samples remain correct. Retaining only the 60 correct-output samples gives 50/60 at X = 0 and 10/60 at X = 1: approximately 83.3% and 16.7%. That conditional set no longer has the original balanced distribution.
The counts 100, 50, and 10 are synthetic. There is no measurement apparatus or AES execution behind them. Nor does the example give the attacker direct access to X. A real attack must connect observable samples, key candidates, and intermediate-value relationships. The deduction challenges the intuition that a correct output provides no information. It estimates no real SIFA success rate, and the interactive outcome label must not be mistaken for an ineffective-fault criterion.
Training accuracy and new samples are separate results
The interactive lab also provides a noisy classification exercise. Its default is 8 samples per class with 25% held out: 6 training and 2 test samples per class, totaling 12 training and 4 unseen test samples. The classifier uses each training-class mean as a center, assigns a test point to the closer class, and assigns ties to A. The model uses fixed seed 13, so repeating the same settings replays the same synthetic data; it does not obtain independent measurements.
Set noise to 0 to calculate two baselines. With separated centers, all four test samples are classified correctly: 4/4. With overlapping centers, all four tie and are assigned to A. The two A samples are correct and the two B samples are wrong: 2/4. This 50% follows from a fixed tie rule and balanced samples. It does not prove that every possible attack is limited to guessing half correctly. With noise enabled, read the generated values and actual test result instead of reusing the zero-noise answer.
Listing a constant code four times per class does not provide four independent noisy observations. More samples or settings do not automatically make an analysis reliable either. Testing many channels and reporting only the best one makes the selection procedure part of the result. Record channels, class definitions, sample splits, and criteria in advance. Four test samples help teach the workflow; they cannot establish a strong product-security bound.
Deeper exercises: answer control safety and leakage separately
Exercise A: two apparently conflicting results. Choose the separated setting. First enable faulty-output suppression on channel 0 (ciphertext) and record masked. Keep it checked, switch to channel 2 (latency), and record the two class codes. Suppression acts only on the ciphertext channel, so the latency view does not show masked again. How should these two synthetic observations be reported separately?
Answer and reasoning: Record data control and latency observation separately: the model masks the ciphertext code while synthetic latency codes still differ. Neither call suppression useless nor claim complete safety. It performs its specified control function while leaving another channel untreated. An actual timing difference still requires measurement.
Exercise B: narrow an excessive conclusion. A report says, “The overlapping classifier scored only 2/4, so there is no side channel.” Retain the observed result while correcting the scope.
Answer and reasoning: Write: “With this fixed seed, zero noise, and two test samples per class in the overlapping setting, this nearest-mean classifier scored 2/4. Other channels, classifiers, sample conditions, and physical measurements remain unevaluated.” The observation remains intact, and the next engineer can identify unsupported conclusions.
Exercise C: find a vacuous pass. error_seen |-> !out_valid passes, but there is no record of error_seen. List what is missing and how to obtain the necessary evidence.
Answer and reasoning: Evidence that the antecedent actually occurred is missing. Use coverage or a trace to establish that the specified fault class and error_seen occurred in the model, then inspect out_valid during the error. Ready, retry, key release, and latency each need their own analysis; this assertion does not check them together. Passing control properties does not complete power, electromagnetic, or SIFA evaluation.
Classroom derivation: eliminate wrong key guesses with two output pairs
Prerequisites are XOR and an invertible substitution table. XORing the same value twice restores the original. An S-box substitutes another value; a one-to-one table has an inverse S⁻¹. AES’s final round uses SubBytes, ShiftRows, and AddRoundKey, omitting MixColumns. Actual AES DFA also depends on byte placement, fault propagation, and round-key relationships. FIPS 197 CIPHER definition. First work through a smaller custom four-bit teaching construction.
Define C = S(X) ⊕ K and faulted C′ = S(X ⊕ e) ⊕ K. X is an internal value hidden from the attacker, K is a four-bit secret, and known error e = 1 is applied before the S-box. The attacker observes a matched normal/faulted pair, assuming the same X and K with only the specified e changed. These are strong assumptions. A different fault location or unmatched pair invalidates this candidate rule.
| Input x (hex) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Custom S(x) | 6 | D | 0 | B | 7 | 2 | F | 8 | 5 | A | 4 | 1 | C | 9 | 3 | E |
| S⁻¹(x) | 2 | B | 5 | E | A | 8 | 0 | 4 | 7 | D | 9 | 3 | C | 1 | F | 6 |
For each guess k, XOR C with k to remove the guessed output key, then use the inverse table to infer the pre-substitution value. Do the same for C′. Retain k when S⁻¹(C ⊕ k) ⊕ S⁻¹(C′ ⊕ k) = e. For the first pair C = 1, C′ = A, guessing k = A gives 1 ⊕ A = B and A ⊕ A = 0. The inverse table gives 3 and 2; 3 ⊕ 2 = 1, so retain A. Guessing 0 gives B ⊕ 9 = 2, so reject it.
| First-pair k | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Inferred XOR difference | 2 | 1 | 9 | 8 | 7 | C | 8 | 1 | 8 | 9 | 1 | 2 | 1 | 8 | C | 7 |
| Retain? | No | Yes | No | No | No | No | No | Yes | No | No | Yes | No | Yes | No | No | No |
The first pair leaves {1, 7, A, C}. Applying the same rule to a second pair C = 5, C′ = 2 leaves {A, D}. Their intersection is {A}: two pairs reduce sixteen guesses to one under this construction and fault model. The replay program adds a third pair 0/F, with candidates {5, A}, preserving intersection {A}. The teacher generated these records with internal X values 3, 6, and 9, and K = A. Those values check the answer; they are not extra attacker observations.
This calculation shows how DFA constrains guesses with faulty outputs. It uses one custom four-bit substitution, not AES or a standard cipher. If C′ is genuinely withheld, this construction’s required equation is unavailable. Latency, labels, and conditioned ineffective-fault samples still need separate analysis, which is why the channel model and SIFA derivation are distinct.
Assign a specific fault model to the conditional distribution
The synthetic 50/50→50/10 counts can follow this abstract operation: X = 0 stays 0; X = 1 changes to 0 with probability 80% and stays 1 with probability 20%. Assume changing X makes the output detectably incorrect, while unchanged X yields a correct output. These probabilities are chosen teaching inputs, not measurements. This differs from deterministic stuck-at-0, which would change every 1 to 0.
Let I mean correct output after the fault operation was applied. P(X=0)=P(X=1)=0.5; P(I|X=0)=1 and P(I|X=1)=0.2. Thus P(I)=0.5×1+0.5×0.2=0.6. Bayes gives P(X=0|I)=0.5/0.6=5/6 and P(X=1|I)=0.1/0.6=1/6, explaining 83.3% and 16.7%.
Binary entropy H(X) = −Σ p log₂p measures this bit distribution’s uncertainty. It starts at 1 bit and becomes −(5/6)log₂(5/6)−(1/6)log₂(1/6) ≈ 0.650 bit in the conditional set. This is entropy of X under these conditions, not a claim that 0.350 key bits were recovered. Key-candidate relationships with observable data are still required. If a perfect detector in this ideal construction suppresses every erroneous result, available correct results undergo this selection: faulty ciphertext disappears while bias can remain.
Recalculate the noisy means
Select channel 0, separated classes, seed 13, noise 1, eight samples per class, and 25% held out. A’s six training values are approximately −0.517788, 0.441483, −0.903723, 0.894415, −0.757850, 0.390318. B’s are 2.915432, 2.298159, 2.684098, 3.100048, 2.657256, 3.280248. Using unrounded values gives means −0.075524 and 2.822540.
| Unseen sample | Value (approx.) | Distance to A mean | Distance to B mean | Prediction |
|---|---|---|---|---|
| A1 | −0.373950 | 0.298426 | 3.196490 | A |
| A2 | 0.949992 | 1.025516 | 1.872548 | A |
| B1 | 2.517490 | 2.593015 | 0.305050 | B |
| B2 | 3.147977 | 3.223502 | 0.325437 | B |
All four are correct: 4/4. These fixed program settings do not guarantee results for other noise, channels, or seeds. JSON retains full precision; recalculating from six-decimal table values introduces small rounding differences.
Calculation exercise: How many candidates remain after the first DFA pair, and after adding the second? If a report states only that the third pair matches, what reasoning is missing?
Worked answer: Four remain first, then only A. The third pair checks an additional constraint against the surviving candidate; it cannot replace the first two elimination steps. Students must reconstruct sets from the public S-box, output pairs, e, and rule. JSON includes all sixteen first-pair guesses and inferred values.
Detection also needs a transaction-wide check. Suppose a fault occurs at edge 2, unauthorized out_valid at edge 4, and error_seen at edge 5 after out_valid has fallen. Same-edge error_seen |-> !out_valid passes while missing edge 4. The harness must track expected authorization, first output, the error-observation window, and transaction termination, checking every accepted output. Window length and reset/cancellation come from the design contract. No single window SVA is invented here for all engines.
JSON and Python use decimal values; the article tables use hexadecimal. For example, A=10, C=12, and D=13. Convert to one representation before comparing candidate sets.
Replay and compare
Download the program and result JSON into one folder. Run with Python 3.8 or newer:
python rtl-university-workbook-v1.py --output replay.json
Compare replay.json with the supplied result, starting with this lesson’s lesson13 field. sourceSha256 identifies the program’s bytes, separately from mathematical correctness. Editing content or resaving LF as CRLF changes that value. Keep the downloaded original and save student changes separately to distinguish method changes from file changes.
Download the classroom replay program · Inspect complete candidate and classification JSON
Offline interactive lab
The lab uses fixed-seed synthetic samples to show how sample count, observation noise, and held-out samples affect a class comparison. The constant-comparison row reports only whether the repeated codes differ; the separate held-out accuracy reports the noisy exercise. This is a teaching model, not measured leakage, an RTL result, or an attack result.
RTL / SVA review direction
These are property sketches: define the harness transaction, reset and oracle, then confirm sampling boundaries before binding to the design. They have not been compiled or proven.
assert property (@(posedge clk) disable iff (!rst_n)
error_seen |-> !out_valid);
cover property (@(posedge clk) disable iff (!rst_n)
fault_class_applied && error_seen);
This assertion checks only that out_valid is low when error_seen is high. It does not check ready, retry, or key release; each needs its own property. If error_seen never occurs, the assertion can still pass vacuously. The harness flag fault_class_applied records that the selected modeled fault was applied in this attempt. The cover checks that this flag and error_seen both occur; it does not prove successful injection into physical silicon or replace separate DFA, SIFA, or latency analysis. This snippet does not prove CDC, timing, side-channel, or physical injection behavior; each requires its own tool evidence or measurement.
Check your reasoning
- Recognition — What observation is central to DFA, and what can SIFA observe instead? Reasoning: DFA uses differences in correct and faulty outputs. SIFA conditions on ineffective faulted computations and analyzes the conditional bias in their intermediate values; the terms describe computation changes, not the DUT output-valid pin.
- Contrast — Why does rejecting faulty output not prove that a cryptographic block leaks no information? Reasoning: The reject decision is a control property. Error flags, validity, retries, latency, or power can still vary with secret-dependent state.
- Scenario — Faulty ciphertext is suppressed, but completion latency differs between two secret-dependent classes. What remains exposed? Reasoning: The timing channel remains observable. Suppressing data output only masks the faulty-ciphertext channel; it does not establish constant-time behavior.
- Failure diagnosis — A fault-outcome code separates the two classes in training samples. What evidence is still needed? Reasoning: Define the outcome classes first, then check sample counts, noise, repeated trials, and held-out data. A pattern in one small synthetic set is not a calibrated attack result.
- Design risk / transfer — After randomized latency or a new sample set, what changed in the oracle? If this sample shows no distinction, what may the reviewer conclude? Reasoning: Record the timing and sample conditions that changed. Only this sample and these observations failed to distinguish the classes; other channels, conditions, and physical measurements remain unexamined.
References
DFA of AES (IACR ePrint 2011/178) · Original SIFA paper (IACR ePrint 2018/071) · SIFA on masked AES (IACR ePrint 2018/357) · SIFA countermeasures (IACR ePrint 2019/536)
MY ACADEMY · LESSON FILM
Lesson video
The film explains this lesson’s data path. After a section, return to the interactive exercise and change the input or fault conditions. The animation presents a teaching model; it does not replace RTL simulation.
Swipe the film horizontally, or use the arrow keys to inspect the diagrams.
Diagram scope
Teaching model · Not RTL simulation or silicon testing
Concept / synthetic teaching scope; not a SIFA attack, key recovery or silicon measurement
Narration uses a synthetic voice. Both the interaction and animation have model boundaries; interpret results using this lesson’s sources and validation scope.
Wrap-up: take this lesson into a design review
- Threat model and assumptions
The attacker may repeat faults and observe ciphertext, validity, latency or power; the asset is the key/intermediate state.
- Why the design fails
DFA uses correct/faulty output differences; SIFA conditions on ineffective faulted computations and analyzes statistical bias in an intermediate value.
- Defenses
Constrain fault/oracle capabilities, verify output suppression/error handling, and assess physical side channels independently.
- Validation and checks to perform
Record fault classes and observable outcomes separately. Effective/ineffective describes computation or output changes, not the DUT out_valid pin. Control assertions do not replace attack-success or information analysis.
- Limits and unverified claims
Synthetic samples are not a crypto implementation test. No-model/no-detection does not prove zero leakage or cover all power/EM attacks.
Try a changed assumption
Add randomized latency and resampling; state which oracle changes and which attacks remain possible.
This wrap-up summarizes the lesson’s teaching cases, references and experiment scope. Checks not reported as completed remain future work.