This repository contains resources related to Cute-Lock logic locking family.
Kevin Lopez & Amin Rezaei
- Ubuntu 22.04 (WSL, VM, or native installation)
- Python 3
- Conda
-
Install Python 3
-
Set up the Python environment using Conda:
conda env create -f /src/environment.yml conda activate dynamic_key_logic_key_locking -
Install the following tools (found under
src/Tools/*):- yosys
- abc
- neos
- RANE
- HALL
Download and compile these repositories from GitHub. Additional dependencies may be required.
-
Navigate to the 'src' folder.
To encrypt a file using the Behavioral Multi-Key Locking algorithm, use the Python script with the following arguments:
python CreateEncryption.py [arguments]
Arguments:
--file_name: Path to the Verilog file to encrypt. Default: "./nonKey.v"--keys: Keys to use for encryption (space-separated). Default: "1 2 3 4"--counter_cycles: Number of clock cycles per stage. Default: 2--output_dir: Output directory for the encrypted file. Default: "./"
Example:
python CreateEncryption.py --file_name path/to/your/file.v --keys 5 6 7 8 --counter_cycles 3 --output_dir path/to/output/
If an argument is not specified, the script will use its default value.
This process starts with a seq.v file (regular sequential file) and creates a locked_seq_file.v file.
Run the run_file_encryption.sh script with a seq.v file:
./run_file_encryption.sh seq.vExample:
./run_file_encryption.sh NonKey.vTo run tests on multiple files in a directory:
./run_multiple_file_encryption.sh dir/pathExample:
./run_multiple_file_encryption.sh ./FSMs/The script performs the following steps:
- Encrypts the
seq.vfile using the multi-key locking algorithm. - Creates
.bliffiles of bothseq.vand the encrypted file using yosys. - Modifies the
.bliffiles:- Replaces
.subcktwith.names - Adjusts
.latchsyntax - Ensures at least one state (preferably the first state, s1) is 0
- Replaces
- Creates
.benchfiles from the.bliffiles using abc. - Tests the locking algorithm by running the
.benchfiles using neos.
This process starts with a seq.bench file and creates a locked_seq_file.bench file.
Use the /src/structuralEncryptor.py script with the following options:
--file_name: (Required) Path to the file to encrypt. Default:./s27.bench--keys: (Optional) Space-separated string of keys for encryption. Default: "2 2"--output_dir: (Optional) Output directory. Default:./output/--s: (Optional) Number of DFF to lock. Default: 1
Example:
python3 structuralEncryptor.py --file_name example.txt --keys "3 4" --output_dir "./encrypted_output/" --s 2Run the run_file_encryption_structural.sh script with a seq.bench file:
./run_file_encryption_structural.sh ./location/to/seq.benchTo run tests on multiple .bench files in a directory, edit the directory path in the run_m_structual.sh script, then run:
./run_m_structual.sh@INPROCEEDINGS{Cute-Lock,
author={Lopez, Kevin and Rezaei, Amin},
booktitle={2025 Design, Automation & Test in Europe Conference & Exhibition (DATE)},
title={Cute-Lock: Behavioral and Structural Multi-Key Logic Locking Using Time Base Keys},
year={2025},
volume={},
number={},
pages={1-7},
doi={10.23919/DATE64628.2025.10993182}
}
This project is licensed under the MIT License - see the LICENSE file for details.