-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds Beli PUF simulation, attack, and docs
- Loading branch information
1 parent
337db80
commit 73a4de9
Showing
10 changed files
with
558 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,46 @@ | ||
Logistic Regression Attack | ||
========================== | ||
Beli PUF Attacks | ||
================ | ||
|
||
The Logistic Regression Attack (LR Attack) was introduced by Rührmair et al. [RSSD10]_ to model XOR Arbiter PUFs. | ||
In pypuf, an modernized and optimized version of the LR attack is implemented using tensorflow. The | ||
`original implementation <http://www.pcp.in.tum.de/code/lr.zip>`_ is also available from the authors. A study of the | ||
data complexity of the LR attack using a different unpublished implementation of the LR attack was done by Tobisch and | ||
Becker [TB15]_. | ||
[AMTW21]_ | ||
|
||
Example Usage | ||
------------- | ||
|
||
To run the attack, CRP data of the PUF token under attack is required. Such data can be obtained through experiments | ||
on real hardware, or using a simulation. In this example, we use the pypuf XOR Arbiter PUF simulator: | ||
Logistic-Regression-Based | ||
------------------------- | ||
|
||
>>> import pypuf.simulation, pypuf.io | ||
>>> puf = pypuf.simulation.XORArbiterPUF(n=64, k=4, seed=1) | ||
>>> crps = pypuf.io.ChallengeResponseSet.from_simulation(puf, N=50000, seed=2) | ||
>>> puf = pypuf.simulation.TwoBitBeliPUF(n=64, k=1, seed=1) | ||
>>> crps = pypuf.io.ChallengeResponseSet.from_simulation(puf, N=10000, seed=2) | ||
|
||
|
||
To run the attack, we configure the attack object with the challenge response data and attack parameters. The parameters | ||
need careful adjustment for each choice of security parameters in the PUF. Then the attack is run using the | ||
:meth:`pypuf.attack.LRAttack2021.fit` method. | ||
|
||
>>> import pypuf.attack | ||
>>> attack = pypuf.attack.LRAttack2021(crps, seed=3, k=4, bs=1000, lr=.001, epochs=100) | ||
>>> attack = pypuf.attack.TwoBitBeliLR(crps, seed=3, k=1, bs=256, lr=1, epochs=15) | ||
>>> attack.fit() # doctest:+ELLIPSIS +NORMALIZE_WHITESPACE | ||
Epoch 1/100 | ||
... | ||
50/50 [==============================] - ... - loss: 0.4... - accuracy: 0.9... - val_loss: 0.4643 - val_accuracy: 0.9620 | ||
<pypuf.simulation.base.LTFArray object at 0x...> | ||
Epoch 1/15 | ||
... | ||
36/36 [==============================] ... loss: 0.2... - accuracy: 0.9... | ||
<pypuf.simulation.delay.TwoBitBeliPUF object at 0x...> | ||
>>> model = attack.model | ||
|
||
The model accuracy can be measured using the pypuf accuracy metric :meth:`pypuf.metrics.accuracy`. | ||
|
||
>>> import pypuf.metrics | ||
>>> pypuf.metrics.similarity(puf, model, seed=4) | ||
array([0.966]) | ||
|
||
Applicability | ||
------------- | ||
array([0.953, 0.944]) | ||
|
||
The Logistic Regression can be extended to other variants of the XOR Arbiter PUF [WBMS19]_. This functionality is | ||
currently not yet included in pypuf, so that the user needs to perform the appropriate conversions before using | ||
:class:`pypuf.attack.LRAttack2021`. | ||
|
||
This implementation is also suitable to conduct the splitting attack on the Interpose PUF [WMPN19]_. | ||
|
||
API | ||
--- | ||
|
||
.. autoclass:: pypuf.attack.LRAttack2021 | ||
:members: __init__, fit, model, history | ||
.. autoclass:: pypuf.attack.TwoBitBeliLR | ||
:members: __init__, fit, beli_output, model, history | ||
|
||
.. autoclass:: pypuf.attack.OneBitBeliLR | ||
:members: __init__, fit, beli_output, model, history | ||
|
||
Performance | ||
----------- | ||
|
||
The pypuf implementation is tested using tensorflow 2.4 on Intel Xeon E5-2630 v4 attacking :math:`n`-bit :math:`k`-XOR | ||
Arbiter PUFs. The results below are compared with those of Tobisch and Becker [TB15]_, which have been obtained in 2015 | ||
using up to 16 cores. | ||
|
||
=== ==== ===== ============ =========== ======= ================== | ||
n k CRPs success rate duration cores [TB15]_ / 16 cores | ||
=== ==== ===== ============ =========== ======= ================== | ||
64 4 30k 10/10 <1 min 4 <1 min | ||
64 5 260k 10/10 4 min 4 <1 min | ||
64 6 2M 20/20 <1 min 4 1 min | ||
64 7 20M 10/10 3 min 4 55 min | ||
64 8 150M 10/10 28 min 4 391 min | ||
64 9 350M 2266 min | ||
64 9 500M 7/10 14 min 40 | ||
64 10 1B 6/10 41 min 40 | ||
=== ==== ===== ============ =========== ======= ================== | ||
=== ==== ===== ============ =========== ======= | ||
n k CRPs success rate duration cores | ||
=== ==== ===== ============ =========== ======= | ||
=== ==== ===== ============ =========== ======= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Beli PUF and XOR Beli PUF | ||
========================= | ||
|
||
Intro to Beli PUF, Motvation, Design, blah [AMTW21]_. | ||
|
||
To simulate a basic Beli PUF with two output bits, use | ||
|
||
>>> import pypuf.simulation, pypuf.io | ||
>>> puf = pypuf.simulation.TwoBitBeliPUF(n=32, k=1, seed=1) | ||
>>> crps = pypuf.io.random_inputs(n=32, N=3, seed=2) | ||
>>> puf.eval(crps) | ||
array([[-1, -1], | ||
[ 1, 1], | ||
[-1, -1]]) | ||
|
||
Beli PUF can also output the index of the delay line with the fastest signal for a given challenge, | ||
|
||
>>> puf = pypuf.simulation.BeliPUF(n=32, k=1, seed=1) | ||
>>> puf.eval(crps) | ||
array([[3], | ||
[0], | ||
[3]]) | ||
|
||
Observe that the two Beli PUF instances above use the same internal delays and differ only in the output format | ||
specification. | ||
|
||
:class:`OneBitBeliPUF` is a Beli PUF version which returns the XOR value of the :class:`TwoBitBeliPUF` version shown | ||
above, | ||
|
||
>>> puf = pypuf.simulation.OneBitBeliPUF(n=32, k=1, seed=1) | ||
>>> puf.eval(crps) | ||
array([1, 1, 1]) | ||
|
||
All Beli PUFs shown above can be arranged into an XOR Beli PUF by using the `k` parameter when instantiating: | ||
|
||
>>> puf = pypuf.simulation.OneBitBeliPUF(n=32, k=4, seed=1) | ||
>>> puf.eval(crps) | ||
array([-1, 1, -1]) | ||
|
||
.. note:: | ||
pypuf currently does not implement noisy Beli PUF simulation. | ||
However, it ships CRP data of a Beli PUF implemented in FPGA. | ||
TODO add link. | ||
|
||
|
||
API | ||
--- | ||
|
||
.. autoclass:: pypuf.simulation.BeliPUF | ||
:members: __init__, challenge_length, response_length, eval, val, signal_path, features | ||
|
||
.. autoclass:: pypuf.simulation.TwoBitBeliPUF | ||
|
||
.. autoclass:: pypuf.simulation.OneBitBeliPUF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.