mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
crypto/shamir: Memzero stack variables even in performace critical functions.
This commit is contained in:
parent
223868f552
commit
025974a97d
@ -192,6 +192,8 @@ static void gf256_mul(uint32_t r[8], const uint32_t a[8], const uint32_t b[8]) {
|
|||||||
r[5] ^= a2[6] & b[7];
|
r[5] ^= a2[6] & b[7];
|
||||||
r[6] ^= a2[7] & b[7];
|
r[6] ^= a2[7] & b[7];
|
||||||
r[7] ^= a2[0] & b[7];
|
r[7] ^= a2[0] & b[7];
|
||||||
|
|
||||||
|
memzero(a2, sizeof(a2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -253,6 +255,9 @@ static void gf256_inv(uint32_t r[8], uint32_t x[8]) {
|
|||||||
gf256_square(z, z); // z = x^200
|
gf256_square(z, z); // z = x^200
|
||||||
gf256_mul(r, r, z); // r = x^250
|
gf256_mul(r, r, z); // r = x^250
|
||||||
gf256_mul(r, r, y); // r = x^254
|
gf256_mul(r, r, y); // r = x^254
|
||||||
|
|
||||||
|
memzero(y, sizeof(y));
|
||||||
|
memzero(z, sizeof(z));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shamir_interpolate(uint8_t *result, uint8_t result_index,
|
bool shamir_interpolate(uint8_t *result, uint8_t result_index,
|
||||||
|
Loading…
Reference in New Issue
Block a user