R02B · COMIC CLASSROOM

Side-Channel Defenses: Keeping Computation Clues from Pointing to a Key

Follow three proposed fixes for a lab lock through constant-time design, masking, RSA blinding, randomized ECC coordinates and device boundaries, with two interactive teaching labs.

MY Academy · 2026-10-13

15 min read

Side Channel2/2

Once computation can leave clues, the team faces design choices. One proposal changes timing, another adds background activity, and a third changes internal data representation. We follow the same lock through those choices and their evaluation, checking both what preserves the answer and what remains observable.

We found clues. What should the fix target?

1/12 — MY returns to the fictional lab lock with three proposed fixes: timing, background activity and representation.
1/12 — MY returns to the fictional lab lock with three proposed fixes: timing, background activity and representation.

The MY-Lock from the previous lesson encrypts access logs and blocks direct export of its data key. Those functions still matter. Our new job is to examine clues left while the key is used and decide where the next design effort should go. The lock, observations and proposed fixes are a fictional teaching scenario, not a test report for a commercial product.

Start by defining the observer’s access. A remote user might repeat requests and record response times. Someone holding a device might also observe power or electromagnetic activity. These are different evaluation questions. Testing response time can provide evidence about that timing path, but it does not answer what a physical observer could learn.

The three cards address different relationships. Secret-independent timing targets observable timing differences. Background activity aims to make a signal harder to distinguish. Changing internal representation aims to avoid repeatedly computing with the same sensitive intermediate values. Before continuing, consider this choice: if two operations take the same time but process different data, which other card might still be needed?

We first examine use of the AES data key, then add an optional device-signature function and compare RSA and ECC designs. A device-signing private key has a different role from a log-encryption key. Firmware verification is separate again: the device may hold the manufacturer’s verification public key, while the firmware-signing private key belongs outside it in the signing facility. The protection must follow the correct secret.

Constant-time: which choices must not depend on a secret?

2/12 — An early-exit comparison exposes a stopping point; a full comparison still needs lower-level checks.
2/12 — An early-exit comparison exposes a stopping point; a full comparison still needs lower-level checks.

Imagine a lock comparing four positions and stopping at the first mismatch. One comparison ends at position two, while another reaches position three. The duration may then depend on how much of the prefix matched. One stopwatch reading need not reveal that prefix, but an interface allowing repeated requests gives an observer opportunities to compare. The diagram shows this relationship without simulating network noise.

Checking every position removes that particular early-exit choice. The principle is to keep observable timing behavior independent of secrets. Constant-time does not require identical wall-clock readings on every run. Scheduling or public input length can still affect duration. An evaluation must identify what is public and what is supposed to remain secret before interpreting differences.[1]

A tidy source-code loop is not enough evidence. Secret-dependent branches, table addresses or low-level operations can still create timing clues. The compiled instructions and target platform need inspection as well. BearSSL’s implementation discussion gives examples of these layers; a project must check its own version and execution environment rather than borrowing a conclusion from another platform.[1]

MY puts away the early-exit card and asks the robot to bring back the power diagram. The same number of operations can process different bit values. Constant-time gives us a more precise claim about a timing path, while the power question remains open. We follow that unresolved question into AES intermediates in the next section.

Regular flow can still process different data

3/12 — The same AES flow processes different data; illustrative traces show possible differences in bit activity.
3/12 — The same AES flow processes different data; illustrative traces show possible differences in bit activity.

The lock now follows the same AES operation order. Its input, processing and output stages do not move, and functional tests return correct results. Recording only that order would miss the values inside the stages. An intermediate depends on the input and key. Even when it stays inside the chip, it becomes a value that the physical circuit must process.

The previous lesson used Hamming weight to count the ones in a word and Hamming distance to count changes between an old and new word. These are simplified analysis models. The illustrated values 0000 and 1111 make a difference easy to see; they do not establish a fixed power ratio for every chip. Actual activity also depends on circuitry, data paths and observation conditions.

If an observation method can distinguish a data relationship, a regular operation sequence answers only part of the question. MY records operation order and intermediate data separately. This also helps locate a failure: did the control flow change with the secret, or was the flow already regular while the processed values retained an analyzable relationship?

General readers do not need to design an AES circuit here. The useful skill is reading a security claim. When someone says a core has a fixed flow, ask which observation points were tested and how data-dependent activity was addressed. The next two approaches work on different parts of that question: the data relationship and the difficulty of distinguishing a signal.

Noise and masking change different things

4/12 — Background activity overlays a clue; masking changes the representation used in computation.
4/12 — Background activity overlays a clue; masking changes the representation used in computation.

