aboutsummaryrefslogtreecommitdiff
path: root/analysis/countermeasures/results.ipynb
diff options
context:
space:
mode:
authorJ08nY2025-09-16 18:29:09 +0800
committerJ08nY2025-09-16 18:29:09 +0800
commite6394385850999564e19ca091e417788a4b7a1aa (patch)
tree9c15345f389edab12542febc3a402274f8c02e13 /analysis/countermeasures/results.ipynb
parentd20e5addc741846b4eff403952b3c41d3318759c (diff)
downloadECTester-master.tar.gz
ECTester-master.tar.zst
ECTester-master.zip
Diffstat (limited to 'analysis/countermeasures/results.ipynb')
-rw-r--r--analysis/countermeasures/results.ipynb117
1 files changed, 75 insertions, 42 deletions
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,