From ed538f84a837e4b4bec1af96f4de50ee7f996810 Mon Sep 17 00:00:00 2001 From: paul90317 Date: Wed, 10 May 2023 19:14:21 +0800 Subject: [PATCH] Fix the issue that array size exceed the boundary input_data exceed its boundary which make classes array is not randomized. After modification, the trace 17 can't pass but this makes sence because implementation of precentiles should make the dudect have less leakage durability. --- dudect/constant.c | 2 +- dudect/fixture.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dudect/constant.c b/dudect/constant.c index ed252412d..ef3dceb7a 100644 --- a/dudect/constant.c +++ b/dudect/constant.c @@ -50,7 +50,7 @@ void prepare_inputs(uint8_t *input_data, uint8_t *classes) { randombytes(input_data, N_MEASURES * CHUNK_SIZE); for (size_t i = 0; i < N_MEASURES; i++) { - classes[i] = rand() & 1; + classes[i] = randombit(); if (classes[i] == 0) memset(input_data + i * CHUNK_SIZE, 0, CHUNK_SIZE); } diff --git a/dudect/fixture.c b/dudect/fixture.c index fb60681a8..3c81e8347 100644 --- a/dudect/fixture.c +++ b/dudect/fixture.c @@ -155,7 +155,7 @@ int64_t before_ticks[N_MEASURES]; int64_t after_ticks[N_MEASURES]; int64_t exec_times[N_MEASURES]; uint8_t classes[N_MEASURES]; -uint8_t input_data[N_MEASURES]; +uint8_t input_data[N_MEASURES * CHUNK_SIZE]; FILE *dudect_out; static report_state_t dudect_main(int mode) {