Commit 697c06a
[otbn,rtl] Harden acc_qw_sel in bignum MAC against FI attack
This commits predecodes the acc_qw_sel signal to avoid a tricky SW mitigation against FI attacks,
see detailed problem description below. It is predecoded by refactoring it into a 4 bit signal which
controls the MUXing of the ACC merging for each quad word (64 bits) separately.
The problem when acc_qw_sel is not predecoded:
The acc_qw_sel signal controls which quarter word of the ACC is overwritten with multiplication
results during a vectorized multiplication. These instructions process 64 bits at a time and thus
have 4 updates to the ACC WSR.
This signal did not have a redundand signal. Therefore, an attack on this signal is an issue for the
bn.mulv(m) instructions because:
1) A stuck at fault is induced into the bits such that acc_qw_sel = '0.
Yes this requires in theory two attacks as acc_qw_sel is 2 bit wide. But I think it is reasonable that both gates can be FIed
with only one attack as the signals are quite related. A multiplication thus will write all 4
results into the same QW of ACC. The other 3 QW keep the original value.
This allows that QW0 has the wrong result and the other 3 QW have a deterministic value (the value
before the instruction). This could be bad, especially if we perform a multiplication where not all
vector elements contain actual data. If only, e.g., 7 out of 8 elements contain data and element 8
is all-zero, this would allow to set a QW to zero (a deterministic value).
A SW solution solving this would be to ensure that the ACC register is cleared with a random value before
executing a instruction. This is actually supported as the bn.mulv(m) instructions clear ACC in
their last cycle and the ACC could also be cleared by using a bn.wsrw instruction.
However, with this mitigation we would still not directly detect the attack (we would only have a
wrong result). The same randomization would also be needed for unused input vector elements. This
adds considerable burdens to the programmer and is also a great source of vulnerabilities.
2) The acc_qw_sel signal is faulted transiently.
In this case only one result is written to the wrong QW and therefore one QW would keep its value.
Otherwise there are the same problems and the same SW solution could be used.
As the SW solution is cumbersome and easy to do wrong, this commit predecodes the acc_qw_sel signal
by refactoring it to a single bit MUX per QW.
Signed-off-by: Pascal Etterli <pascal.etterli@lowrisc.org>1 parent 856b98b commit 697c06a
File tree
5 files changed
+39
-34
lines changed- hw/ip/otbn/rtl
5 files changed
+39
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
509 | 508 | | |
510 | 509 | | |
511 | 510 | | |
| |||
526 | 525 | | |
527 | 526 | | |
528 | 527 | | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
537 | 532 | | |
538 | 533 | | |
539 | 534 | | |
| |||
687 | 682 | | |
688 | 683 | | |
689 | 684 | | |
690 | | - | |
691 | 685 | | |
692 | 686 | | |
693 | 687 | | |
| |||
745 | 739 | | |
746 | 740 | | |
747 | 741 | | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
748 | 748 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| |||
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
177 | | - | |
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| |||
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
226 | | - | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| 232 | + | |
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
| |||
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
| 330 | + | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
| 619 | + | |
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
| |||
624 | 625 | | |
625 | 626 | | |
626 | 627 | | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
| 835 | + | |
835 | 836 | | |
836 | 837 | | |
837 | 838 | | |
| |||
0 commit comments