This repository contains resources related to K-Gate Lock logic locking scheme.
Kevin Lopez & Amin Rezaei
The file structure is organized as follows:
-
Tools - Tools used to test the algorithm:
- RANE - Tool used to perform attacks on encrypted circuits.
- NEOS - Tool used to perform attacks on encrypted circuits.
- ABC - Tool used to convert Verilog, BLIF, and BENCH files.
-
src - The source code for encrypting and testing the algorithm:
- test_runs - Contains the previously run algorithms. The folder name matches the configuration run.
- Example:
k_2____MaxGates_10____5bitslocked 10 gates with level 2 and 5-bit key size.
- Example:
- PowerMeasurement - The Xilinx Vivado project used for power measurement.
- help_scripts - Contains scripts to convert BLIF and Verilog files using abc.
- Other Files - Used for the implementation of the algorithm.
- test_runs - Contains the previously run algorithms. The folder name matches the configuration run.
The K-Gate Lock logic locking scheme secures digital circuits by adding gates that require specific keys to function. The process is illustrated below:
- Original Circuit: Get the inputs from the user on how to lock the circuit.
- Identify the circuit to be locked.
kto lock,gto lockkeysrequired.
- Gate Selection: The algorithm selects gates to lock based on the given
k. - Key Integration: Generate the truth table and assign key inputs to achieve the desired input combination. Use K-maps to simplify boolean expressions.
- Encryption: Integrate the locked gates into the original circuit, making the circuit dependent on the keys for correct functionality.
For a deeper explanation, refer to the paper.
Before running any help script, ensure the following steps are completed:
-
Install Dependencies:
-
Navigate to the src Folder:
- Run the following command to navigate inside the
srcfolder:cd <project_dir>/src/
- Run the following command to navigate inside the
To encrypt a BENCH file, simply run the main.py file with a file to encrypt, keys, and k (NOTE: python, PyEda need to be installed)
python3 main.py "./src/benchmarks/iscas85/c17.bench" --key_values="3 4 5" --k=2
To test the algorithm in a single file, run the test_bench_file.sh using Linux ( NOTE: NEOS, python, and PyEda need to be installed)
./test_bench_file.sh ./benchmarks/iscas85/c17.bench --keys="3 4 5" --k=2
This command will generate the encrypted file (run the python script motioned in 'Encrypting a BENCH file'), then run NEOS with SAT solver.
to perform a batch test, run the ./test_folder.sh file with the following positional
- Folder path: Where are the files located
- keys: keys to test with example "3 4 5"
- Key1 = 3 or 011
- Key2 = 4 or 001
- Key3 = 5 or 101
- k: number of inputs that the locked gate needs to have
Example of a command:
./test_folder.sh ./benchmarks/iscas85 "5 5 5" 2
@INPROCEEDINGS{KGL,
author={Lopez, Kevin and Rezaei, Amin},
booktitle={Proceedings of 30th Asia and South Pacific Design Automation Conference (ASP-DAC)},
title={K-Gate Lock: Multi-Key Logic Locking Using Input Encoding Against Oracle-Guided Attacks},
year={2025},
volume={},
number={},
pages={794-800},
doi={10.1145/3658617.3697764}
}
This project is licensed under the MIT License - see the LICENSE file for details.
