1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

call progress callback at the beginning of pbkdf2 calculation

This commit is contained in:
Pavol Rusnak 2016-01-19 15:34:31 +01:00
parent 9a8e982153
commit fbc0df736a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -42,6 +42,9 @@ void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, uint8_t *salt, int sal
salt[saltlen + 3] = i & 0xFF;
hmac_sha256(pass, passlen, salt, saltlen + 4, g);
memcpy(f, g, HMACLEN);
if (progress_callback) {
progress_callback(0, iterations);
}
for (j = 1; j < iterations; j++) {
hmac_sha256(pass, passlen, g, HMACLEN, g);
for (k = 0; k < HMACLEN; k++) {
@ -77,6 +80,9 @@ void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, uint8_t *salt, int sal
salt[saltlen + 3] = i & 0xFF;
hmac_sha512(pass, passlen, salt, saltlen + 4, g);
memcpy(f, g, HMACLEN);
if (progress_callback) {
progress_callback(0, iterations);
}
for (j = 1; j < iterations; j++) {
hmac_sha512(pass, passlen, g, HMACLEN, g);
for (k = 0; k < HMACLEN; k++) {