diff options
Diffstat (limited to 'analysis')
| -rw-r--r-- | analysis/countermeasures/collect_leia.ipynb | 9 | ||||
| -rw-r--r-- | analysis/countermeasures/measure.ipynb | 15 | ||||
| -rw-r--r-- | analysis/countermeasures/results.ipynb | 117 |
3 files changed, 96 insertions, 45 deletions
diff --git a/analysis/countermeasures/collect_leia.ipynb b/analysis/countermeasures/collect_leia.ipynb index 5cdbd51..bad6376 100644 --- a/analysis/countermeasures/collect_leia.ipynb +++ b/analysis/countermeasures/collect_leia.ipynb @@ -74,7 +74,12 @@ "metadata": {}, "source": [ "## Initialize scope and card\n", - "Connect to the card and setup the scope/measurement parameters based on it." + "Connect to the card and setup the scope/measurement parameters based on it.\n", + "\n", + "Note that several smartcards really are the same model and thus we merged them:\n", + " - N4 = N5 = N10\n", + " - N6 = N7\n", + " - N3 = N8" ] }, { @@ -838,7 +843,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.7" } }, "nbformat": 4, diff --git a/analysis/countermeasures/measure.ipynb b/analysis/countermeasures/measure.ipynb index 2e963f1..99b208e 100644 --- a/analysis/countermeasures/measure.ipynb +++ b/analysis/countermeasures/measure.ipynb @@ -71,6 +71,19 @@ ] }, { + "cell_type": "markdown", + "id": "abebcd10-a405-4622-84d0-b96414c78b34", + "metadata": {}, + "source": [ + "Select a card below, it should correspond to the one you have inserted into the reader. If you are testing a new card, add its ATR to the map below.\n", + "\n", + "Note that several smartcards really are the same model and thus we merged them:\n", + " - N4 = N5 = N10\n", + " - N6 = N7\n", + " - N3 = N8" + ] + }, + { "cell_type": "code", "execution_count": null, "id": "f65d7cb5-b54e-48bc-9a67-153b964f5df1", @@ -1599,7 +1612,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.7" } }, "nbformat": 4, diff --git a/analysis/countermeasures/results.ipynb b/analysis/countermeasures/results.ipynb index 7c81feb..81ed21a 100644 --- a/analysis/countermeasures/results.ipynb +++ b/analysis/countermeasures/results.ipynb @@ -1,22 +1,14 @@ { "cells": [ { - "cell_type": "code", - "execution_count": null, - "id": "e3313aa9-5cc6-47ff-8db0-b4419e1afb4d", - "metadata": {}, - "outputs": [], - "source": [ - "from test_eval import Test3n, Testinverse, Testk10, TestEpsilon_GSR, TestEpsilon_Multiplicative" - ] - }, - { "cell_type": "markdown", "id": "15ac247f", "metadata": {}, "source": [ "## Test results\n", "\n", + "This notebook takes in the raw results created by the [measure.ipynb](measure.ipynb) notebook and evaluates them.\n", + "\n", "[Test 3n](#Test-3n)\n", "\n", "[Test composite](#Test-composite-(inverse))\n", @@ -31,6 +23,16 @@ { "cell_type": "code", "execution_count": null, + "id": "e3313aa9-5cc6-47ff-8db0-b4419e1afb4d", + "metadata": {}, + "outputs": [], + "source": [ + "from test_eval import Test3n, Testinverse, Testk10, TestEpsilon_GSR, TestEpsilon_Multiplicative" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "aeb9bd2b", "metadata": {}, "outputs": [], @@ -40,6 +42,19 @@ }, { "cell_type": "markdown", + "id": "6e544e0f-1249-41b8-87bd-69d8c3e90c0f", + "metadata": {}, + "source": [ + "For each test evaluation call below you can choose one of the cards above.\n", + "\n", + "Note that several smartcards really are the same model and thus we merge them:\n", + " - N4 = N5 = N10\n", + " - N6 = N7\n", + " - N3 = N8" + ] + }, + { + "cell_type": "markdown", "id": "7a53b79a", "metadata": {}, "source": [ @@ -125,15 +140,21 @@ ] }, { + "cell_type": "markdown", + "id": "182766b2-aa74-47ea-9d21-3988604c3b6b", + "metadata": {}, + "source": [ + "For some cards, multiple measurements were done (e.g., with a fixed private key).\n", + "There is an optional prefix argument to process only files with the specified prefix." + ] + }, + { "cell_type": "code", "execution_count": null, "id": "405df6fc", "metadata": {}, "outputs": [], "source": [ - "# For some cards, multiple measurements were done (e.g., with fixed private key)\n", - "# There is an optional prefix argument to process only files with the specified prefix.\n", - "\n", "testinverse.print_ecdsa(\"N1\",\"ecdsa_fixed_11\")" ] }, @@ -156,13 +177,11 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "b749a7d0", + "cell_type": "markdown", + "id": "c9d7bb23-b5f3-430f-ad08-cccfb272eede", "metadata": {}, - "outputs": [], "source": [ - "# The test only makes sense for ecdh" + "The test only makes sense for ECDH." ] }, { @@ -197,18 +216,15 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "66833471", + "cell_type": "markdown", + "id": "2b6474c2-0015-45bb-8a08-503d21662662", "metadata": {}, - "outputs": [], "source": [ - "# The test makes sense only for implementations of GSR (or BT bit-length fixing) \n", - "# that permit input parameters, including\n", + "The test makes sense only for implementations of GSR (or BT bit-length fixing) that permit input parameters, including:\n", "\n", - "# ecdh: N6, N8, I1\n", - "# ecdsa: N1, N2, N6, N8, N9, I2\n", - "# keygen: N1, N2, N6, N9, I2" + "- ECDH: N6, N8, I1\n", + "- ECDSA: N1, N2, N6, N8, N9, I2\n", + "- Keygen: N1, N2, N6, N9, I2" ] }, { @@ -246,14 +262,20 @@ ] }, { + "cell_type": "markdown", + "id": "444caf43-4f62-4db6-aa67-d8f79f608ce7", + "metadata": {}, + "source": [ + "N8 and I1 needed different parameters for ECDH." + ] + }, + { "cell_type": "code", "execution_count": null, "id": "adba1ff5-4235-4084-b1dd-ab206903bb24", "metadata": {}, "outputs": [], "source": [ - "# N8 and I1 needed different parameters for ecdh\n", - "\n", "curve_path = \"tests/testdn/weakcurve_32_n_good_gen.csv\"\n", "point_path = \"tests/testdn/weakcurve_32_n_1_point.csv\"\n", "realn_path = \"tests/testdn/realn.csv\"\n", @@ -280,17 +302,14 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "312885ab", + "cell_type": "markdown", + "id": "67afdd25-f8b6-47d0-bdd4-e128e5e5724d", "metadata": {}, - "outputs": [], "source": [ - "# The test makes sense only for implementations of GSR (or BT bit-length fixing) \n", - "# that permit input parameters, including\n", + "The test makes sense only for implementations of GSR (or BT bit-length fixing) that permit input parameters, including:\n", "\n", - "# ecdh: N10\n", - "# ecdsa: N10 - strange behaviour, does not work " + " - ECDH: N10\n", + " - ECDSA: N10 - strange behaviour, does not work " ] }, { @@ -308,24 +327,38 @@ ] }, { + "cell_type": "markdown", + "id": "65bddf04-3572-4a2b-a459-037222d05e87", + "metadata": {}, + "source": [ + "First, we can approximate the bitsizes of the used masks:" + ] + }, + { "cell_type": "code", "execution_count": null, "id": "76362134", "metadata": {}, "outputs": [], "source": [ - "# At first, we can approximate the bitsizes of the used masks\n", "testepsilon.recover_ecdh_plain_size(\"N10\")" ] }, { + "cell_type": "markdown", + "id": "6bdcb776-dbac-4314-b302-270b2f1e4710", + "metadata": {}, + "source": [ + "Second, we list the number of candidates with bitsizes in the specified range:" + ] + }, + { "cell_type": "code", "execution_count": null, "id": "4c9d9898", "metadata": {}, "outputs": [], "source": [ - "# Second, we list the number of candidates with bitsizes in the specified range\n", "testepsilon.compute_candidates(61,65)" ] }, @@ -343,9 +376,9 @@ ], "metadata": { "kernelspec": { - "display_name": "env", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "env" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -357,7 +390,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.13.7" } }, "nbformat": 4, |