The robot first enables extra background activity. The clue on the screen becomes harder to distinguish. Think of trying to hear a sentence with other sounds nearby: hearing becomes harder, but the original sentence remains. This analogy only separates a signal from its background. It describes no particular filtering method and promises no protection from adding a small amount of noise.

A noise proposal therefore needs to explain how it changes the cost of obtaining useful observations under a defined adversary capability. Background activity consumes resources, and the amount of data available to an observer may change the result. A messy-looking trace alone cannot tell us whether that cost is worthwhile without the observation conditions.

MY then replaces the card with a different internal representation of the sensitive value. A simple masking demonstration splits a value into two shares and aims to maintain that representation through computation until an allowed output boundary. We must check how each step preserves the answer and how many shares an observer can see. The next section uses four-bit cards to make the relationship explicit.

Both measures can appear in one design, but their evaluations need separate questions. Noise needs observation and resource conditions; masking needs a representation and observation assumptions. A report saying that randomness was added does not yet identify whether it obscures activity, splits data or delays the start. Locate its effect before deciding whether the intended protection holds.

How do two shares preserve the answer?

5/12 — 0011 XOR 1001 gives 1010; linear steps and nonlinear S-boxes require different treatment.
5/12 — 0011 XOR 1001 gives 1010; linear steps and nonlinear S-boxes require different treatment.

Call the sensitive value v and the random mask r. Set the first share to a = r and the second to b = v XOR r. XOR returns one where two bits differ and zero where they match. Applying the same r twice cancels it, so a XOR b recovers v. The example 0011 XOR 1001 = 1010 lets us check that recovery bit by bit.

In this ideal model, r is uniform over all sixteen four-bit values, independent of v and unknown to the observer. For any fixed v, either a or b alone ranges over all sixteen values, so that share’s distribution does not change with v. This conclusion concerns one isolated share. The lab enumerates every mask instead of treating a flat-looking random sample as proof.

The next task is to keep computation in the shared representation. An XOR-linear transform can act on each share separately. XOR a public constant into one share; applying it to both would cancel it on reconstruction. A nonlinear S-box is a different problem: simply XORing two separate S-box outputs does not generally produce the S-box output for the original value. The extension below tests even an affine correction and still finds a mismatch.

Real designs need dedicated methods for nonlinear operations. OpenTitan AES is one concrete example: its masking design includes the cipher and key schedule, with a dedicated masked S-box.[2] Our two cards are not a complete AES implementation or deployable secure code. They first make two separate conditions visible: retaining the correct answer and limiting what an observation reveals.

Engineer extension: check the algebra

Use the public four-bit PRESENT S-box, not the AES S-box.[9] S = [12,5,6,11,9,0,10,13,3,14,15,8,4,7,1,2]. For v=1, a=2 and b=3, a XOR b=1. S(a) XOR S(b)=6 XOR 11=13. Even XORing S(0)=12 gives 1, while S(v)=5. This mismatch survives the affine correction. It is a correctness counterexample, not a secure nonlinear masking construction.

Where can shares meet without explicit reconstruction?

6/12 — A register changes from 0011 to 1001; an ideal HD model counts two flipped bits.
6/12 — A register changes from 0011 to 1001; an ideal HD model counts two flipped bits.

The robot loads a into a register, then reuses that register for b. The program never calls a XOR b, and no reconstructed value is stored back. Yet the register has undergone a transition from a to b. If an observation model is sensitive to their bit difference, the two shares become related through that physical location.

With our definitions, HD(a, b) = HW(a XOR b) = HW(v). The transition from 0011 to 1001 changes two positions, while v = 1010 also contains two ones. This is an original derivation in an ideal four-bit model. It shows why absence of explicit reconstruction cannot alone justify a security claim. It does not prove that every physical register’s power equals its flip count.

Combining simplified activities from both shares deserves inspection too. The lab enumerates the distribution of HW(a) + HW(b). Its mean stays at four, but its variance changes with HW(v); comparing only means misses that relationship. Physical higher-order analysis is more complex than this sum. We use it only to show why a conclusion must be reconsidered when the observation assumption changes.

Randomness generation and refreshing are also implementation work. Fresh, independent masks can coincidentally repeat; they are not guaranteed to differ. OpenTitan’s example supplies pseudorandom data through a PRNG reseeded via its entropy distribution network, rather than sourcing each mask bit directly from a TRNG.[2] Circuit transients and share composition require suitable models and methods. Algebraic tests do not replace those checks.[8]

Engineer extension: check the algebra

