From d3a875615e0bf5243e5e484a0e16dfe1e24859b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caroline=20Sandsbr=C3=A5ten?= Date: Thu, 2 Oct 2025 15:11:08 +0200 Subject: [PATCH] fix unclear function and use Setup.ipynb to setup cw in all labs --- jupyter/lab/1_SCA_Lab/SCA_lab.ipynb | 26 ++++++++++++++----- .../1_Constructing_the_Glitch_Loop.ipynb | 2 +- .../2_Glitching_Past_a_Password_Check.ipynb | 2 +- .../3_Glitching_a_Memory_Dump.ipynb | 2 +- .../4_Glitching_a_Bootloader.ipynb | 4 +-- jupyter/lab/{1_SCA_Lab => }/Setup.ipynb | 0 6 files changed, 24 insertions(+), 12 deletions(-) rename jupyter/lab/{1_SCA_Lab => }/Setup.ipynb (100%) diff --git a/jupyter/lab/1_SCA_Lab/SCA_lab.ipynb b/jupyter/lab/1_SCA_Lab/SCA_lab.ipynb index 9d989d17..62588a2d 100644 --- a/jupyter/lab/1_SCA_Lab/SCA_lab.ipynb +++ b/jupyter/lab/1_SCA_Lab/SCA_lab.ipynb @@ -34,10 +34,21 @@ "metadata": {}, "outputs": [], "source": [ - "SCOPETYPE = 'OPENADC'\n", - "PLATFORM = 'CW308_SAM4S'\n", "CRYPTO_TARGET = 'TINYAES128C'\n", - "SS_VER = 'SS_VER_1_1'" + "SS_VER = 'SS_VER_1_1'\n", + "\n", + "# SCOPETYPE for CW Husky and CW Light\n", + "SCOPETYPE = 'OPENADC'\n", + "\n", + "# For STM32F Target board in individual package\n", + "PLATFORM = 'CW308_STM32F4'\n", + "\n", + "# For STM32F Target board in CW Light package\n", + "# PLATFORM = 'CW308_STM32F3'\n", + "\n", + "# CW Nano:\n", + "# SCOPETYPE = 'CWNANO'\n", + "# PLATFORM = 'CWNANO'\n" ] }, { @@ -46,7 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "%run \"./Setup.ipynb\"" + "%run \"../Setup.ipynb\"" ] }, { @@ -56,7 +67,7 @@ "outputs": [], "source": [ "%%bash -s \"$PLATFORM\" \"$CRYPTO_TARGET\" \"$SS_VER\"\n", - "cd ../../firmware/mcu/simpleserial-aes\n", + "cd ../../../firmware/mcu/simpleserial-aes\n", "make PLATFORM=$1 CRYPTO_TARGET=$2 EXTRA_OPTS=ADD_JITTER SS_VER=$3" ] }, @@ -66,7 +77,7 @@ "metadata": {}, "outputs": [], "source": [ - "cw.program_target(scope, prog, \"../../firmware/mcu/simpleserial-aes/simpleserial-aes-{}.hex\".format(PLATFORM))" + "cw.program_target(scope, prog, \"../../../firmware/mcu/simpleserial-aes/simpleserial-aes-{}.hex\".format(PLATFORM))" ] }, { @@ -198,7 +209,8 @@ "def calculate_trace_offset(ref_trace, orig_offset, target_trace, threshold):\n", " ref_len = len(ref_trace)\n", " for i in range(0, len(target_trace) - ref_len):\n", - " if SAD_SUM < threshold:\n", + " sad_sum = #sum together the difference between the reference trace and target trace at a the offset given by i and ref_len.\n", + " if sad_sum < threshold:\n", " return i - orig_offset" ] }, diff --git a/jupyter/lab/2_Fault_Lab/1_Constructing_the_Glitch_Loop.ipynb b/jupyter/lab/2_Fault_Lab/1_Constructing_the_Glitch_Loop.ipynb index e4811b46..79870f46 100644 --- a/jupyter/lab/2_Fault_Lab/1_Constructing_the_Glitch_Loop.ipynb +++ b/jupyter/lab/2_Fault_Lab/1_Constructing_the_Glitch_Loop.ipynb @@ -163,7 +163,7 @@ "metadata": {}, "outputs": [], "source": [ - "%run \"../../Setup_Scripts/Setup_Generic.ipynb\"" + "%run \"../Setup.ipynb\"" ] }, { diff --git a/jupyter/lab/2_Fault_Lab/2_Glitching_Past_a_Password_Check.ipynb b/jupyter/lab/2_Fault_Lab/2_Glitching_Past_a_Password_Check.ipynb index 7e78218d..11860411 100644 --- a/jupyter/lab/2_Fault_Lab/2_Glitching_Past_a_Password_Check.ipynb +++ b/jupyter/lab/2_Fault_Lab/2_Glitching_Past_a_Password_Check.ipynb @@ -104,7 +104,7 @@ "metadata": {}, "outputs": [], "source": [ - "%run \"../../Setup_Scripts/Setup_Generic.ipynb\"" + "%run \"../Setup.ipynb\"" ] }, { diff --git a/jupyter/lab/2_Fault_Lab/3_Glitching_a_Memory_Dump.ipynb b/jupyter/lab/2_Fault_Lab/3_Glitching_a_Memory_Dump.ipynb index 65ae7fe3..2c74de49 100644 --- a/jupyter/lab/2_Fault_Lab/3_Glitching_a_Memory_Dump.ipynb +++ b/jupyter/lab/2_Fault_Lab/3_Glitching_a_Memory_Dump.ipynb @@ -86,7 +86,7 @@ "metadata": {}, "outputs": [], "source": [ - "%run \"../../Setup_Scripts/Setup_Generic.ipynb\"" + "%run \"../Setup.ipynb\"" ] }, { diff --git a/jupyter/lab/2_Fault_Lab/4_Glitching_a_Bootloader.ipynb b/jupyter/lab/2_Fault_Lab/4_Glitching_a_Bootloader.ipynb index 5d86f984..0c18fc49 100644 --- a/jupyter/lab/2_Fault_Lab/4_Glitching_a_Bootloader.ipynb +++ b/jupyter/lab/2_Fault_Lab/4_Glitching_a_Bootloader.ipynb @@ -80,7 +80,7 @@ "metadata": {}, "outputs": [], "source": [ - "%run \"../../Setup_Scripts/Setup_Generic.ipynb\"" + "%run \"../Setup.ipynb\"" ] }, { @@ -100,7 +100,7 @@ "metadata": {}, "outputs": [], "source": [ - "fw_path = \".../../../firmware/mcu/simpleserial-aes-bootloader/simpleserial-bootloader-{}.hex\".format(PLATFORM)\n", + "fw_path = \"../../../firmware/mcu/simpleserial-aes-bootloader/simpleserial-bootloader-{}.hex\".format(PLATFORM)\n", "cw.program_target(scope, prog, fw_path)\n", "target.reset_comms()" ] diff --git a/jupyter/lab/1_SCA_Lab/Setup.ipynb b/jupyter/lab/Setup.ipynb similarity index 100% rename from jupyter/lab/1_SCA_Lab/Setup.ipynb rename to jupyter/lab/Setup.ipynb