iamyogesh2001/logic-locking-soft-error-ml
GitHub: iamyogesh2001/logic-locking-soft-error-ml
首个系统研究逻辑锁定可靠性副作用的工作,通过蒙特卡洛故障注入和LightGBM模型引导密钥门布局,在保持安全强度的同时显著降低VLSI电路的软错误SDC率。
Stars: 0 | Forks: 0
# 逻辑锁定与软错误漏洞
## 面向 VLSI 电路的可靠性感知密钥门布局 ML 引导框架
## 概述
逻辑锁定是一种广泛使用的硬件 IP 保护技术,它将受密钥控制的门插入到电路网表中。虽然现有的研究仅关注锁定方案的**安全性**属性,但这项工作提出了一个不同的问题:
我们提出了关于逻辑锁定可靠性副作用的**首个系统性研究**。通过在三种锁定方案和三种密钥规模下对所有十个 ISCAS-85 基准电路进行 Monte Carlo 故障注入,我们证明了在具有同等安全强度的布局中,**SDC 率差异最高可达 23.2 个百分点**。随后,我们提出了一个 **ML 引导布局框架**,相对于随机布局基线,该框架可将 SDC 率降低高达 **26.5%**,同时保持等效的 SAT 攻击抵抗力。
## 核心发现
| 发现 | 结果 |
|---|---|
| 相同安全性布局之间的最大 SDC 差距 | **23.2 pp** (c499, XNOR 锁定) |
| 所有电路和方案的平均 SDC 差距 | **6.8 pp** |
| ML 引导布局的最大 SDC 降低幅度 | **26.5%** (c499) |
| 相对于随机布局的平均 SDC 降低幅度 | **11.1%** |
| 门级数据集规模 | **9,677 个样本** |
| 故障注入实验总次数 | **18,000,000** |
## 仓库结构
```
logic-locking-soft-error-ml/
│
├── simulation/
│ └── locked_but_leaky_full.py # Full experiment script
│ ├── Phase 1: Baseline SDC characterization
│ ├── Phase 2: Logic locking (XOR, XNOR, Mixed) x K x placements
│ ├── Phase 3: Gate feature extraction + per-gate SDC contribution
│ └── Phase 4: LightGBM training + ML-guided placement evaluation
│
├── ml/
│ └── retrain_ml.py # ML retraining script
│ ├── Feature engineering (24 features)
│ ├── Multi-model comparison (LightGBM, XGBoost, Random Forest)
│ └── LOCO-CV evaluation
│
├── figures/
│ ├── fig1_sdc_baseline_locked.png # Baseline SDC + locked boxplots
│ ├── fig2_sdc_gap.png # Reliability gap across placements
│ ├── fig3_four_way_comparison.png # ML vs random vs security-greedy
│ ├── fig4_feature_importance.png # LightGBM feature importance
│ └── arch_diagram_simple.png # System overview diagram
│
├── results/
│ ├── baselines.csv # Unlocked SDC rates per circuit
│ ├── locked_results.csv # 1,800 locked variant results
│ ├── gate_features.csv # 9,677 gate-level feature dataset
│ ├── feature_importance.csv # ML feature importance ranking
│ └── ml_placement_comparison.csv # ML vs baseline placement results
│
├── diagrams/
│ ├── arch_diagram_simple.drawio # Editable system overview
│ └── circuit_level_diagram.drawio # XOR locking + SEU propagation
│
├── paper/
│ └── locked_but_leaky_paper.tex # Full IEEE-format LaTeX manuscript
│
└── README.md
```
## 实验设置
### 基准测试
所有十个 **ISCAS-85** 组合基准电路:
`c432, c499, c880, c1355, c1908, c2670, c3540, c5315, c6288, c7552`
门数量范围从 **171** (c432) 到 **2,381** (c6288)。
直接从 `circuitgraph` Python 库加载——无需外部下载。
### 锁定方案
| 方案 | 描述 |
|---|---|
| **XOR** | 在选定节点插入 XOR 门,密钥=0 时传递信号 |
| **XNOR** | 在选定节点插入 XNOR 门,密钥=1 时传递信号 |
| **Mixed XOR/XNOR** | 根据信号概率分配门类型 (SP>0.5 → XNOR) |
### 故障模型
每个 **JEDEC JESD89A** 的单事件翻转 (SEU):在随机选择的内部门输出处发生一次位翻转,持续一个评估周期。
### 规模
- 3 种方案 × 3 种密钥大小 × 20 种布局 × 10 个电路 = **1,800 个锁定变体**
- 每个变体 10,000 次 Monte Carlo 试验 = **1800 万次故障注入实验**
- 每门 SDC 标注:2,000 次试验 × 9,677 个门 = **约 1900 万次额外试验**
## ML 框架
### 特征 (15 个结构特征 + 9 个工程特征 = 总计 24 个)
**结构特征:**
`fan_in, fan_out, level, level_norm, cone_size, output_reach,
signal_prob, sp_skew, is_xor, is_xnor, is_and, is_nand, is_or,
is_nor, is_not`
**工程交互特征:**
`cone_x_reach, sp_x_fanout, level_x_reach, cone_x_sp,
reach_x_spskew, fanout_x_level, cone_sq, reach_sq, sp_centered`
### 模型
**LightGBM** 梯度提升回归器。
目标:当用作锁定点时,每个门的 SDC 增量贡献。
验证:**留一电路法交叉验证** (LOCO-CV)。
### 主要预测特征
1. Signal Probability (信号概率)
2. Output Reach (输出可达性)
3. Normalized Topological Level (归一化拓扑层级)
4. Fanin Cone Size (扇入锥大小)
## 复现结果
### 依赖环境
```
python3 -m venv env
source env/bin/activate
pip install circuitgraph networkx matplotlib numpy \
scikit-learn lightgbm joblib tqdm pandas xgboost
```
### 运行完整实验
```
python3 simulation/locked_but_leaky_full.py
```
预期运行时间:在现代多核 CPU 上约 **25–40 分钟**。
所有结果将保存至 `./results/`,图表保存至 `./figures/`。
### 仅重新训练 ML (在完整实验之后)
```
python3 ml/retrain_ml.py
```
读取已有的 `results/gate_features.csv` —— 无需重新仿真。
运行时间:**5 分钟以内**。
### 以 600 DPI 重新生成图表
```
python3 simulation/regenerate_figures.py
```
## 结果摘要
### 基线 SDC 率 (未锁定电路)
| 电路 | 门数量 | SDC 率 |
|---|---|---|
| c432 | 171 | 27.9% |
| c499 | 174 | 54.6% |
| c880 | 323 | 51.5% |
| c1355 | 518 | 44.6% |
| c1908 | 479 | 53.4% |
| c2670 | 699 | 41.0% |
| c3540 | 1043 | 35.9% |
| c5315 | 1586 | 38.6% |
| c6288 | 2353 | 89.7% |
| c7552 | 2331 | 39.7% |
### ML 引导布局与基线对比 (K=16, XOR 锁定)
| 电路 | Random | Sec.-Greedy | ML-Guided | 降低幅度 |
|---|---|---|---|---|
| c432 | 24.4% | 25.9% | **19.4%** | 20.6% |
| c499 | 62.7% | 54.4% | **46.0%** | 26.5% |
| c880 | 44.9% | 45.5% | **36.5%** | 18.7% |
| c1355 | 46.0% | 44.5% | **41.8%** | 9.2% |
| c1908 | 49.8% | 50.5% | **43.1%** | 13.4% |
| c2670 | 38.0% | 42.5% | **37.2%** | 2.3% |
| c3540 | 34.5% | 34.4% | **32.4%** | 6.0% |
| c5315 | 37.9% | 38.0% | **37.9%** | 0.0% |
| c6288 | 87.7% | 89.3% | **81.0%** | 7.7% |
| c7552 | 38.1% | 37.9% | **35.6%** | 6.4% |
| **平均** | -- | -- | -- | **11.1%** |
## 引用
如果您在研究中使用了本代码或数据集,请引用:
```
@inproceedings{rethinapandian2026logiclock,
title = {Logic Locking and Soft-Error Vulnerability: An ML-Guided
Framework for Reliability-Aware Key-Gate Placement in
VLSI Circuits},
author = {Rethinapandian, Yogesh and Sundararajan, Arun Karthik
and Kumar, Kaushik and Prakash, Smrithi},
year = {2026}
}
```
## 许可证
本仓库仅供学术研究目的发布。
所有仿真代码均为作者的原创作品。
ISCAS-85 基准电路属于公共领域。
## 联系方式
**Yogesh Rethinapandian** (通讯作者)
电气与计算机工程系
伊利诺伊大学芝加哥分校
yrethi2@uic.edu · ORCID: 0009-0000-6111-857X
标签:Apex, CISA项目, EDA, ISCAS-85基准测试, LightGBM, SAT攻击, SDC预测, VLSI, 关键门放置, 可靠性分析, 抗侧信道攻击, 故障注入, 机器学习, 电子设计自动化, 硬件安全, 硬件木马防护, 芯片安全, 蒙特卡洛仿真, 软错误, 逆向工具, 逻辑锁定, 门级网表, 集成电路IP保护