aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ08nY2024-05-31 13:13:10 +0200
committerJ08nY2024-05-31 13:13:10 +0200
commit4b589dd989285c784789d08714bd721e697235fc (patch)
tree8d9254c3517f486a7adedfd94d80e5f252a230a1
parentadaa5cd6a98fc6610226b9f8048e1e41a4050138 (diff)
downloadpyecsca-4b589dd989285c784789d08714bd721e697235fc.tar.gz
pyecsca-4b589dd989285c784789d08714bd721e697235fc.tar.zst
pyecsca-4b589dd989285c784789d08714bd721e697235fc.zip
-rw-r--r--pyecsca/sca/stacked_traces/combine.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pyecsca/sca/stacked_traces/combine.py b/pyecsca/sca/stacked_traces/combine.py
index 69cbb59..4b03985 100644
--- a/pyecsca/sca/stacked_traces/combine.py
+++ b/pyecsca/sca/stacked_traces/combine.py
@@ -705,12 +705,13 @@ class CPUTraceManager:
raise ValueError("Invalid shape of intermediate_values, "
f"expected ({n},), "
f"got {intermediate_values.shape}")
-
+ new_size = str(samples.dtype.itemsize * 2) if samples.dtype.itemsize != 8 else "8"
+ dtype = np.dtype(samples.dtype.kind + new_size)
sam_sum = np.sum(samples, axis=0)
- sam_sq_sum = np.sum(np.square(samples), axis=0)
+ sam_sq_sum = np.sum(np.square(samples, dtype=dtype), axis=0)
iv_sum = np.sum(intermediate_values)
- iv_sq_sum = np.sum(np.square(intermediate_values))
+ iv_sq_sum = np.sum(np.square(intermediate_values, dtype=dtype))
prod_sum = intermediate_values @ samples