aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJ08nY2023-10-06 15:26:06 +0200
committerJ08nY2023-10-06 15:26:06 +0200
commit71579306e7c63123426e5bda105e3ab850fbbb20 (patch)
tree854403cca3e31606e365bf762fb00066ce95c843
parent135a0ba95497e10fb3b22bef25eaff1d043b0c0b (diff)
downloadpyecsca-codegen-71579306e7c63123426e5bda105e3ab850fbbb20.tar.gz
pyecsca-codegen-71579306e7c63123426e5bda105e3ab850fbbb20.tar.zst
pyecsca-codegen-71579306e7c63123426e5bda105e3ab850fbbb20.zip
Test under -fsanitize and fix Keccak issue.
-rw-r--r--pyecsca/codegen/prng/KeccakP-200-compact.c4
-rw-r--r--test/test_impl.py3
2 files changed, 6 insertions, 1 deletions
diff --git a/pyecsca/codegen/prng/KeccakP-200-compact.c b/pyecsca/codegen/prng/KeccakP-200-compact.c
index 42c972b..f07bae9 100644
--- a/pyecsca/codegen/prng/KeccakP-200-compact.c
+++ b/pyecsca/codegen/prng/KeccakP-200-compact.c
@@ -169,7 +169,9 @@ void KeccakP200_Permute_18rounds(void *argState)
void KeccakP200_ExtractBytes(const void *state, unsigned char *data, unsigned int offset, unsigned int length)
{
- memcpy(data, (UINT8*)state+offset, length);
+ if (length) {
+ memcpy(data, (UINT8*)state+offset, length);
+ }
}
/* ---------------------------------------------------------------- */
diff --git a/test/test_impl.py b/test/test_impl.py
index c125ce6..cb5b583 100644
--- a/test/test_impl.py
+++ b/test/test_impl.py
@@ -187,6 +187,9 @@ def target(request, additional, secp128r1) -> ImplTarget:
f"{mult_name}({','.join(f'{key}={value}' for key, value in mult_kwargs.items())})",
".",
],
+ env={
+ "CFLAGS": "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all"
+ }
)
assert res.exit_code == 0
target = HostTarget(