Across all sixteen uniform independent masks, the population mean of HW(a)+HW(b) is 4 and its population variance is 4−HW(v). At v=0, the shares match; at v=15, they complement each other and their sum is always 4. This ideal mathematical example limits the isolated-share argument. It supplies no success probability for a physical higher-order attack.

Interactive lab: one share or two?

Only public teaching numbers are calculated. No device is measured, no data are uploaded, and no attack-resistance proof is produced.

Keep v fixed and change r to check a XOR b. Then inspect the exhaustive distribution over all 16 masks below; a single chosen r is not a uniform distribution.

Two shares

One register transition

Combined model activity

Enumeration assumes r uniform over 0–15, independent of v and unknown to the observer. This interface exposes all values for readers to check; it does not simulate an observer seeing secrets.

All masks: shares, transitions and joint activity
HW counts ones; HD counts differing bit positions. These are not power measurements.
r / abHW(a)HW(b)HD(a,b)HW(a)+HW(b)
Why is a mean comparison insufficient?

The ideal sum has mean 4 and variance 4−HW(v). Uniform isolated shares therefore do not make the joint distribution independent of v. This is not a success rate for a physical higher-order attack.

How does RSA change the input and restore the result?

7/12 — An optional device-signature design uses input blinding while identifying the remaining protection scope.
7/12 — An optional device-signature design uses input blinding while identifying the remaining protection scope.

Suppose MY-Lock must prove its device identity to a management system. The team can add a signature function, using RSA as our first design option. Its signing private key needs protection; the management system verifies with the corresponding public key. This identity function is separate from the AES data key that protects access logs. The keys should not be treated as interchangeable.

Input blinding applies a reversible transformation before a private-key operation, then restores the result. Think of changing the working number and removing the introduced factor afterward. The transformation must match RSA’s algebra; multiplying by an arbitrary value is not enough. OpenSSL’s RSA documentation identifies the public exponent e as necessary for input blinding. The extension below spells out the recovery relationship.[3]

The intended effect is to change some input-related intermediates, so the same original input need not enter computation in the same form every time. A blinding factor must permit recovery, remain secret and be refreshed as required by the design. A noninvertible factor can break recovery. A known or repeatedly fixed factor changes the protection assumptions. Functional correctness and these conditions need separate records.

Input blinding does not automatically rewrite a secret-exponent-dependent operation sequence or protect every loading and clearing path. MY records those open questions on the back of the card instead of declaring the whole RSA implementation attack-resistant. This lesson supplies neither deployable RSA signatures nor a physical measurement procedure. Exponent blinding and additional implementation strategies remain topics for a later engineering lesson.

Engineer extension: check the algebra

For raw RSA teaching algebra only, set m′=m·r^e mod n and s′=(m′)^d mod n, then s=s′·r⁻¹ mod n. An invertible r and valid RSA key relation recover m^d mod n. With r=1 the input is unchanged; a noninvertible r cannot be unblinded by this formula. Real signatures require specified encoding and padding. Small-number algebra is no replacement for a standard implementation.[3]

What do ordinary projective coordinates solve?

8/12 — RSA and ECC are alternative designs; coordinate efficiency and side-channel protection are separate questions.
8/12 — RSA and ECC are alternative designs; coordinate efficiency and side-channel protection are separate questions.

Now replace the device-signature option with ECC. This is an alternative to compare with RSA, not a requirement to use both in one lock. ECC performs arithmetic on curve points. Affine coordinates use two numbers for a point. Projective coordinates add a coordinate and allow multiple equivalent representations of that same point.

Why carry another number? Finite-field point addition and doubling formulas involve division, usually implemented with an inverse. Projective coordinates can defer some inversions and use multiplication and other operations for intermediate steps. The trade-off depends on formulas and platforms. The plate therefore says fewer inversions rather than promising that every implementation will be faster.[6]

Separate that efficiency question before treating ordinary projective coordinates as a DPA defense. A changed coordinate convention can still retain secret-related control sequences or data relationships. Consistently using a coordinate system and randomly selecting an equivalent representation are different design actions. We add the randomizing factor in the next section.

Identify the secret used by the point multiplication too. ECDSA signing computes kG with the per-message secret nonce k, while the long-term private key d enters a separate scalar calculation.[7] The plate labels its base point P, making Q = k · P an illustration of that multiplication. Do not confuse this Q with a fixed long-term public key or infer protection for every operation involving d.

Why does a randomized representation retain the same point?

9/12 — Over GF(17), Jacobian (5,1,1) becomes (3,8,2), recovering the same affine point (5,1).
9/12 — Over GF(17), Jacobian (5,1,1) becomes (3,8,2), recovering the same affine point (5,1).

