Modules / M6

Supply chainDigital logicWritten material

Combinational logic locking

The topic

Combinational logic locking inserts key gates into a ripple-carry adder. The sum is correct only for the right key. A wrong key inverts a carry, and the error propagates into the higher bits.

Where it belongs

Course: Digital logic.
Teach this after: the ripple-carry adder, and after students can build a larger circuit from a smaller VHDL part. They should be able to simulate an adder before they add the lock. The lab is written and has not been graded yet.

Files and how to use them

There is no slide deck. Give students the manual and the full-adder file after the adder lectures. Use the VHDL tool the course already teaches. The manual is written for Vivado.

  • Lab manual. Objectives, figures, and the report checklist. A short in-class introduction can come from those figures, about 30 to 40 minutes, once the unlocked adder works.
  • FullAdder.vhdl. The only source students receive. They build the 4-bit adder from it, simulate, then add the lock.

Video lectures

These are links, not files stored with the module. Play one in class, or send the link to students.

Further reading

Optional papers for the instructor, or for a student who wants to read past the assignment.

  • Hoque, Chakraborty, and Bhunia, “Hardware Obfuscation and Logic Locking: A Tutorial Introduction,” IEEE Design & Test, vol. 37, no. 3, pp. 59–77, 2020. This lab was adapted from that tutorial. The tutorial PDF is not redistributed here.
  • Rajendran et al., “Fault Analysis-Based Logic Encryption,” IEEE Transactions on Computers, vol. 64, no. 2, pp. 410–424, 2015.

The exercise

Students receive one file: a full-adder entity. They build a 4-bit ripple-carry adder out of four instances, simulate it, and only then insert a lock on the carries between stages. The adder is correct only for the key they designed. An incorrect key corrupts a carry, and the error ripples into the higher bits.

Outcome

Under the right key the adder matches binary addition across the input space the testbench covers. Under a wrong key the two lock styles fail differently. XOR and XNOR invert one or more carries. A multiplexer substitutes some other signal into the carry chain. The student compares the styles and says how the key could be made longer.

Part I. The adder, unlocked

  1. Read FullAdder.vhdl. Sum is the XOR of the two bits and carry-in. Carry-out is the majority of those three.
  2. Instantiate four full adders. Connect carry-out of one stage to carry-in of the next.
  3. Write a testbench, simulate, and confirm ordinary addition. In Vivado, set the radix of A, B, the sum, and carry-out to unsigned decimal before taking the screenshot.

Part II. Lock the carry chain

Insert key-controlled logic between carry stages. Use either XOR and XNOR gates or multiplexers. Add a 3-bit key input. The design must add correctly for the key the student declares, and it must fail for other keys. The student chooses and documents that key. A reference convention used when this lab is discussed in the paper: a key bit of 0 passes a signal through an XOR and a key bit of 1 passes it through an XNOR.

Part III. Correct key and wrong key

Sweep the inputs under the correct key and under at least one incorrect key. Capture A, B, the sum, and carry-out only. The report holds the unlocked sources and schematic, the locked sources and schematic, the testbench, both waveforms, and the discussion questions in the manual. Those questions ask why a carry is a useful place to lock, how the two styles differ, and what would make the key space larger.

Software assumed by the manual is Vivado. Any VHDL simulator that can show a waveform will serve if the course already uses it. The instrument-reuse rule prefers the tool the course already teaches.

Support

This work was supported in part by the U.S. National Science Foundation (NSF) Secure and Trustworthy Cyberspace (SaTC) program under Award No. 2114157.

Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the U.S. National Science Foundation.

The project is a collaboration of the University of Kansas, the University of Florida, and Florida International University.