diff options
| author | J08nY | 2025-09-29 14:16:44 +0200 |
|---|---|---|
| committer | J08nY | 2025-09-29 14:16:44 +0200 |
| commit | 8dc80985270c40b48bb9fb280994883c22fb4408 (patch) | |
| tree | 8b3dce32e1a2c9aa6362a7aa6e1a675fee546a5a | |
| parent | 641b499623edc27582af46280820b60573d01018 (diff) | |
| download | ECTester-8dc80985270c40b48bb9fb280994883c22fb4408.tar.gz ECTester-8dc80985270c40b48bb9fb280994883c22fb4408.tar.zst ECTester-8dc80985270c40b48bb9fb280994883c22fb4408.zip | |
| -rw-r--r-- | analysis/masks/overview.png | bin | 0 -> 54836 bytes | |||
| -rw-r--r-- | analysis/masks/overview.svg | 471 | ||||
| -rw-r--r-- | analysis/masks/visualize.ipynb | 87 |
3 files changed, 523 insertions, 35 deletions
diff --git a/analysis/masks/overview.png b/analysis/masks/overview.png Binary files differnew file mode 100644 index 0000000..73882a0 --- /dev/null +++ b/analysis/masks/overview.png diff --git a/analysis/masks/overview.svg b/analysis/masks/overview.svg new file mode 100644 index 0000000..6d1dd81 --- /dev/null +++ b/analysis/masks/overview.svg @@ -0,0 +1,471 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="178.42476mm" + height="123.02873mm" + viewBox="0 0 178.42476 123.02873" + version="1.1" + id="svg1" + inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)" + sodipodi:docname="overview.svg" + inkscape:export-filename="overview.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview1" + pagecolor="#ffffff" + bordercolor="#111111" + borderopacity="1" + inkscape:showpageshadow="0" + inkscape:pageopacity="0" + inkscape:pagecheckerboard="1" + inkscape:deskcolor="#d1d1d1" + inkscape:document-units="mm" + inkscape:zoom="2.0507435" + inkscape:cx="334.75663" + inkscape:cy="289.89485" + inkscape:window-width="2560" + inkscape:window-height="1369" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="layer1" + inkscape:export-bgcolor="#ffffffff" /> + <defs + id="defs1"> + <marker + style="overflow:visible" + id="Triangle" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135" /> + </marker> + <marker + style="overflow:visible" + id="Triangle-9" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135-3" /> + </marker> + <marker + style="overflow:visible" + id="Triangle-4" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135-5" /> + </marker> + <marker + style="overflow:visible" + id="Triangle-9-2" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135-3-6" /> + </marker> + <marker + style="overflow:visible" + id="Triangle-4-6" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135-5-4" /> + </marker> + <marker + style="overflow:visible" + id="Triangle-1" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135-1" /> + </marker> + <marker + style="overflow:visible" + id="Triangle-1-7" + refX="3" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135-1-3" /> + </marker> + </defs> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-16.306364,-37.924354)"> + <rect + style="fill:none;stroke:#000000;stroke-width:0.217188;stroke-linejoin:round;stroke-dashoffset:4.62614" + id="rect1" + width="46.210026" + height="19.711714" + x="75.802979" + y="56.62627" /> + <text + xml:space="preserve" + style="font-size:4.23333px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="80.75724" + y="62.375698" + id="text1"><tspan + sodipodi:role="line" + id="tspan1" + style="font-weight:bold;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="80.75724" + y="62.375698">Reset</tspan></text> + <text + xml:space="preserve" + style="font-size:3.52778px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="80.87365" + y="67.846931" + id="text1-3"><tspan + sodipodi:role="line" + id="tspan1-5" + style="font-weight:normal;font-size:3.52778px;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="80.87365" + y="67.846931">rpk: Param set + Key set</tspan><tspan + sodipodi:role="line" + style="font-weight:normal;font-size:3.52778px;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="80.87365" + y="72.256653" + id="tspan2">rk: Key set </tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:0.217188;stroke-linejoin:round;stroke-dashoffset:4.62614" + id="rect1-2" + width="46.210026" + height="19.711714" + x="130.15825" + y="56.62627" /> + <text + xml:space="preserve" + style="font-size:4.23333px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="134.5229" + y="62.375698" + id="text1-6"><tspan + sodipodi:role="line" + id="tspan1-0" + style="font-weight:bold;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="134.5229" + y="62.375698">Operation</tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:0.217188;stroke-linejoin:round;stroke-dashoffset:4.62614" + id="rect1-2-7" + width="46.210026" + height="19.711714" + x="21.772549" + y="56.62627" /> + <text + xml:space="preserve" + style="font-size:4.23333px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="26.137199" + y="62.375702" + id="text1-6-5"><tspan + sodipodi:role="line" + id="tspan1-0-9" + style="font-weight:bold;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="26.137199" + y="62.375702">Allocate</tspan></text> + <text + xml:space="preserve" + style="font-size:3.52778px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="134.42445" + y="67.846931" + id="text1-3-7"><tspan + sodipodi:role="line" + style="font-weight:normal;font-size:3.52778px;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="134.42445" + y="67.846931" + id="tspan2-6">ECDH/ECDSA Sign/Keygen</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle)" + d="m 67.982572,66.482126 h 7.820413" + id="path4" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle-9)" + d="m 122.013,66.482126 h 8.14524" + id="path4-4" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle-4)" + d="m 176.36826,66.482126 8.66108,1e-6 v 18.084712 l -31.76609,-0.258037 v -7.970818" + id="path4-6" + sodipodi:nodetypes="cc" /> + <rect + style="fill:none;stroke:#676767;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:0.794997, 0.794997;stroke-dashoffset:0;stroke-opacity:1" + id="rect4" + width="53.574562" + height="32.295303" + x="126.15864" + y="48.439503" /> + <text + xml:space="preserve" + style="font-size:3.52777px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#666666;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + x="130.10674" + y="53.183445" + id="text4"><tspan + sodipodi:role="line" + id="tspan4" + style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-dasharray:none" + x="130.10674" + y="53.183445">One "execution"</tspan></text> + <rect + style="fill:none;stroke:#676767;stroke-width:0.265;stroke-linejoin:round;stroke-dasharray:0.794997, 0.794997;stroke-dashoffset:0;stroke-opacity:1" + id="rect4-2" + width="116.36919" + height="45.533382" + x="72.098297" + y="43.582935" /> + <text + xml:space="preserve" + style="font-size:3.52777px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#666666;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + x="76.153015" + y="49.541725" + id="text4-5"><tspan + sodipodi:role="line" + id="tspan4-4" + style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-dasharray:none" + x="76.153015" + y="49.541725">One "run"</tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:0.217188;stroke-linejoin:round;stroke-dashoffset:4.62614" + id="rect1-0" + width="46.210026" + height="19.711714" + x="75.802979" + y="120.42693" /> + <text + xml:space="preserve" + style="font-size:4.23333px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="80.75724" + y="126.17636" + id="text1-4"><tspan + sodipodi:role="line" + id="tspan1-8" + style="font-weight:bold;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="80.75724" + y="126.17636">Reset</tspan></text> + <text + xml:space="preserve" + style="font-size:3.52778px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="80.87365" + y="131.64758" + id="text1-3-71"><tspan + sodipodi:role="line" + id="tspan1-5-7" + style="font-weight:normal;font-size:3.52778px;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="80.87365" + y="131.64758">rpk: Param set + Key set</tspan><tspan + sodipodi:role="line" + style="font-weight:normal;font-size:3.52778px;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="80.87365" + y="136.05731" + id="tspan2-2">rk: Key set </tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:0.217188;stroke-linejoin:round;stroke-dashoffset:4.62614" + id="rect1-2-72" + width="46.210026" + height="19.711714" + x="130.15825" + y="120.42693" /> + <text + xml:space="preserve" + style="font-size:4.23333px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="134.52289" + y="126.17636" + id="text1-6-2"><tspan + sodipodi:role="line" + id="tspan1-0-6" + style="font-weight:bold;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="134.52289" + y="126.17636">Operation</tspan></text> + <text + xml:space="preserve" + style="font-size:3.52778px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:center;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:middle;fill:#000000;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="134.42444" + y="131.64758" + id="text1-3-7-1"><tspan + sodipodi:role="line" + style="font-weight:normal;font-size:3.52778px;text-align:start;text-anchor:start;fill:#000000;stroke:none;stroke-width:0.265" + x="134.42444" + y="131.64758" + id="tspan2-6-0">ECDH/ECDSA Sign/Keygen</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle-9-2)" + d="m 122.013,130.28278 h 8.14524" + id="path4-4-6" + sodipodi:nodetypes="cc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle-4-6)" + d="m 176.36826,130.28278 h 8.66108 v 18.08472 l -31.76609,-0.25804 v -7.97082" + id="path4-6-1" + sodipodi:nodetypes="cc" /> + <rect + style="fill:none;stroke:#656565;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:0.794997, 0.794997;stroke-dashoffset:0;stroke-opacity:1" + id="rect4-5" + width="53.574562" + height="32.295303" + x="126.15864" + y="112.24017" /> + <text + xml:space="preserve" + style="font-size:3.52777px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#666666;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + x="130.10675" + y="116.98411" + id="text4-9"><tspan + sodipodi:role="line" + id="tspan4-49" + style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-dasharray:none" + x="130.10675" + y="116.98411">One "execution"</tspan></text> + <rect + style="fill:none;stroke:#676767;stroke-width:0.265;stroke-linejoin:round;stroke-dasharray:0.794997, 0.794997;stroke-dashoffset:0;stroke-opacity:1" + id="rect4-2-0" + width="116.36919" + height="45.533382" + x="72.098289" + y="107.38359" /> + <text + xml:space="preserve" + style="font-size:3.52777px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#666666;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + x="76.153015" + y="113.34238" + id="text4-5-9"><tspan + sodipodi:role="line" + id="tspan4-4-1" + style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-dasharray:none" + x="76.153015" + y="113.34238">One "run"</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle-1)" + d="m 44.877559,76.337982 1e-6,8.366515 -0.04372,45.539333 30.969141,0.0389" + id="path4-7" + sodipodi:nodetypes="cccc" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614;stroke-opacity:1;marker-end:url(#Triangle-1-7)" + d="m 56.871532,76.337982 10e-7,8.366515 -0.04372,13.882639 16.737312,0.03895" + id="path4-7-6" + sodipodi:nodetypes="cccc" /> + <text + xml:space="preserve" + style="font-size:9.87778px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.264999;stroke-linejoin:round;stroke-dashoffset:4.62614" + x="78.666039" + y="99.283508" + id="text1-6-5-1"><tspan + sodipodi:role="line" + id="tspan1-0-9-2" + style="font-weight:bold;font-size:9.87778px;text-align:start;text-anchor:start;fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265" + x="78.666039" + y="99.283508">...</tspan></text> + <rect + style="fill:none;stroke:#656565;stroke-width:0.265;stroke-linejoin:round;stroke-dasharray:0.794998, 0.794998;stroke-dashoffset:0;stroke-opacity:1" + id="rect4-2-8" + width="178.15976" + height="122.76373" + x="16.438864" + y="38.056854" /> + <text + xml:space="preserve" + style="font-size:3.52777px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#666666;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + x="21.589336" + y="43.408104" + id="text4-5-6"><tspan + sodipodi:role="line" + id="tspan4-4-3" + style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-dasharray:none" + x="21.589336" + y="43.408104">One "collection"</tspan></text> + <text + xml:space="preserve" + style="font-size:3.52777px;font-family:'PT Sans';-inkscape-font-specification:'PT Sans';text-align:start;letter-spacing:0px;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#666666;stroke-width:0.264999;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + x="19.83744" + y="158.64517" + id="text4-5-6-1"><tspan + sodipodi:role="line" + id="tspan4-4-3-5" + style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-dasharray:none" + x="19.83744" + y="158.64517">A collection like "1000x100" contains 1000 runs each with 100 executions.</tspan></text> + </g> +</svg> diff --git a/analysis/masks/visualize.ipynb b/analysis/masks/visualize.ipynb index 39fa3df..08a7ee3 100644 --- a/analysis/masks/visualize.ipynb +++ b/analysis/masks/visualize.ipynb @@ -5,7 +5,12 @@ "id": "5d6ed43a-3baf-4da1-a40e-c11a646df6d6", "metadata": {}, "source": [ - "### Masks" + "# Masks\n", + "In the following notebook we analyze random masks extracted from several smartcards performing elliptic curve crypto. We extracted the masks using the \"Test n + \\epsilon\" from the [ECTester paper](https://pyecsca.org/_static/ectester_ches25.pdf).\n", + "\n", + "See the overview of the data collection below.\n", + "\n", + "" ] }, { @@ -50,34 +55,44 @@ "metadata": {}, "outputs": [], "source": [ - "def load_run(run_path):\n", - " run = []\n", - " files = [file for file in os.listdir(run_path) if file.endswith(\".txt\")]\n", - " files = sorted(files,key = lambda x: int(x[:-4].split(\"_\")[-1]))\n", + "def load_collection(collection_path):\n", + " collection = []\n", + " run_files = [file for file in os.listdir(run_path) if file.endswith(\".txt\")]\n", + " run_files = sorted(run_files, key = lambda x: int(x[:-4].split(\"_\")[-1]))\n", " sizes = set()\n", - " for file in files:\n", - " masks = get_masks(os.path.join(run_path,file))\n", - " \n", - " run.append(masks)\n", - " \n", - " return run\n", - " \n", + " for file in run_files:\n", + " masks = get_masks(os.path.join(collection_path,file))\n", + " collection.append(masks)\n", + " return collection\n", "\n", - "def load_runs(card,protocol):\n", + "def load_collections(card, protocol):\n", " path = f\"results/{card}/testdn/\"\n", - " runs = []\n", + " collections = []\n", " counter = 0\n", - " for run_dir in os.listdir(path):\n", - " if not run_dir.startswith(protocol):\n", + " for collection_dir in os.listdir(path):\n", + " if not collection_dir.startswith(protocol):\n", " continue\n", - " run_path = os.path.join(path,run_dir)\n", - " run = load_run(run_path)\n", - " runs.append(run)\n", - " sizes = set([len(masks) for masks in run])\n", + " collection_path = os.path.join(path, collection_dir)\n", + " collection = load_collection(collection_path)\n", + " collections.append(collection)\n", + " sizes = set([len(masks) for masks in collection])\n", " assert len(sizes)==1\n", - " print(f\"({counter}) Loading {len(run)}x{sizes.pop()} masks from {run_path}\")\n", + " print(f\"({counter}) Loading collection with {len(collection)}x{sizes.pop()} masks from {collection_path}\")\n", " counter+=1\n", - " return runs" + " return collections" + ] + }, + { + "cell_type": "markdown", + "id": "32ff43b3-fe9f-4301-9653-87cf401a9153", + "metadata": {}, + "source": [ + "## Loading measured masks\n", + "See the structure of the results directory for an overview of what collections are available.\n", + "\n", + "The \"rk\" or \"rpk\" in the protocol name signifies what is done during a reset:\n", + " - \"rk\" -> Resets only the key parameters (S,W)\n", + " - \"rpk\" -> Resets the key parameters and the curve parameters (FP,A,B,G,R,K)" ] }, { @@ -96,12 +111,10 @@ } ], "source": [ - "## Loading measured masks\n", - "\n", - "# runs = load_runs(\"N1\",\"ecdsa_rpk\")\n", - "# runs = load_runs(\"N8\",\"ecdsa_rpk\")\n", - "# runs = load_runs(\"N2\",\"ecdsa_rpk\")\n", - "runs = load_runs(\"N9\",\"ecdsa_rk\")" + "# collections = load_collections(\"N1\",\"ecdsa_rpk\")\n", + "# collections = load_collections(\"N8\",\"ecdsa_rpk\")\n", + "# collections = load_collections(\"N2\",\"ecdsa_rpk\")\n", + "collections = load_collections(\"N9\",\"ecdsa_rk\")" ] }, { @@ -109,7 +122,9 @@ "id": "d7011abd-5461-4e3e-a615-8fa1f12391e6", "metadata": {}, "source": [ - "### MSB bias" + "## MSB bias\n", + "We see behavior in which each run has some bias in the MSB. The reset at the start of the run \"chooses\" some distribution from a family of distributions and then all masks from that run have the bias.\n", + "Below, we visualize 20 runs from the first collection. Each run has 100 executions only, as we were focusing on the overall behavior and not on the details of the distribution." ] }, { @@ -130,7 +145,7 @@ } ], "source": [ - "masks_multiple = runs[0][:20]\n", + "masks_multiple = collections[0][:20]\n", "\n", "num = len(masks_multiple)\n", "ncols = 4\n", @@ -153,7 +168,8 @@ "id": "cbb76c0d-c428-4655-8681-fa699643ff1e", "metadata": {}, "source": [ - "### Residue bias" + "## Residue bias\n", + "Furthermore, when we look at the same 20 runs we see that there is also bias in the residue classes modulo small primes. These plots show on the x-axis the prime and on the y-axis the number of residue classes that the masks \"hit\" for that run. The expected number of hits is marked in red." ] }, { @@ -215,7 +231,8 @@ "id": "154e0b4d-6552-4b54-8ae4-131658b22c96", "metadata": {}, "source": [ - "### Simulated bias for a\\*r1+b\\*r2+c" + "### Simulated bias for a\\*r1+b\\*r2+c\n", + "We had a hypothesis that the masks are of the form $ a*r_1+b*r_2+c $ where each run has a fixed $a, b, c$ but randomĀ $r_1$ and $r_2$ for each execution. The simulated results are shown below." ] }, { @@ -283,9 +300,9 @@ ], "metadata": { "kernelspec": { - "display_name": "env", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "env" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -297,7 +314,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.13.7" } }, "nbformat": 4, |
