Reverse engineering a chip from its layout: my first ASIC

The figures from the writeup, one per screen, in order.

6 visuals arrow keys or j and k move between them

1 2 3 4 5 6

1 / 6 in the writeup

The warmup chip’s GDS in 3D. Standard cells along the bottom, metal wiring stacked above them, wide power straps on top. The puzzle chip is the same thing with a lot more cells.

2 / 6 in the writeup: Placement is evidence

Scatter of the warmup DEF placement, coloured by instance

Scatter of the warmup DEF placement, coloured by instance

3 / 6 in the writeup: Picking an approach

The annotated die image from the puzzle, with the output generator box

The annotated die image from the puzzle, with the output generator box

4 / 6 in the writeup: Polygons back into wires

Given netlist and3_2 cmp0/_2_ C B A and4bb_2 cmp0/_3_ D C A_N B_N and4bb_2 cmp0/_4_ C D A_N B_N sum[8] sum[7] sum[6] sum[5] sum[4] sum[3] sum[2] sum[1] sum[0] _0_ _1_ S ≅ Extracted from GDS and3_2 C B A and4bb_2 D C A_N B_N and4bb_2 C D A_N B_N

Left, the warmup’s given netlist. Right, the same cells pulled out of the polygons with identical wiring. The script does this for the whole chip.

5 / 6 in the writeup: The waveform had the answer’s shape all along

The example VCD in Surfer: two enable windows with input bits on I, a reset pulse between them, a burst on O after each window, success flat

Two enable windows, each with a stream of bits on I. A rst_n pulse between them. A short burst on O after each window. success never moves. The cursor sits on one character of the first burst, 0x47, which is a G.

6 / 6 in the writeup: Letting Z3 find the key

1. Unroll the chip in time reset 636 gates cycle 1 636 gates cycle 2 636 gates … cycle 121 636 gates idle × 8 636 gates 92 flops I_0 I_1 I_120 success = one formula over I_0 … I_120 121 input symbols · 92 × 129 = 11,868 flip-flop symbols · built in 11 s 2. Let Z3 search the formula deduce every bit that success = 1 forces guess one free bit and propagate contradiction: learn the failing combination, back up, guess again consistent: more bits fixed, guess again no free bits left: sat. the 121 bits are the key solved in 0.4 s · add "not this key", solve again: unsat, so the key is unique

Top: the chip unrolled in time, one copy of the gates per clock cycle, the flip-flops carried between copies. Bottom: how Z3 works through the formula.