Choose a deliberately small teaching world. Numbers are reduced modulo 17, and the curve is y² = x³ + 2x + 2. The point (5,1) lies on it because both sides reduce to one. We use this point to check equivalent representations, not to provide cryptographic security. Real curve parameters and security requirements belong to the chosen system specification.

This section uses Jacobian coordinates with recovery x = X/Z² and y = Y/Z³. Division uses a finite-field inverse. A nonzero λ changes (X,Y,Z) to (λ²X, λ³Y, λZ), and the factors cancel on recovery.[6] With λ = 2, (5,1,1) becomes (3,8,2), yet recovers (5,1). The lab enumerates all sixteen nonzero choices.

The method can change some coordinate intermediates while preserving the mathematical result. Coron’s early paper discusses randomized projective representation against particular power-analysis attacks. Its recovery convention differs from the Jacobian convention used here, so the formulas must not be mixed.[5] We separate an efficiency-oriented representation from the added randomization measure and do not reuse historical parameters as modern recommendations.

The scope remains limited. A zero coordinate stays zero under nonzero scaling, so not every value must change. The stacked triples in the plate are equivalent representations of one point, not the actual sequence of points in a scalar multiplication. Secret-dependent operation order, inversion of k and scalar operations involving d need separate checks. Correct coordinate recovery supplies no security proof for those paths.

Engineer extension: check the algebra

The default is Jacobian: x=X/Z², y=Y/Z³, with scaling (λ²X,λ³Y,λZ). A homogeneous convention instead uses x=X/Z, y=Y/Z and scaling (λX,λY,λZ). Switch between them in the lab and check the recovery rule first. This finite-point experiment requires λ≠0 and does not represent the point at infinity.[5][6]

Interactive lab: does a changed representation change the point?

Only public teaching numbers are calculated. No device is measured, no data are uploaded, and no attack-resistance proof is produced.

Choose a finite point and a nonzero λ. Predict its recovered point, then check the triple. Try x=0 too: scaling does not make every value nonzero.

GF(17): y² = x³ + 2x + 2

Equivalent triple

Recovered affine point

This lab checks representation and recovery only. It performs no secret scalar multiplication and simulates no power or CPA/DPA. Operation order, inversion of k and scalar operations involving d remain outside its scope.

Representations for every nonzero λ
Equivalent representations of one point, not a scalar-multiplication trajectory.
λXYZRecovery

Protect the nonce throughout its use

10/12 — Protect k and d separately; repeated observations of the same key and message differ from incorrect nonce reuse across messages.
10/12 — Protect k and d separately; repeated observations of the same key and message differ from incorrect nonce reuse across messages.

MY-Lock’s ECDSA signature needs a nonce k. Even when its generation method meets the required conditions, k must still enter computation. That use is part of the protection scope. The long-term private key d and k have different roles. Complete knowledge of k can connect a public signature back to d through the signing equation. The extension explains this confidentiality requirement without giving device-compromise procedures.

FIPS 186-5’s signing flow includes point multiplication, inversion of k and scalar arithmetic combining the message digest with d.[7] Evaluating randomized coordinates for point multiplication therefore leaves other secret-dependent operations to inspect. MY places the three stages alongside one another in the plate so their separate evaluation needs remain visible.

With RFC 6979 deterministic nonce generation, fixed algorithm parameters, the same private key and the same message produce the same k. That differs from incorrectly using one k to sign different messages. RFC 6979 notes that determinism may help some side-channel observations, so defensive measures remain necessary.[4] If our teaching lock repeatedly signs the same request, its evaluation should include repeated observations instead of automatically labeling the repeated nonce a generation failure.

Connect the whole lifecycle: where k is stored after generation, who can read it, and how it is cleared after use. These questions accompany the computation itself. Resolving a nonce-generation problem answers that stage, not the use or residue questions. We therefore leave the signature core next and follow the secret through the surrounding device.

Engineer extension: check the algebra

In common ECDSA notation, s=k⁻¹(h+r·d) mod n. If k is completely exposed and r is invertible, public h, r and s give d=r⁻¹(s·k−h) mod n. Here r is a signature component, not the earlier mask or RSA blinding factor. The equation explains why k must remain secret.[7]

Follow the secret through the whole device

11/12 — Loading, storage, buses, the core and clearing have boundaries; observation and fault injection need separate treatment.
11/12 — Loading, storage, buses, the core and clearing have boundaries; observation and fault injection need separate treatment.

