forked from wolfSSL/wolfssl
fix location in tfm.c that could result in potential cache attack
This commit is contained in:
@ -480,12 +480,11 @@ void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
|
|||||||
pa = FP_SIZE-1;
|
pa = FP_SIZE-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (A == C || B == C) {
|
/* Always take branch to use tmp variable. This avoids a cache attack for
|
||||||
|
* determining if C equals A */
|
||||||
|
if (1) {
|
||||||
fp_init(&tmp);
|
fp_init(&tmp);
|
||||||
dst = &tmp;
|
dst = &tmp;
|
||||||
} else {
|
|
||||||
fp_zero(C);
|
|
||||||
dst = C;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ix = 0; ix < pa; ix++) {
|
for (ix = 0; ix < pa; ix++) {
|
||||||
|
Reference in New Issue
Block a user