A side-channel attack extracts secret information from observable implementation behavior rather than from the intended cryptographic output. Timing, power consumption, electromagnetic emissions, and processor effects can reveal which operations a secret computation performs. section 10.4.2 section 10.5
Recovering an exponent from power
Square-and-multiply processes each exponent bit with a squaring and, for a 1 bit, an additional multiplication. Because multiplication consumes more resources than squaring, an oscilloscope attached to a device can expose differing power levels and help recover an RSA private exponent. Noise and superscalar processors complicate analysis, while machine learning increasingly automates it. section 10.4.2
Table 10.1 Square-and-multiply algorithm for exponent \(42 = (101010)_2\)
| Previous answer | Bit processed | Previous answer squared | Multiplied by \(x\) | New answer |
| \(1\) | \(1\) | \(1\) | \(x\) | \(x^1 = x^{(1)_2}\) |
| \(x\) | \(0\) | \(x^2\) | - | \(x^2 = x^{(10)_2}\) |
| \(x^2\) | \(1\) | \(x^4\) | \(x^5\) | \(x^5 = x^{(101)_2}\) |
| \(x^5\) | \(0\) | \(x^{10}\) | - | \(x^{10} = x^{(1010)_2}\) |
| \(x^{10}\) | \(1\) | \(x^{20}\) | \(x^{21}\) | \(x^{21} = x^{(10101)_2}\) |
| \(x^{21}\) | \(0\) | \(x^{42}\) | - | \(x^{42} = x^{(101010)_2}\) |
Trace square-and-multiply for exponent 42 and see how each processed bit determines whether multiplication occurs. section 10.4.2
Secret-dependent branching creates the same general weakness. A comparison, loop, or array access that changes control flow can alter execution time; speculative execution and cache behavior may make the difference measurable without physical probing. section 10.5
Reduce side-channel exposure with implementation discipline:
- Use constant-time algorithms that perform a consistent sequence of operations regardless of secret inputs. section 10.4.2
- Avoid branching and iterating on sensitive values, and avoid secret-dependent indexing. section 10.9 section 10.5
- Test implementations for timing differences and treat lower-level optimization as security-sensitive rather than merely performance-oriented. section 10.4.2 section 10.5