MY divides the device into loading, temporary storage, a bus and the computation core. This is not a specification for a particular SoC; it asks where a secret appears and in what form. Keeping shares inside a core cannot guarantee protection for an unmasked load outside it. A dedicated key path still needs checks of endpoint permissions, transmitted representation and error handling.

Data do not necessarily disappear when the function finishes. Temporary memory, debug interfaces and retained state may still need attention. A broom icon cannot serve as evidence of secure clearing. A design must identify what is cleared, which events trigger it, and whether interruption or errors leave residue. The acceptance record should follow the actual path.

Another question concerns an adversary actively disturbing computation to change a result or decision. Side-channel analysis first examines clues from operation; fault injection changes its conditions. A masking scheme’s algebra and observation model do not automatically cover that disturbance. A design may address both, but it must state their threats and evidence separately.

This is one reason to read OpenTitan AES integration documentation. It includes key supply, control and clearing boundaries alongside the mathematical design.[2] We use it as one concrete inspection perspective, not a claim that another device inherits its outcome by copying feature names. Acceptance of MY-Lock still needs the version and integration conditions of MY-Lock itself.

Back to the lock: how should we evaluate the fixes?

12/12 — Each fix has conditions; claims, scope, evidence and costs must agree.
12/12 — Each fix has conditions; claims, scope, evidence and costs must agree.

At the original table, MY puts the three cards back in place. The timing card checks whether secrets affect observable timing paths. Background activity needs conditions explaining a change in analysis cost. Representation changes need checks of computation and observation assumptions. We can now say what each card addresses and why one card cannot answer every question.

An acceptance record should let someone else reproduce the judgment. Identify the implementation version and configuration, specify the observer’s access, and record evaluation methods and conditions. List uncovered risks too. Seeing no leakage under those conditions supports a bounded result. Another observation point, a larger collection or different integration may require a new evaluation.

Costs also belong to product conditions. Extra area, latency or randomness demand may affect battery life and available throughput. This lesson invents no cost figures. The team needs comparisons on its own target implementation to explain a chosen combination. Functional tests, toy-model tests and physical security evaluation provide different kinds of evidence; none replaces the others.

What changes if an adversary once limited to remote requests can now hold the lock? The timing-path result remains part of the record, but the added physical access needs further evaluation. Our resolution is to preserve correct functionality and select defenses with explicit threats and evidence. The next lesson turns to quantum threats and migration, asking how a system prepares when an algorithm’s mathematical security conditions change.

Glossary

  • Share: part of a representation; this lesson reconstructs a value with XOR of two shares.
  • Blinding: transform working data according to an algebraic relationship, then restore the correct result.
  • Nonce: here, the ECDSA per-message secret k, distinct from the long-term private key d.
  • Projective representation: equivalent coordinates for one point; the labs distinguish Jacobian and homogeneous conventions.

Learning check

1. Do equal durations show that power contains no key-related clue?

No. Timing and data-related activity are different observation relationships. Power evaluation still needs access, observation points and conditions.

2. Which assumptions make an isolated share’s distribution independent of v?

A uniform r independent of v and unknown to the observer, with only one isolated share observed. Combined or transition observations need separate analysis.

3. If a and b are never reconstructed but reuse one register, what should be checked?

Inspect the a-to-b transition. In the ideal HD model, HD(a,b)=HW(v). Algebraic sharing does not guarantee separate physical observations.

4. Does changing a point to Jacobian coordinates complete ECDSA side-channel protection?

No. A coordinate convention differs from randomization. Even randomized coordinates do not automatically protect operation order, inversion of k or scalar operations involving d.

5. How should an existing remote-timing evaluation be used after an attacker gains physical access?

Retain its version and scope, then add evaluation of physical observations and integration. The earlier result does not automatically cover the new access.

Primary sources

Sources checked 2026-10-13. The algebra labs are original teaching models, with no certification or physical security evaluation claimed.

  1. BearSSL: Constant-Time Crypto
  2. OpenTitan AES: Theory of Operation
  3. OpenSSL 3.5: EVP_PKEY-RSA
  4. RFC 6979 §4: Security Considerations
  5. Coron (CHES 1999): Resistance against Differential Power Analysis for Elliptic Curve Cryptosystems
  6. Explicit-Formulas Database: Short Weierstrass curves, Jacobian coordinates
  7. NIST FIPS 186-5: ECDSA; formula cross-check RFC 6979 §2.4 · RFC 6979 §2.4
  8. Faust et al. (2017): Composable Masking Schemes in the Presence of Physical Defaults and the Robust Probing Model
  9. PRESENT: An Ultra-Lightweight Block Cipher (CHES 2007), S-box table

#SideChannel #Masking #Blinding #ECC #KeyProtection