Closed F-Lehmann closed 2 months ago
Thanks for reporting the bug !
For anybody looking to fix it: the issue seems to be that in function factor_gen_factor
(https://github.com/simple-crypto/SCALib/blob/main/src/scalib_ext/scalib/src/sasca/belief_propagation.rs#L876), we always run a loop for i in 0..nmulti
, while it should not be done when all the variables adjacent to the factor are SINGLE
, in which case we should have only one iteration. This case can be detected using the factor.multi
attribute.
The factor_gen_factor
function should probably be refactored while doing so.
With your hint I wasa able to come up with a simple (but ugly) fix that works for me.
I changed the loop to this:
for i in 0..(if factor.multi {nmulti} else {1}) {
Describe the bug Gereic factors throw an error when only working on Single Vars when n_exec > 1
To Reproduce
Observed behavior
I belive the problem is in "src/scalib_ext/scalib/src/sasca/belief_propagation.rs:893" iterating over nmulti when that is wrong here.
Expected behavior Not panic
Environment (please complete the following information):