-
Notifications
You must be signed in to change notification settings - Fork 89
HAWKEYE
HAWKEYE is a tool to automatically locate implementations of symmetric cryptographic primitives within gate-level netlists. It was developed as part of a publication titled "HAWKEYE - Recovering Symmetric Cryptography From Hardware Circuits" that will be presented at CRYPTO'24. Currently, HAWKEYE is designed to find round-based and pipelined implementations of SPN, ARX and Feistel ciphers. It is not particularly well suited for shift-register-based ciphers and implementations protected against side-channel attacks, although it might get lucky at times.
TODO: run some preprocessing scripts
To identify candidates for state registers of pipelined or round-based implementations of symmetric ciphers, HAWKEYE converts the input netlist into a flip-flop graph, that is, a graph containing a vertex for every flip-flop in the netlist and an edge between two vertices only if the respective flip-flops are connected through combinational logic.
TODO: method 1 from paper
from hal_plugins import hawkeye
c_nets = hawkeye.DetectionConfiguration()
c_nets.control = hawkeye.DetectionConfiguration.Control.CHECK_NETS
c_nets.components = hawkeye.DetectionConfiguration.Components.NONE
c_nets.timeout = 10
c_nets.min_register_size = 10
candidates = hawkeye.detect_candidates(netlist, [c_nets], min_state_size=40)Sometimes it helps to relax the control configuration to Control.CHECK_PINS instead of Control.CHECK_NETS, which will just check whether the same pins of flip-flops are used, but they no longer have to be connected to the same control nets. This can also be done in combination with Control.CHECK_NETS:
from hal_plugins import hawkeye
c_nets = hawkeye.DetectionConfiguration()
c_nets.control = hawkeye.DetectionConfiguration.Control.CHECK_NETS
...
c_pins = hawkeye.DetectionConfiguration()
c_pins.control = hawkeye.DetectionConfiguration.Control.CHECK_PINS
...
candidates = hawkeye.detect_candidates(netlist, [c_nets, c_pins], min_state_size=40)TODO: SCC detection with type check and equivalent types on LSI10k gate lib (Method 2 from paper)
from hal_plugins import hawkeye
config = hawkeye.DetectionConfiguration()
config.control = hawkeye.DetectionConfiguration.Control.CHECK_TYPE
config.components = hawkeye.DetectionConfiguration.Components.CHECK_SCC
config.equivalent_types = [["FD1", "FD1P"]]
config.timeout = 10
config.min_register_size = 10
candidates = hawkeye.detect_candidates(netlist, [config], min_state_size=40)TODO: how to operate on candidates (get size, input/output registers)
TODO: round candidate holds partial copy of netlist, so not the same gates in registers and state logic as in original one
round_candidates = list()
for c in candidates:
rc = hawkeye.RoundCandidate.from_register_candidate(c)
round_candidates.append(rc)sbox_db = hawkeye.SBoxDatabase.from_file(PATH_TO_SBOX_DB)
for rc in round_candidates:
sbox_candidates = hawkeye.locate_sboxes(rc)
sbox_name = ""
for sc in sbox_candidates:
sbox_name = hawkeye.identify_sbox(sc, sbox_db)
if sbox_name != "":
break
print(sbox_name)